Skip to content

Commit 6c1dd10

Browse files
authored
Merge pull request #774 from brentru/update-tinylora-examples
Updates for breaking TinyLoRa changes
2 parents 2d06aea + 29b6a51 commit 6c1dd10

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

TheThingsNetwork_Feather/code.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""TinyLoRa with a Si7021 Sensor.
1+
"""Using TinyLoRa with a Si7021 Sensor.
22
"""
33
import time
44
import busio
@@ -16,15 +16,17 @@
1616
sensor = adafruit_si7021.SI7021(i2c)
1717

1818
# Create library object using our bus SPI port for radio
19-
spi = busio.SPI(board.SCK, MISO=board.MISO, MOSI=board.MOSI)
19+
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
2020

2121
# RFM9x Breakout Pinouts
2222
cs = digitalio.DigitalInOut(board.D5)
2323
irq = digitalio.DigitalInOut(board.D6)
24+
rst = digitalio.DigitalInOut(board.D4)
2425

2526
# Feather M0 RFM9x Pinouts
26-
# irq = digitalio.DigitalInOut(board.RFM9X_D0)
2727
# cs = digitalio.DigitalInOut(board.RFM9X_CS)
28+
# irq = digitalio.DigitalInOut(board.RFM9X_D0)
29+
# rst = digitalio.DigitalInOut(board.RFM9X_RST)
2830

2931
# TTN Device Address, 4 Bytes, MSB
3032
devaddr = bytearray([0x00, 0x00, 0x00, 0x00])
@@ -39,7 +41,7 @@
3941

4042
ttn_config = TTN(devaddr, nwkey, app, country='US')
4143

42-
lora = TinyLoRa(spi, cs, irq, ttn_config)
44+
lora = TinyLoRa(spi, cs, irq, rst, ttn_config)
4345

4446
# Data Packet to send to TTN
4547
data = bytearray(4)

lorawan_sensing_network/ttn_feather_node.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# pylint: disable=c-extension-no-member
1717
cs = DigitalInOut(board.RFM9X_CS)
1818
irq = DigitalInOut(board.RFM9X_D0)
19+
rst = DigitalInOut(board.RFM9X_RST)
1920

2021
# TTN Device Address, 4 Bytes, MSB
2122
devaddr = bytearray([0x00, 0x00, 0x00, 0x00])
@@ -30,7 +31,7 @@
3031

3132
ttn_config = TTN(devaddr, nwkey, app, country='US')
3233

33-
lora = TinyLoRa(spi, cs, irq, ttn_config, channel = 6)
34+
lora = TinyLoRa(spi, cs, irq, rst, ttn_config, channel = 6)
3435

3536
# bme data packet
3637
bme_d = bytearray(7)

pi_radio/radio_lorawan.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
4646
cs = DigitalInOut(board.CE1)
4747
irq = DigitalInOut(board.D22)
48+
rst = DigitalInOut(board.D25)
49+
4850
# TTN Device Address, 4 Bytes, MSB
4951
devaddr = bytearray([0x00, 0x00, 0x00, 0x00])
5052
# TTN Network Key, 16 Bytes, MSB
@@ -56,7 +58,7 @@
5658
# Initialize ThingsNetwork configuration
5759
ttn_config = TTN(devaddr, nwkey, app, country='US')
5860
# Initialize lora object
59-
lora = TinyLoRa(spi, cs, irq, ttn_config)
61+
lora = TinyLoRa(spi, cs, irq, rst, ttn_config)
6062
# 2b array to store sensor data
6163
data_pkt = bytearray(2)
6264
# time to delay periodic packet sends (in seconds)

0 commit comments

Comments
 (0)