Skip to content

Commit 7dbac75

Browse files
committed
doc updates
mostly spell checking some sphinx config changes
1 parent 178d6b0 commit 7dbac75

7 files changed

Lines changed: 101 additions & 21 deletions

File tree

.cspell.config.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,53 @@ words:
55
- addopts
66
- armv
77
- ATSAMD
8+
- autoattribute
9+
- autoclass
10+
- autofunction
11+
- automethod
12+
- automodule
13+
- autoproperty
814
- baudrate
15+
- bgcolor
916
- blinka
1017
- busdevice
1118
- busio
19+
- bysource
20+
- bytearray
1221
- capsys
22+
- CELLBORDER
23+
- CELLSPACING
1324
- CIRCUITPY
1425
- circuitpython
26+
- coef
1527
- datasheet
28+
- dhcplist
1629
- digitalio
1730
- Disabl
1831
- Dmitry
32+
- docstitle
1933
- Doherty
2034
- Eddystone
2135
- elif
2236
- Fals
37+
- fontcolor
38+
- fontname
39+
- fontsize
40+
- graphviz
2341
- Grinberg
2442
- hexlified
2543
- HHHBB
2644
- Hinch
45+
- intersphinx
46+
- isascii
2747
- Itsy
2848
- Kbps
49+
- labelloc
2950
- LENG
3051
- levelname
3152
- Mbps
3253
- microcontroller
54+
- microcontrollers
3355
- micropython
3456
- minversion
3557
- MOSI
@@ -38,16 +60,29 @@ words:
3860
- multicasts
3961
- multiceiver
4062
- mypy
63+
- newrank
64+
- penwidth
4165
- Pinout
66+
- Pluss
4267
- pytest
68+
- ranksep
4369
- raspberrypi
70+
- repr
71+
- rgba
4472
- Rhys
73+
- Roboto
4574
- seealso
75+
- setlinewidth
4676
- setuptools
77+
- sparkfun
4778
- spidev
4879
- testpaths
4980
- toctree
81+
- twopi
5082
- urandom
5183
- venv
5284
- versionadded
85+
- versionchanged
86+
- viewcode
87+
- WLAN
5388
- xfer

docs/conf.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,9 @@
121121

