Closed brentru closed 4 years ago
RegVersion
deinit()
Tested on a Feather M4 with Radio FeatherWing. Test Harness for setting up (and tearing down) the SPI interface and lora object:
lora
import time import busio import digitalio import board from adafruit_tinylora.adafruit_tinylora import TTN, TinyLoRa # RFM9x Breakout Pinouts cs = digitalio.DigitalInOut(board.D6) irq = digitalio.DigitalInOut(board.D5) rst = digitalio.DigitalInOut(board.D4) # TTN Device Address, 4 Bytes, MSB devaddr = bytearray([snip]) # TTN Network Key, 16 Bytes, MSB nwkey = bytearray([snip]) # TTN Application Key, 16 Bytess, MSB app = bytearray([snip]) ttn_config = TTN(devaddr, nwkey, app, country='US') for i in range(0, 1001): print('init RFM9x and TinyLora...', i) spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO) lora = TinyLoRa(spi, cs, irq, rst, ttn_config) print('Sending Packet...') data = bytearray(b"\x43\x57\x54\x46") lora.send_data(data, len(data), lora.frame_counter) print('Packet Sent!') print('tearing down TinyLoRa..') lora.deinit() print('tearing down SPI..') spi.deinit()
Test Output (snipped):
init RFM9x and TinyLora... 329 Sending Packet... Packet Sent! tearing down TinyLoRa.. tearing down SPI.. init RFM9x and TinyLora... 330 Sending Packet...
RegVersion
. Prevents chip from starting/reading from a bad state.deinit()
method along with enter and exit methods for use with a context managerTested on a Feather M4 with Radio FeatherWing. Test Harness for setting up (and tearing down) the SPI interface and
lora
object:Test Output (snipped):