|
1 |
| -# The MIT License (MIT) |
| 1 | +# SPDX-FileCopyrightText: 2017 Tony DiCola for Adafruit Industries |
2 | 2 | #
|
3 |
| -# Copyright (c) 2017 Tony DiCola for Adafruit Industries |
4 |
| -# |
5 |
| -# Permission is hereby granted, free of charge, to any person obtaining a copy |
6 |
| -# of this software and associated documentation files (the "Software"), to deal |
7 |
| -# in the Software without restriction, including without limitation the rights |
8 |
| -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
9 |
| -# copies of the Software, and to permit persons to whom the Software is |
10 |
| -# furnished to do so, subject to the following conditions: |
11 |
| -# |
12 |
| -# The above copyright notice and this permission notice shall be included in |
13 |
| -# all copies or substantial portions of the Software. |
14 |
| -# |
15 |
| -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
16 |
| -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
17 |
| -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
18 |
| -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
19 |
| -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
20 |
| -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
21 |
| -# THE SOFTWARE. |
| 3 | +# SPDX-License-Identifier: MIT |
| 4 | + |
22 | 5 | """
|
23 | 6 | `adafruit_rfm9x`
|
24 | 7 | ====================================================
|
@@ -654,17 +637,17 @@ def send(
|
654 | 637 | flags=None
|
655 | 638 | ):
|
656 | 639 | """Send a string of data using the transmitter.
|
657 |
| - You can only send 252 bytes at a time |
658 |
| - (limited by chip's FIFO size and appended headers). |
659 |
| - This appends a 4 byte header to be compatible with the RadioHead library. |
660 |
| - The header defaults to using the initialized attributes: |
661 |
| - (destination,node,identifier,flags) |
662 |
| - It may be temporarily overidden via the kwargs - destination,node,identifier,flags. |
663 |
| - Values passed via kwargs do not alter the attribute settings. |
664 |
| - The keep_listening argument should be set to True if you want to start listening |
665 |
| - automatically after the packet is sent. The default setting is False. |
666 |
| -
|
667 |
| - Returns: True if success or False if the send timed out. |
| 640 | + You can only send 252 bytes at a time |
| 641 | + (limited by chip's FIFO size and appended headers). |
| 642 | + This appends a 4 byte header to be compatible with the RadioHead library. |
| 643 | + The header defaults to using the initialized attributes: |
| 644 | + (destination,node,identifier,flags) |
| 645 | + It may be temporarily overidden via the kwargs - destination,node,identifier,flags. |
| 646 | + Values passed via kwargs do not alter the attribute settings. |
| 647 | + The keep_listening argument should be set to True if you want to start listening |
| 648 | + automatically after the packet is sent. The default setting is False. |
| 649 | +
|
| 650 | + Returns: True if success or False if the send timed out. |
668 | 651 | """
|
669 | 652 | # Disable pylint warning to not use length as a check for zero.
|
670 | 653 | # This is a puzzling warning as the below code is clearly the most
|
@@ -720,9 +703,9 @@ def send(
|
720 | 703 |
|
721 | 704 | def send_with_ack(self, data):
|
722 | 705 | """Reliable Datagram mode:
|
723 |
| - Send a packet with data and wait for an ACK response. |
724 |
| - The packet header is automatically generated. |
725 |
| - If enabled, the packet transmission will be retried on failure |
| 706 | + Send a packet with data and wait for an ACK response. |
| 707 | + The packet header is automatically generated. |
| 708 | + If enabled, the packet transmission will be retried on failure |
726 | 709 | """
|
727 | 710 | if self.ack_retries:
|
728 | 711 | retries_remaining = self.ack_retries
|
@@ -760,18 +743,18 @@ def receive(
|
760 | 743 | self, *, keep_listening=True, with_header=False, with_ack=False, timeout=None
|
761 | 744 | ):
|
762 | 745 | """Wait to receive a packet from the receiver. If a packet is found the payload bytes
|
763 |
| - are returned, otherwise None is returned (which indicates the timeout elapsed with no |
764 |
| - reception). |
765 |
| - If keep_listening is True (the default) the chip will immediately enter listening mode |
766 |
| - after reception of a packet, otherwise it will fall back to idle mode and ignore any |
767 |
| - future reception. |
768 |
| - All packets must have a 4-byte header for compatibilty with the |
769 |
| - RadioHead library. |
770 |
| - The header consists of 4 bytes (To,From,ID,Flags). The default setting will strip |
771 |
| - the header before returning the packet to the caller. |
772 |
| - If with_header is True then the 4 byte header will be returned with the packet. |
773 |
| - The payload then begins at packet[4]. |
774 |
| - If with_ack is True, send an ACK after receipt (Reliable Datagram mode) |
| 746 | + are returned, otherwise None is returned (which indicates the timeout elapsed with no |
| 747 | + reception). |
| 748 | + If keep_listening is True (the default) the chip will immediately enter listening mode |
| 749 | + after reception of a packet, otherwise it will fall back to idle mode and ignore any |
| 750 | + future reception. |
| 751 | + All packets must have a 4-byte header for compatibilty with the |
| 752 | + RadioHead library. |
| 753 | + The header consists of 4 bytes (To,From,ID,Flags). The default setting will strip |
| 754 | + the header before returning the packet to the caller. |
| 755 | + If with_header is True then the 4 byte header will be returned with the packet. |
| 756 | + The payload then begins at packet[4]. |
| 757 | + If with_ack is True, send an ACK after receipt (Reliable Datagram mode) |
775 | 758 | """
|
776 | 759 | timed_out = False
|
777 | 760 | if timeout is None:
|
|
0 commit comments