122122
html_theme_options = {
123123
"features": [
124-
# "navigation.expand",
125124
"navigation.tabs",
126-
# "toc.integrate",
127125
"navigation.sections",
128126
"navigation.instant",
129-
# "header.autohide",
130127
"navigation.top",
131128
# "search.highlight",
132129
"search.share",
@@ -163,6 +160,13 @@
163160
},
164161
],
165162
"palette": [
163+
{
164+
"media": "(prefers-color-scheme)",
165+
"toggle": {
166+
"icon": "material/brightness-auto",
167+
"name": "Switch to dark mode",
168+
},
169+
},
166170
{
167171
"media": "(prefers-color-scheme: dark)",
168172
"scheme": "slate",
@@ -188,8 +192,6 @@
188192
"site_url": html_baseurl,
189193
"repo_url": "https://github.com/nRF24/CircuitPython_nRF24L01/",
190194
"repo_name": "CircuitPython_nRF24L01",
191-
# If False, expand all TOC entries
192-
"globaltoc_collapse": False,
193195
"toc_title_is_page_title": True,
194196
}
195197

@@ -262,6 +264,3 @@
262264

263265
# project logo
264266
html_logo = "_static/Logo large.png"
265-
266-
# Output file base name for HTML help builder.
267-
htmlhelp_basename = "nRF24L01_Library_doc"

docs/core_api/advanced_api.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ Debugging Output
286286
287287
:param buf: The buffer of bytes to convert into a hexlified
288288
string.
289-
:param reverse: A `bool` to control the resulting endianess. `True`
289+
:param reverse: A `bool` to control the resulting endianness. `True`
290290
outputs the result as big endian. `False` outputs the result as little
291291
endian. This parameter defaults to `True` since `bytearray` and `bytes`
292292
objects are stored in big endian but written in little endian.
@@ -416,8 +416,7 @@ Status Byte
416416
is an antiquated status flag (after you've dealt with the specific payload related to
417417
the status flags that were set), otherwise it can cause payloads to be ignored and
418418
occupy the RX/TX FIFO buffers. See `Appendix A of the nRF24L01+ Specifications Sheet
419-
<https://www.sparkfun.com/datasheets/Components/SMD/
420-
nRF24L01Pluss_Preliminary_Product_Specification_v1_0.pdf#G1047965>`_ for an outline of
419+
<https://www.sparkfun.com/datasheets/Components/SMD/nRF24L01Pluss_Preliminary_Product_Specification_v1_0.pdf#G1047965>`_ for an outline of
421420
proper behavior.
422421

423422

docs/core_api/ble_api.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ here has been adapted to work with CircuitPython.
128128
.. autofunction:: circuitpython_nrf24l01.fake_ble.whitener
129129

130130
This is a helper function to `FakeBLE.whiten()`. It has been broken out of the
131-
`FakeBLE` class to allow whitening and dewhitening a BLE payload without the
131+
`FakeBLE` class to allow whitening and de-whitening a BLE payload without the
132132
hardcoded coefficient.
133133

134134
:param buf: The BLE payloads data. This data should include the
@@ -220,7 +220,7 @@ FakeBLE class
220220

221221
.. versionchanged:: 2.1.0 Invalid input ignored
222222

223-
Prevoiusly, any invalid input value (that is not found in `BLE_FREQ`) had raised a
223+
Previously, any invalid input value (that is not found in `BLE_FREQ`) had raised a
224224
`ValueError` exception. This behavior changed to ignoring invalid input values,
225225
and the exception is no longer raised.
226226

docs/troubleshooting.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ version:
157157
* :attr:`~circuitpython_nrf24l01.rf24.RF24.pa_level` is available, but it will not accept a `list` or `tuple`.
158158
* `start_carrier_wave()`, & `stop_carrier_wave()` removed. These only perform a
159159
test of the nRF24L01's hardware. `rpd` is still available.
160-
* All comments and docstrings removed, meaning ``help()`` will not provide any specific
160+
* All comments and doc comments removed, meaning ``help()`` will not provide any specific
161161
information. Exception prompts have also been reduced and adjusted accordingly.
162162
* Cannot switch between different radio configurations using context manager (the `with`
163163
blocks). It is advised that only one `RF24` object be instantiated when RAM is limited

tests/test_fake_ble.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def test_lvl_mask(lvl: int, expected: int):
3535

3636

3737
def test_whitener(ble_obj: FakeBLE):
38-
"""test whitening and dewhitening an arbitrary buffer."""
38+
"""test whitening and de-whitening an arbitrary buffer."""
3939
buf = os.urandom(24)
4040
for freq in range(3):
4141
coef = (freq + 37) | 0x40
@@ -65,7 +65,7 @@ def test_rev_bits():
6565
def test_ble_mac(ble_obj: FakeBLE, addr: Optional[Union[int, bytes]]):
6666
"""test the FakeBLE mac attribute."""
6767
assert isinstance(ble_obj.mac, (bytes, bytearray))
68-
ble_obj.mac = addr
68+
ble_obj.mac = addr # type: ignore[assignment]
6969
assert ble_obj.mac is not None and len(ble_obj.mac) == 6
7070
if addr is not None:
7171
if isinstance(addr, int):
@@ -86,7 +86,7 @@ def test_ble_mac(ble_obj: FakeBLE, addr: Optional[Union[int, bytes]]):
8686
)
8787
def test_name(ble_obj: FakeBLE, name: Optional[Union[str, bytes, int]]):
8888
"""test FakeBLE name attribute."""
89-
ble_obj.name = name
89+
ble_obj.name = name # type: ignore[assignment]
9090
if isinstance(name, str):
9191
assert name.encode(encoding="utf-8") == ble_obj.name
9292
else:
@@ -103,7 +103,7 @@ def test_name(ble_obj: FakeBLE, name: Optional[Union[str, bytes, int]]):
103103
def test_show_pa_level(ble_obj: FakeBLE, name: Optional[Union[str, bytes, int]]):
104104
"""test FakeBLE show_pa_level attribute."""
105105
assert not ble_obj.show_pa_level
106-
ble_obj.name = name
106+
ble_obj.name = name # type: ignore[assignment]
107107
ble_obj.show_pa_level = True
108108
assert ble_obj.show_pa_level
109109

