| 9 | |
| 10 | class SX1276Example: |
| 11 | def __init__(self): |
| 12 | LYLIGO_216_pinconfig = { |
| 13 | 'miso': 19, |
| 14 | 'mosi': 27, |
| 15 | 'clock': 5, |
| 16 | 'chipselect': 18, |
| 17 | 'reset': 23, |
| 18 | 'dio0': 26 |
| 19 | } |
| 20 | |
| 21 | # Init display |
| 22 | i2c = SoftI2C(sda=Pin(21), scl=Pin(22)) |
| 23 | self.display = ssd1306.SSD1306_I2C(128, 64, i2c) |
| 24 | self.display.poweron() |
| 25 | self.display.text('Receiving...', 0, 0, 1) |
| 26 | self.display.show() |
| 27 | |
| 28 | # Init LoRa chip |
| 29 | self.lora = sx1276.SX1276(LYLIGO_216_pinconfig,self.receive_callback) |
| 30 | self.lora.begin() |
| 31 | self.lora.configure(869500000,500000,8,12) |
| 32 | |
| 33 | # Start receiving. This will just install the IRQ |
| 34 | # handler, without blocking the program. |
| 35 | self.lora.receive() |
| 36 | |
| 37 | def receive_callback(self,lora_instance,packet,RSSI): |
| 38 | self.display.fill(0) |