Skip to content

Commit cade8a4

Browse files
committed
lora-sx126x: Enable all IRQ Mask bits unconditionally.
Expands _IRQ_CRC_ERR fix in the parent commit by always enabling all the Irq Mask bits that the driver may want to read back later, i.e. also including the header error bit. Signed-off-by: Angus Gratton <angus@redyak.com.au>
1 parent 9f7f99b commit cade8a4

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

micropython/lora/lora-sx126x/lora/sx126x.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -227,15 +227,21 @@ def __init__(
227227
# can trigger the ISR and may not be reset by the driver, leaving DIO1
228228
# high.
229229
if dio1:
230-
self._cmd(
231-
">BHHHH",
232-
_CMD_CFG_DIO_IRQ,
233-
(_IRQ_RX_DONE | _IRQ_TX_DONE | _IRQ_TIMEOUT | _IRQ_CRC_ERR), # IRQ mask
234-
(_IRQ_RX_DONE | _IRQ_TX_DONE | _IRQ_TIMEOUT), # DIO1 mask
235-
0x0, # DIO2Mask, not used
236-
0x0, # DIO3Mask, not used
237-
)
238-
dio1.irq(self._radio_isr, Pin.IRQ_RISING)
230+
dio1_mask = _IRQ_RX_DONE | _IRQ_TX_DONE | _IRQ_TIMEOUT
231+
else:
232+
dio1_mask = 0
233+
234+
self._cmd(
235+
">BHHHH",
236+
_CMD_CFG_DIO_IRQ,
237+
# The Irq Mask byte needs to be set so that _CMD_GET_IRQ_STATUS returns all
238+
# relevant flags that driver might check
239+
_IRQ_TX_DONE | _IRQ_DRIVER_RX_MASK,
240+
dio1_mask, # DIO1Mask
241+
0x0, # DIO2Mask, not used
242+
0x0, # DIO3Mask, not used
243+
)
244+
dio1.irq(self._radio_isr, Pin.IRQ_RISING)
239245

240246
self._clear_irq()
241247

0 commit comments

Comments
 (0)