@@ -169,11 +169,12 @@ def inject_rx_payload(ble_obj: FakeBLE, monkeypatch: pytest.MonkeyPatch):
169169
return repr(service_data)
170170

171171

172-
def test_rx_payload(ble_obj: FakeBLE, inject_rx_payload: pytest.fixture):
172+
def test_rx_payload(ble_obj: FakeBLE, inject_rx_payload: pytest.fixture): # type: ignore
173173
"""test available() and read()"""
174174
buf_repr = inject_rx_payload
175175
assert ble_obj.available()
176176
payload = ble_obj.read()
177+
assert payload
177178
assert payload.mac == ble_obj.mac
178179
assert payload.name == "test"
179180
assert not payload.pa_level

tests/test_rf24.py

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"""Test functions related to core RF24 functionality."""
22

3-
from typing import Optional
3+
from typing import Optional, Union
44
import pytest
5-
from circuitpython_nrf24l01.rf24 import RF24
5+
from circuitpython_nrf24l01.rf24 import RF24, FIFO_EMPTY, FIFO_FULL, FIFO_OCCUPIED
66
from circuitpython_nrf24l01.fake_ble import FakeBLE
77

88

@@ -299,3 +299,49 @@ def test_carrier_functions(rf24_obj: RF24, monkeypatch: pytest.MonkeyPatch):
299299
assert not rf24_obj.power
300300
assert not rf24_obj.ce_pin
301301
assert not rf24_obj._spi._spi.state.registers[6][0] & 0x90
302+
303+
304+
@pytest.mark.parametrize(
305+
"reg_val,expected,about_tx,check_empty",
306+
[
307+
# raw RX state
308+
(0x1, FIFO_EMPTY, False, None),
309+
(0x2, FIFO_FULL, False, None),
310+
(0, FIFO_OCCUPIED, False, None),
311+
# raw TX state
312+
(0x10, FIFO_EMPTY, True, None),
313+
(0x20, FIFO_FULL, True, None),
314+
(0, FIFO_OCCUPIED, True, None),
315+
# simplified RX state
316+
(0x1, bool(FIFO_EMPTY), False, True), # is empty
317+
(0x2, bool(FIFO_FULL), False, False), # is full
318+
# simplified TX state
319+
(0x10, bool(FIFO_EMPTY), True, True), # is empty
320+
(0x20, bool(FIFO_FULL), True, False), # is full
321+
# simulated binary corrupted MISO
322+
pytest.param(3, 3, False, None, marks=pytest.mark.xfail),
323+
],
324+
ids=[
325+
"RX_EMPTY",
326+
"RX_FULL",
327+
"RX_OCCUPIED",
328+
"TX_EMPTY",
329+
"TX_FULL",
330+
"TX_OCCUPIED",
331+
"bool(RX_EMPTY)",
332+
"bool(RX_FULL)",
333+
"bool(TX_EMPTY)",
334+
"bool(TX_FULL)",
335+
"bin-corruption",
336+
],
337+
)
338+
def test_fifo_state(
339+
rf24_obj,
340+
reg_val: int,
341+
expected: Union[int, bool],
342+
about_tx: bool,
343+
check_empty: Optional[bool],
344+
):
345+
"""check the fifo state is accurately described"""
346+
rf24_obj._spi._spi.state.registers[0x17][0] = reg_val
347+
assert expected == rf24_obj.fifo(about_tx=about_tx, check_empty=check_empty)

0 commit comments

Comments
 (0)