|
23 | 23 | from circuitpython_typing import ReadableBuffer
|
24 | 24 |
|
25 | 25 | try:
|
26 |
| - from typing import Literal |
| 26 | + from typing import Literal, Optional |
27 | 27 | except ImportError:
|
28 | 28 | from typing_extensions import Literal
|
29 | 29 |
|
@@ -131,7 +131,7 @@ class RFM9x(RFMSPI):
|
131 | 131 | - preamble_length: The length in bytes of the packet preamble (default 8).
|
132 | 132 | - high_power: Boolean to indicate a high power board (RFM95, etc.). Default
|
133 | 133 | is True for high power.
|
134 |
| - - baudrate: Baud rate of the SPI connection, default is 10mhz but you might |
| 134 | + - baudrate: Baud rate of the SPI connection, default is 5mhz but you might |
135 | 135 | choose to lower to 1mhz if using long wires or a breadboard.
|
136 | 136 | - agc: Boolean to Enable/Disable Automatic Gain Control - Default=False (AGC off)
|
137 | 137 | - crc: Boolean to Enable/Disable Cyclic Redundancy Check - Default=True (CRC Enabled)
|
@@ -517,10 +517,11 @@ def fill_fifo(self, payload: ReadableBuffer) -> None:
|
517 | 517 | # Write payload and header length.
|
518 | 518 | self.write_u8(_RF95_REG_22_PAYLOAD_LENGTH, len(payload))
|
519 | 519 |
|
520 |
| - def read_fifo(self) -> bytearray: |
| 520 | + def read_fifo(self) -> Optional[bytearray]: |
521 | 521 | """Read the data from the FIFO."""
|
522 | 522 | # Read the length of the FIFO.
|
523 | 523 | fifo_length = self.read_u8(_RF95_REG_13_RX_NB_BYTES)
|
| 524 | + packet = None # return None if FIFO empty |
524 | 525 | if fifo_length > 0: # read and clear the FIFO if anything in it
|
525 | 526 | packet = bytearray(fifo_length)
|
526 | 527 | current_addr = self.read_u8(_RF95_REG_10_FIFO_RX_CURRENT_ADDR)
|
|
0 commit comments