Skip to content

Commit af1a916

Browse files
committed
update comments
1 parent c096b11 commit af1a916

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

adafruit_rfm69.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,9 @@ def send(self, data, timeout=2.,
679679
"""Send a string of data using the transmitter.
680680
You can only send 60 bytes at a time
681681
(limited by chip's FIFO size and appended headers).
682-
Note this appends a 4 byte header to be compatible with the RadioHead library.
682+
This appends a 4 byte header to be compatible with the RadioHead library.
683+
The tx_header defaults to using the Broadcast addresses. It may be overidden
684+
by specifying a 4-tuple of bytes containing (To,From,ID,Flags)
683685
The timeout is just to prevent a hang (arbitrarily set to 2 seconds)
684686
"""
685687
# Disable pylint warning to not use length as a check for zero.
@@ -725,10 +727,22 @@ def receive(self, timeout=0.5, keep_listening=True, with_header=False,
725727
"""Wait to receive a packet from the receiver. Will wait for up to timeout_s amount of
726728
seconds for a packet to be received and decoded. If a packet is found the payload bytes
727729
are returned, otherwise None is returned (which indicates the timeout elapsed with no
728-
reception). Note this assumes a 4-byte header is prepended to the data for compatibilty
729-
with the RadioHead library (the header is not validated nor returned). If keep_listening
730-
is True (the default) the chip will immediately enter listening mode after reception of
731-
a packet, otherwise it will fall back to idle mode and ignore any future reception.
730+
reception).
731+
If keep_listening is True (the default) the chip will immediately enter listening mode
732+
after reception of a packet, otherwise it will fall back to idle mode and ignore any
733+
future reception.
734+
A 4-byte header must be prepended to the data for compatibilty with the
735+
RadioHead library.
736+
The header consists of a 4 bytes (To,From,ID,Flags). The default setting will accept
737+
any incomming packet and strip the header before returning the packet to the caller.
738+
If with_header is True then the 4 byte header will be returned with the packet.
739+
The payload then begins at packet[4].
740+
rx_fliter may be set to reject any "non-broadcast" packets that do not contain the
741+
specfied "To" value in the header.
742+
if rx_filter is set to 0xff (_RH_BROADCAST_ADDRESS) or if the "To" field (packet[[0])
743+
is equal to 0xff then the packet will be accepted and returned to the caller.
744+
If rx_filter is not 0xff and packet[0] does not match rx_filter then
745+
the packet is ignored and None is returned.
732746
"""
733747
# Make sure we are listening for packets.
734748
self.listen()

0 commit comments

Comments
 (0)