sx126x/sx27x: Reduce spi buffer size, add missing select when using channels

This commit is contained in:
Olivier Fauchon
2023-02-23 21:33:37 +01:00
committed by Ron Evans
parent 56208a28d5
commit 94017b5437
2 changed files with 27 additions and 20 deletions
+16 -8
View File
@@ -702,25 +702,33 @@ func (d *Device) HandleInterrupt() {
d.ClearIrqStatus(SX126X_IRQ_ALL)
if (st & SX126X_IRQ_RX_DONE) > 0 {
e := lora.RadioEvent{lora.RadioEventRxDone, uint16(st), nil}
d.radioEventChan <- e
select {
case d.radioEventChan <- lora.RadioEvent{lora.RadioEventRxDone, uint16(st), nil}:
default:
}
}
if (st & SX126X_IRQ_TX_DONE) > 0 {
e := lora.RadioEvent{lora.RadioEventTxDone, uint16(st), nil}
d.radioEventChan <- e
select {
case d.radioEventChan <- lora.RadioEvent{lora.RadioEventTxDone, uint16(st), nil}:
default:
}
}
if (st & SX126X_IRQ_TIMEOUT) > 0 {
e := lora.RadioEvent{lora.RadioEventTimeout, uint16(st), nil}
d.radioEventChan <- e
select {
case d.radioEventChan <- lora.RadioEvent{lora.RadioEventTimeout, uint16(st), nil}:
default:
}
}
if (st & SX126X_IRQ_CRC_ERR) > 0 {
e := lora.RadioEvent{lora.RadioEventCrcError, uint16(st), nil}
d.radioEventChan <- e
select {
case d.radioEventChan <- lora.RadioEvent{lora.RadioEventCrcError, uint16(st), nil}:
default:
}
}
}