Skip to content

Commit 4a34662

Browse files
committed
Ran pre-commit, added licenses
1 parent 9cb5f49 commit 4a34662

27 files changed

+498
-77
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
15
*.mpy
26
.idea
37
__pycache__
@@ -8,4 +12,4 @@ bundles
812
*.DS_Store
913
.eggs
1014
dist
11-
**/*.egg-info
15+
**/*.egg-info

.pylintrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
15
[MASTER]
26

37
# A comma-separated list of package or module names from where C extensions may

.readthedocs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
15
python:
26
version: 3
37
requirements_file: requirements.txt

CODE_OF_CONDUCT.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
<!--
2+
SPDX-FileCopyrightText: 2014 Coraline Ada Ehmke
3+
SPDX-FileCopyrightText: 2019 Kattni Rembor for Adafruit Industries
4+
SPDX-License-Identifier: CC-BY-4.0
5+
-->
6+
17
# Adafruit Community Code of Conduct
28

39
## Our Pledge
@@ -43,7 +49,7 @@ Examples of unacceptable behavior by participants include:
4349

4450
The goal of the standards and moderation guidelines outlined here is to build
4551
and maintain a respectful community. We ask that you don’t just aim to be
46-
"technically unimpeachable", but rather try to be your best self.
52+
"technically unimpeachable", but rather try to be your best self.
4753

4854
We value many things beyond technical expertise, including collaboration and
4955
supporting others within our community. Providing a positive experience for
@@ -74,9 +80,9 @@ You may report in the following ways:
7480
In any situation, you may send an email to <[email protected]>.
7581

7682
On the Adafruit Discord, you may send an open message from any channel
77-
to all Community Moderators by tagging @community moderators. You may
78-
also send an open message from any channel, or a direct message to
79-
@kattni#1507, @tannewt#4653, @Dan Halbert#1614, @cater#2442,
83+
to all Community Moderators by tagging @community moderators. You may
84+
also send an open message from any channel, or a direct message to
85+
@kattni#1507, @tannewt#4653, @Dan Halbert#1614, @cater#2442,
8086
@sommersoft#0222, @Mr. Certainly#0472 or @Andon#8175.
8187

8288
Email and direct message reports will be kept confidential.

LICENSES/CC-BY-4.0.txt

Lines changed: 324 additions & 0 deletions
Large diffs are not rendered by default.

LICENSES/MIT.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
MIT License Copyright (c) <year> <copyright holders>
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is furnished
8+
to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice (including the next
11+
paragraph) shall be included in all copies or substantial portions of the
12+
Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
17+
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
19+
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

LICENSES/Unlicense.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
This is free and unencumbered software released into the public domain.
2+
3+
Anyone is free to copy, modify, publish, use, compile, sell, or distribute
4+
this software, either in source code form or as a compiled binary, for any
5+
purpose, commercial or non-commercial, and by any means.
6+
7+
In jurisdictions that recognize copyright laws, the author or authors of this
8+
software dedicate any and all copyright interest in the software to the public
9+
domain. We make this dedication for the benefit of the public at large and
10+
to the detriment of our heirs and successors. We intend this dedication to
11+
be an overt act of relinquishment in perpetuity of all present and future
12+
rights to this software under copyright law.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
17+
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
18+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
19+
THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information,
20+
please refer to <https://unlicense.org/>

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ To install in a virtual environment in your current project:
6464
Usage Example
6565
=============
6666
See examples/rfm69_simpletest.py for a simple demo of the usage.
67-
Note: the default baudrate for the SPI is 2000000 (2MHz).
68-
The maximum setting is 10Mhz but
67+
Note: the default baudrate for the SPI is 2000000 (2MHz).
68+
The maximum setting is 10Mhz but
6969
transmission errors have been observed expecially when using breakout boards.
7070
For breakout boards or other configurations where the boards are separated,
7171
it may be necessary to reduce the baudrate for reliable data transmission.

