Skip to content

Commit 033ac44

Browse files
committed
fix docs generation, a few changes per review
1 parent 829d767 commit 033ac44

File tree

5 files changed

+36
-10
lines changed

5 files changed

+36
-10
lines changed

adafruit_rfm/rfm69.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# SPDX-License-Identifier: MIT
44

55
"""
6-
`adafruit_rfm69`
6+
`adafruit_rfm.rfm69`
77
====================================================
88
99
CircuitPython RFM69 packet radio module. This supports sending and
@@ -33,12 +33,12 @@
3333
except ImportError:
3434
pass
3535

36-
3736
try:
3837
from typing import Optional
3938

4039
import busio
4140
import digitalio
41+
from circuitpython_typing import ReadableBuffer
4242

4343
except ImportError:
4444
pass
@@ -567,6 +567,7 @@ def enable_crc(self, val: bool) -> None:
567567
else:
568568
self.crc_on = 0
569569

570+
@property
570571
def crc_error(self) -> bool:
571572
"""crc status"""
572573
return (self.read_u8(_RF69_REG_28_IRQ_FLAGS2) & 0x2) >> 1
@@ -629,7 +630,7 @@ def clear_interrupt(self) -> None:
629630
self.write_u8(_RF69_REG_27_IRQ_FLAGS1, 0xFF)
630631
self.write_u8(_RF69_REG_28_IRQ_FLAGS2, 0xFF)
631632

632-
def fill_fifo(self, payload: bytearray) -> None:
633+
def fill_fifo(self, payload: ReadableBuffer) -> None:
633634
"""Write the payload to the FIFO."""
634635
complete_payload = bytearray(1) # prepend packet length to payload
635636
complete_payload[0] = len(payload)

adafruit_rfm/rfm9x.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# SPDX-License-Identifier: MIT
44

55
"""
6-
`adafruit_rfm9x`
6+
`adafruit_rfm.rfm9x`
77
====================================================
88
99
CircuitPython module for the RFM95/6/7/8 LoRa 433/915mhz radio modules.
@@ -20,6 +20,7 @@
2020
try:
2121
import busio
2222
import digitalio
23+
from circuitpython_typing import ReadableBuffer
2324

2425
try:
2526
from typing import Literal
@@ -490,6 +491,7 @@ def enable_crc(self, val: bool) -> None:
490491
self.read_u8(_RF95_REG_1E_MODEM_CONFIG2) & 0xFB,
491492
)
492493

494+
@property
493495
def crc_error(self) -> bool:
494496
"""crc status"""
495497
return (self.read_u8(_RF95_REG_12_IRQ_FLAGS) & 0x20) >> 5
@@ -506,7 +508,7 @@ def clear_interrupt(self) -> None:
506508
"""Clear Interrupt flags"""
507509
self.write_u8(_RF95_REG_12_IRQ_FLAGS, 0xFF)
508510

509-
def fill_fifo(self, payload: bytearray) -> None:
511+
def fill_fifo(self, payload: ReadableBuffer) -> None:
510512
"""len_data is not used but is here for compatibility with rfm69
511513
Fill the FIFO with a packet to send"""
512514
self.write_u8(_RF95_REG_0D_FIFO_ADDR_PTR, 0x00) # FIFO starts at 0.

adafruit_rfm/rfm9xfsk.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# SPDX-License-Identifier: MIT
44

