fix docs generation, a few changes per review

This commit is contained in:
jerryneedell 2024-08-07 08:21:33 -04:00
parent 829d767d24
commit 033ac446f3
5 changed files with 36 additions and 10 deletions

View file

@ -3,7 +3,7 @@
# SPDX-License-Identifier: MIT
"""
`adafruit_rfm69`
`adafruit_rfm.rfm69`
====================================================
CircuitPython RFM69 packet radio module. This supports sending and
@ -33,12 +33,12 @@ try:
except ImportError:
pass
try:
from typing import Optional
import busio
import digitalio
from circuitpython_typing import ReadableBuffer
except ImportError:
pass
@ -567,6 +567,7 @@ class RFM69(RFMSPI):
else:
self.crc_on = 0
@property
def crc_error(self) -> bool:
"""crc status"""
return (self.read_u8(_RF69_REG_28_IRQ_FLAGS2) & 0x2) >> 1
@ -629,7 +630,7 @@ class RFM69(RFMSPI):
self.write_u8(_RF69_REG_27_IRQ_FLAGS1, 0xFF)
self.write_u8(_RF69_REG_28_IRQ_FLAGS2, 0xFF)
def fill_fifo(self, payload: bytearray) -> None:
def fill_fifo(self, payload: ReadableBuffer) -> None:
"""Write the payload to the FIFO."""
complete_payload = bytearray(1) # prepend packet length to payload
complete_payload[0] = len(payload)

View file

@ -3,7 +3,7 @@
# SPDX-License-Identifier: MIT
"""
`adafruit_rfm9x`
`adafruit_rfm.rfm9x`
====================================================
CircuitPython module for the RFM95/6/7/8 LoRa 433/915mhz radio modules.
@ -20,6 +20,7 @@ from adafruit_rfm.rfm_common import RFMSPI
try:
import busio
import digitalio
from circuitpython_typing import ReadableBuffer
try:
from typing import Literal
@ -490,6 +491,7 @@ class RFM9x(RFMSPI):
self.read_u8(_RF95_REG_1E_MODEM_CONFIG2) & 0xFB,
)
@property
def crc_error(self) -> bool:
"""crc status"""
return (self.read_u8(_RF95_REG_12_IRQ_FLAGS) & 0x20) >> 5
@ -506,7 +508,7 @@ class RFM9x(RFMSPI):
"""Clear Interrupt flags"""
self.write_u8(_RF95_REG_12_IRQ_FLAGS, 0xFF)
def fill_fifo(self, payload: bytearray) -> None:
def fill_fifo(self, payload: ReadableBuffer) -> None:
"""len_data is not used but is here for compatibility with rfm69
Fill the FIFO with a packet to send"""
self.write_u8(_RF95_REG_0D_FIFO_ADDR_PTR, 0x00) # FIFO starts at 0.

View file

@ -3,7 +3,7 @@
# SPDX-License-Identifier: MIT
"""
`adafruit_rfm9xFSK`
`adafruit_rfm.rfm9xfsk`
====================================================
CircuitPython module for the RFM95/6/7/8 FSK 433/915mhz radio modules.
@ -22,6 +22,7 @@ try:
import busio
import digitalio
from circuitpython_typing import ReadableBuffer
try:
from typing import Literal
@ -490,6 +491,7 @@ class RFM9xFSK(RFMSPI):
else:
self.crc_on = 0
@property
def crc_error(self) -> bool:
"""crc status"""
return (self.read_u8(_RF95_REG_3F_IRQ_FLAGS_2) & 0x2) >> 1
@ -552,7 +554,7 @@ class RFM9xFSK(RFMSPI):
self.write_u8(_RF95_REG_3E_IRQ_FLAGS_1, 0xFF)
self.write_u8(_RF95_REG_3F_IRQ_FLAGS_2, 0xFF)
def fill_fifo(self, payload: bytearray) -> None:
def fill_fifo(self, payload: ReadableBuffer) -> None:
"""Write the payload to the FIFO."""
complete_payload = bytearray(1) # prepend packet length to payload
complete_payload[0] = len(payload)

View file

@ -336,6 +336,9 @@ class RFMSPI:
return not timed_out
send = asyncio_to_blocking(asyncio_send)
"""Non-asyncio wrapper to Send a string of data using the transmitter
using the same arguments and keywords as asyncio_send()
"""
async def asyncio_send_with_ack(self, data: ReadableBuffer) -> bool:
"""Reliable Datagram mode:
@ -377,6 +380,9 @@ class RFMSPI:
return got_ack
send_with_ack = asyncio_to_blocking(asyncio_send_with_ack)
"""Non-asyncio wrapper to Send a string of data using the transmitter
using the same arguments and keywords as asyncio_send_with_ack()
"""
async def asyncio_receive( # noqa: PLR0912
self,
@ -420,7 +426,7 @@ class RFMSPI:
# Enter idle mode to stop receiving other packets.
self.idle()
if not timed_out:
if self.enable_crc and self.crc_error():
if self.enable_crc and self.crc_error:
self.crc_error_count += 1
else:
packet = self.read_fifo()
@ -447,6 +453,9 @@ class RFMSPI:
return packet
receive = asyncio_to_blocking(asyncio_receive)
"""Non-asyncio wrapper to Receive a packet
using the same arguments and keywords as asyncio_receive()
"""
async def asyncio_receive_with_ack( # noqa: PLR0912
self,
@ -490,7 +499,7 @@ class RFMSPI:
# Enter idle mode to stop receiving other packets.
self.idle()
if not timed_out:
if self.enable_crc and self.crc_error():
if self.enable_crc and self.crc_error:
self.crc_error_count += 1
else:
packet = self.read_fifo()
@ -543,3 +552,6 @@ class RFMSPI:
return packet
receive_with_ack = asyncio_to_blocking(asyncio_receive_with_ack)
"""Non-asyncio wrapper to Receive a packet
using the same arguments and keywords as asyncio_receive_with_ack()
"""

View file

@ -4,5 +4,14 @@
.. If your library file(s) are nested in a directory (e.g. /adafruit_foo/foo.py)
.. use this format as the module name: "adafruit_foo.foo"
.. automodule:: adafruit_rfm
.. automodule:: adafruit_rfm.rfm_common
:members:
.. automodule:: adafruit_rfm.rfm69
:members:
.. automodule:: adafruit_rfm.rfm9x
:members:
.. automodule:: adafruit_rfm.rfm9xfsk
:members: