Skip to content

Commit d64bfe8

Browse files
committed
address review comments
1 parent 201752e commit d64bfe8

File tree

5 files changed

+12
-32
lines changed

5 files changed

+12
-32
lines changed

adafruit_tinylora/adafruit_tinylora.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,3 @@ def _write_u8(self, address: registeraddress, val: int) -> None:
417417
self._BUFFER[1] = val
418418
# pylint: disable=no-member
419419
device.write(self._BUFFER, end=2)
420-
# pylint: disable=no-member
421-
device.write(self._BUFFER, end=2)
422-
device.write(self._BUFFER, end=2)

adafruit_tinylora/adafruit_tinylora_encryption.py

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,8 @@ def xtime(col: int) -> int:
3030

3131

3232
# AES S-box
33-
# NOTE(typing): Each of these is 16b, can use bytearray16 here
34-
S_BOX: Tuple[
35-
bytes,
36-
bytes,
37-
bytes,
38-
bytes,
39-
bytes,
40-
bytes,
41-
bytes,
42-
bytes,
43-
bytes,
44-
bytes,
45-
bytes,
46-
bytes,
47-
bytes,
48-
bytes,
49-
bytes,
50-
bytes,
51-
] = (
33+
# NOTE(typing): Each of these 16 items is 16b, can use bytearray16 here
34+
S_BOX: Tuple[bytes, ...] = (
5235
b"c|w{\xf2ko\xc50\x01g+\xfe\xd7\xabv",
5336
b"\xca\x82\xc9}\xfaYG\xf0\xad\xd4\xa2\xaf\x9c\xa4r\xc0",
5437
b"\xb7\xfd\x93&6?\xf7\xcc4\xa5\xe5\xf1q\xd81\x15",

examples/tinylora_simpletest.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@
3434
# rst = digitalio.DigitalInOut(board.RFM9X_RST)
3535

3636
# TTN Device Address, 4 Bytes, MSB
37-
devaddr = bytearray4([0x00, 0x00, 0x00, 0x00])
37+
devaddr: bytearray4 = bytearray([0x00, 0x00, 0x00, 0x00])
3838

3939
# TTN Network Key, 16 Bytes, MSB
40-
nwkey = bytearray16(
40+
nwkey: bytearray16 = bytearray(
4141
[
4242
0x00,
4343
0x00,
@@ -59,7 +59,7 @@
5959
)
6060

6161
# TTN Application Key, 16 Bytess, MSB
62-
app = bytearray16(
62+
app: bytearray16 = bytearray(
6363
[
6464
0x00,
6565
0x00,
@@ -85,7 +85,7 @@
8585
lora = TinyLoRa(spi, cs, irq, rst, ttn_config)
8686

8787
while True:
88-
data = bytearray4(b"\x43\x57\x54\x46")
88+
data: bytearray4 = bytearray(b"\x43\x57\x54\x46")
8989
print("Sending packet...")
9090
lora.send_data(data, len(data), lora.frame_counter)
9191
print("Packet sent!")

examples/tinylora_simpletest_si7021.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@
4242
# rst = digitalio.DigitalInOut(board.RFM9X_RST)
4343

4444
# TTN Device Address, 4 Bytes, MSB
45-
devaddr = bytearray4([0x00, 0x00, 0x00, 0x00])
45+
devaddr: bytearray4 = bytearray([0x00, 0x00, 0x00, 0x00])
4646

4747
# TTN Network Key, 16 Bytes, MSB
48-
nwkey = bytearray16(
48+
nwkey: bytearray16 = bytearray(
4949
[
5050
0x00,
5151
0x00,
@@ -67,7 +67,7 @@
6767
)
6868

6969
# TTN Application Key, 16 Bytess, MSB
70-
app = bytearray16(
70+
app: bytearray16 = bytearray(
7171
[
7272
0x00,
7373
0x00,

examples/tinylora_simpletest_single_channel.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@
3131
# rst = digitalio.DigitalInOut(board.RFM9X_RST)
3232

3333
# TTN Device Address, 4 Bytes, MSB
34-
devaddr = bytearray4([0x00, 0x00, 0x00, 0x00])
34+
devaddr: bytearray4 = bytearray([0x00, 0x00, 0x00, 0x00])
3535

3636
# TTN Network Key, 16 Bytes, MSB
37-
nwkey = bytearray16(
37+
nwkey: bytearray16 = bytearray(
3838
[
3939
0x00,
4040
0x00,
@@ -56,7 +56,7 @@
5656
)
5757

5858
# TTN Application Key, 16 Bytess, MSB
59-
app = bytearray16(
59+
app: bytearray16 = bytearray(
6060
[
6161
0x00,
6262
0x00,

0 commit comments

Comments
 (0)