55
"""
6-
`adafruit_rfm9xFSK`
6+
`adafruit_rfm.rfm9xfsk`
77
====================================================
88
99
CircuitPython module for the RFM95/6/7/8 FSK 433/915mhz radio modules.
@@ -22,6 +22,7 @@
2222

2323
import busio
2424
import digitalio
25+
from circuitpython_typing import ReadableBuffer
2526

2627
try:
2728
from typing import Literal
@@ -490,6 +491,7 @@ def enable_crc(self, val: bool) -> None:
490491
else:
491492
self.crc_on = 0
492493

494+
@property
493495
def crc_error(self) -> bool:
494496
"""crc status"""
495497
return (self.read_u8(_RF95_REG_3F_IRQ_FLAGS_2) & 0x2) >> 1
@@ -552,7 +554,7 @@ def clear_interrupt(self) -> None:
552554
self.write_u8(_RF95_REG_3E_IRQ_FLAGS_1, 0xFF)
553555
self.write_u8(_RF95_REG_3F_IRQ_FLAGS_2, 0xFF)
554556

555-
def fill_fifo(self, payload: bytearray) -> None:
557+
def fill_fifo(self, payload: ReadableBuffer) -> None:
556558
"""Write the payload to the FIFO."""
557559
complete_payload = bytearray(1) # prepend packet length to payload
558560
complete_payload[0] = len(payload)

adafruit_rfm/rfm_common.py

+14-2
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,9 @@ async def asyncio_send( # noqa: PLR0912 PLR0913
336336
return not timed_out
337337

338338
send = asyncio_to_blocking(asyncio_send)
339+
"""Non-asyncio wrapper to Send a string of data using the transmitter
340+
using the same arguments and keywords as asyncio_send()
341+
"""
339342

340343
async def asyncio_send_with_ack(self, data: ReadableBuffer) -> bool:
341344
"""Reliable Datagram mode:
@@ -377,6 +380,9 @@ async def asyncio_send_with_ack(self, data: ReadableBuffer) -> bool:
377380
return got_ack
378381

379382
send_with_ack = asyncio_to_blocking(asyncio_send_with_ack)
383+
"""Non-asyncio wrapper to Send a string of data using the transmitter
384+
using the same arguments and keywords as asyncio_send_with_ack()
385+
"""
380386

381387
async def asyncio_receive( # noqa: PLR0912
382388
self,
@@ -420,7 +426,7 @@ async def asyncio_receive( # noqa: PLR0912
420426
# Enter idle mode to stop receiving other packets.
421427
self.idle()
422428
if not timed_out:
423-
if self.enable_crc and self.crc_error():
429+
if self.enable_crc and self.crc_error:
424430
self.crc_error_count += 1
425431
else:
426432
packet = self.read_fifo()
@@ -447,6 +453,9 @@ async def asyncio_receive( # noqa: PLR0912
447453
return packet
448454

449455
receive = asyncio_to_blocking(asyncio_receive)
456+
"""Non-asyncio wrapper to Receive a packet
457+
using the same arguments and keywords as asyncio_receive()
458+
"""
450459

451460
async def asyncio_receive_with_ack( # noqa: PLR0912
452461
self,
@@ -490,7 +499,7 @@ async def asyncio_receive_with_ack( # noqa: PLR0912
490499
# Enter idle mode to stop receiving other packets.
491500
self.idle()
492501
if not timed_out:
493-
if self.enable_crc and self.crc_error():
502+
if self.enable_crc and self.crc_error:
494503
self.crc_error_count += 1
495504
else:
496505
packet = self.read_fifo()
@@ -543,3 +552,6 @@ async def asyncio_receive_with_ack( # noqa: PLR0912
543552
return packet
544553

545554
receive_with_ack = asyncio_to_blocking(asyncio_receive_with_ack)
555+
"""Non-asyncio wrapper to Receive a packet
556+
using the same arguments and keywords as asyncio_receive_with_ack()
557+
"""

docs/api.rst

+10-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,14 @@
44
.. If your library file(s) are nested in a directory (e.g. /adafruit_foo/foo.py)
55
.. use this format as the module name: "adafruit_foo.foo"
66
7-
.. automodule:: adafruit_rfm
7+
.. automodule:: adafruit_rfm.rfm_common
8+
:members:
9+
10+
.. automodule:: adafruit_rfm.rfm69
11+
:members:
12+
13+
.. automodule:: adafruit_rfm.rfm9x
14+
:members:
15+
16+
.. automodule:: adafruit_rfm.rfm9xfsk
817
:members:

0 commit comments

Comments
 (0)