README.rst.license

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
2+
3+
SPDX-License-Identifier: MIT

adafruit_rfm69.py

Lines changed: 53 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,7 @@
1-
# The MIT License (MIT)
1+
# SPDX-FileCopyrightText: 2017 Tony DiCola for Adafruit Industries
22
#
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+
225
"""
236
`adafruit_rfm69`
247
====================================================
@@ -431,7 +414,7 @@ def sleep(self):
431414

432415
def listen(self):
433416
"""Listen for packets to be received by the chip. Use :py:func:`receive` to listen, wait
434-
and retrieve packets as they're available.
417+
and retrieve packets as they're available.
435418
"""
436419
# Like RadioHead library, turn off high power boost if enabled.
437420
if self._tx_power >= 18:
@@ -444,8 +427,8 @@ def listen(self):
444427

445428
def transmit(self):
446429
"""Transmit a packet which is queued in the FIFO. This is a low level function for
447-
entering transmit mode and more. For generating and transmitting a packet of data use
448-
:py:func:`send` instead.
430+
entering transmit mode and more. For generating and transmitting a packet of data use
431+
:py:func:`send` instead.
449432
"""
450433
# Like RadioHead library, turn on high power boost if enabled.
451434
if self._tx_power >= 18:
@@ -459,9 +442,9 @@ def transmit(self):
459442
@property
460443
def temperature(self):
461444
"""The internal temperature of the chip in degrees Celsius. Be warned this is not
462-
calibrated or very accurate.
445+
calibrated or very accurate.
463446
464-
.. warning:: Reading this will STOP any receiving/sending that might be happening!
447+
.. warning:: Reading this will STOP any receiving/sending that might be happening!
465448
"""
466449
# Start a measurement then poll the measurement finished bit.
467450
self.temp_start = 1
@@ -475,9 +458,9 @@ def temperature(self):
475458
@property
476459
def operation_mode(self):
477460
"""The operation mode value. Unless you're manually controlling the chip you shouldn't
478-
change the operation_mode with this property as other side-effects are required for
479-
changing logical modes--use :py:func:`idle`, :py:func:`sleep`, :py:func:`transmit`,
480-
:py:func:`listen` instead to signal intent for explicit logical modes.
461+
change the operation_mode with this property as other side-effects are required for
462+
changing logical modes--use :py:func:`idle`, :py:func:`sleep`, :py:func:`transmit`,
463+
:py:func:`listen` instead to signal intent for explicit logical modes.
481464
"""
482465
op_mode = self._read_u8(_REG_OP_MODE)
483466
return (op_mode >> 2) & 0b111
@@ -497,10 +480,10 @@ def operation_mode(self, val):
497480
@property
498481
def sync_word(self):
499482
"""The synchronization word value. This is a byte string up to 8 bytes long (64 bits)
500-
which indicates the synchronization word for transmitted and received packets. Any
501-
received packet which does not include this sync word will be ignored. The default value
502-
is 0x2D, 0xD4 which matches the RadioHead RFM69 library. Setting a value of None will
503-
disable synchronization word matching entirely.
483+
which indicates the synchronization word for transmitted and received packets. Any
484+
received packet which does not include this sync word will be ignored. The default value
485+
is 0x2D, 0xD4 which matches the RadioHead RFM69 library. Setting a value of None will
486+
disable synchronization word matching entirely.
504487
"""
505488
# Handle when sync word is disabled..
506489
if not self.sync_on:
@@ -529,8 +512,8 @@ def sync_word(self, val):
529512
@property
530513
def preamble_length(self):
531514
"""The length of the preamble for sent and received packets, an unsigned 16-bit value.
532-
Received packets must match this length or they are ignored! Set to 4 to match the
533-
RadioHead RFM69 library.
515+
Received packets must match this length or they are ignored! Set to 4 to match the
516+
RadioHead RFM69 library.
534517
"""
535518
msb = self._read_u8(_REG_PREAMBLE_MSB)
536519
lsb = self._read_u8(_REG_PREAMBLE_LSB)
@@ -545,7 +528,7 @@ def preamble_length(self, val):
545528
@property
546529
def frequency_mhz(self):
547530
"""The frequency of the radio in Megahertz. Only the allowed values for your radio must be
548-
specified (i.e. 433 vs. 915 mhz)!
531+
specified (i.e. 433 vs. 915 mhz)!
549532
"""
550533
# FRF register is computed from the frequency following the datasheet.
551534
# See section 6.2 and FRF register description.
@@ -573,9 +556,9 @@ def frequency_mhz(self, val):
573556
@property
574557
def encryption_key(self):
575558
"""The AES encryption key used to encrypt and decrypt packets by the chip. This can be set
576-
to None to disable encryption (the default), otherwise it must be a 16 byte long byte
577-
string which defines the key (both the transmitter and receiver must use the same key
578-
value).
559+
to None to disable encryption (the default), otherwise it must be a 16 byte long byte
560+
string which defines the key (both the transmitter and receiver must use the same key
561+
value).
579562
"""
580563
# Handle if encryption is disabled.
581564
if self.aes_on == 0:
@@ -599,8 +582,8 @@ def encryption_key(self, val):
599582
@property
600583
def tx_power(self):
601584
"""The transmit power in dBm. Can be set to a value from -2 to 20 for high power devices
602-
(RFM69HCW, high_power=True) or -18 to 13 for low power devices. Only integer power
603-
levels are actually set (i.e. 12.5 will result in a value of 12 dBm).
585+
(RFM69HCW, high_power=True) or -18 to 13 for low power devices. Only integer power
586+
levels are actually set (i.e. 12.5 will result in a value of 12 dBm).
604587
"""
605588
# Follow table 10 truth table from the datasheet for determining power
606589
# level from the individual PA level bits and output power register.
@@ -661,17 +644,17 @@ def tx_power(self, val):
661644
@property
662645
def rssi(self):
663646
"""The received strength indicator (in dBm).
664-
May be inaccuate if not read immediatey. last_rssi contains the value read immediately
665-
receipt of the last packet.
647+
May be inaccuate if not read immediatey. last_rssi contains the value read immediately
648+
receipt of the last packet.
666649
"""
667650
# Read RSSI register and convert to value using formula in datasheet.
668651
return -self._read_u8(_REG_RSSI_VALUE) / 2.0
669652

670653
@property
671654
def bitrate(self):
672655
"""The modulation bitrate in bits/second (or chip rate if Manchester encoding is enabled).
673-
Can be a value from ~489 to 32mbit/s, but see the datasheet for the exact supported
674-
values.
656+
Can be a value from ~489 to 32mbit/s, but see the datasheet for the exact supported
657+
values.
675658
"""
676659
msb = self._read_u8(_REG_BITRATE_MSB)
677660
lsb = self._read_u8(_REG_BITRATE_LSB)
@@ -719,17 +702,17 @@ def send(
719702
flags=None
720703
):
721704
"""Send a string of data using the transmitter.
722-
You can only send 60 bytes at a time
723-
(limited by chip's FIFO size and appended headers).
724-
This appends a 4 byte header to be compatible with the RadioHead library.
725-
The header defaults to using the initialized attributes:
726-
(destination,node,identifier,flags)
727-
It may be temporarily overidden via the kwargs - destination,node,identifier,flags.
728-
Values passed via kwargs do not alter the attribute settings.
729-
The keep_listening argument should be set to True if you want to start listening
730-
automatically after the packet is sent. The default setting is False.
731-
732-
Returns: True if success or False if the send timed out.
705+
You can only send 60 bytes at a time
706+
(limited by chip's FIFO size and appended headers).
707+
This appends a 4 byte header to be compatible with the RadioHead library.
708+
The header defaults to using the initialized attributes:
709+
(destination,node,identifier,flags)
710+
It may be temporarily overidden via the kwargs - destination,node,identifier,flags.
711+
Values passed via kwargs do not alter the attribute settings.
712+
The keep_listening argument should be set to True if you want to start listening
713+
automatically after the packet is sent. The default setting is False.
714+
715+
Returns: True if success or False if the send timed out.
733716
"""
734717
# Disable pylint warning to not use length as a check for zero.
735718
# This is a puzzling warning as the below code is clearly the most
@@ -780,9 +763,9 @@ def send(
780763

781764
def send_with_ack(self, data):
782765
"""Reliable Datagram mode:
783-
Send a packet with data and wait for an ACK response.
784-
The packet header is automatically generated.
785-
If enabled, the packet transmission will be retried on failure
766+
Send a packet with data and wait for an ACK response.
767+
The packet header is automatically generated.
768+
If enabled, the packet transmission will be retried on failure
786769
"""
787770
if self.ack_retries:
788771
retries_remaining = self.ack_retries
@@ -820,18 +803,18 @@ def receive(
820803
self, *, keep_listening=True, with_ack=False, timeout=None, with_header=False
821804
):
822805
"""Wait to receive a packet from the receiver. If a packet is found the payload bytes
823-
are returned, otherwise None is returned (which indicates the timeout elapsed with no
824-
reception).
825-
If keep_listening is True (the default) the chip will immediately enter listening mode
826-
after reception of a packet, otherwise it will fall back to idle mode and ignore any
827-
future reception.
828-
All packets must have a 4 byte header for compatibilty with the
829-
RadioHead library.
830-
The header consists of 4 bytes (To,From,ID,Flags). The default setting will strip
831-
the header before returning the packet to the caller.
832-
If with_header is True then the 4 byte header will be returned with the packet.
833-
The payload then begins at packet[4].
834-
If with_ack is True, send an ACK after receipt (Reliable Datagram mode)
806+
are returned, otherwise None is returned (which indicates the timeout elapsed with no
807+
reception).
808+
If keep_listening is True (the default) the chip will immediately enter listening mode
809+
after reception of a packet, otherwise it will fall back to idle mode and ignore any
810+
future reception.
811+
All packets must have a 4 byte header for compatibilty with the
812+
RadioHead library.
813+
The header consists of 4 bytes (To,From,ID,Flags). The default setting will strip
814+
the header before returning the packet to the caller.
815+
If with_header is True then the 4 byte header will be returned with the packet.
816+
The payload then begins at packet[4].
817+
If with_ack is True, send an ACK after receipt (Reliable Datagram mode)
835818
"""
836819
timed_out = False
837820
if timeout is None:

docs/_static/favicon.ico.license

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries
2+
3+
SPDX-License-Identifier: CC-BY-4.0

docs/api.rst.license

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SPDX-FileCopyrightText: 2020 ladyada for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: MIT

docs/conf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# -*- coding: utf-8 -*-
22

3+
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
4+
#
5+
# SPDX-License-Identifier: MIT
6+
37
import os
48
import sys
59

docs/examples.rst.license

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SPDX-FileCopyrightText: 2020 ladyada for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: MIT

docs/index.rst.license

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SPDX-FileCopyrightText: 2020 ladyada for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: MIT

examples/rfm69_header.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2+
# SPDX-License-Identifier: MIT
3+
14
# Example to display raw packets including header
25
# Author: Jerry Needell
36
#

examples/rfm69_node1.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2+
# SPDX-License-Identifier: MIT
3+
14
# Example to send a packet periodically between addressed nodes
25
# Author: Jerry Needell
36
#

examples/rfm69_node1_ack.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2+
# SPDX-License-Identifier: MIT
3+
14
# Example to send a packet periodically between addressed nodes with ACK
25
# Author: Jerry Needell
36
#

examples/rfm69_node1_bonnet.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2+
# SPDX-License-Identifier: MIT
3+
14
# Example to send a packet periodically between addressed nodes
25
# Author: Jerry Needell
36
#

0 commit comments

Comments
 (0)