samd/machine_uart: Only fire the TXIDLE event once.

The UART DRE flag is always set if the DATA register is empty.  That would
lead to a TXIDLE event each time the IRQ handler was run.  To fix that,
only fire the TXIDLE event if the DRE interrupt flag is enabled.

Partially fixes the `tests/extmod/machine_uart_irq_txidle.py` test on
`ADAFRUIT_ITSYBITSY_M0_EXPRESS`.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2026-05-13 12:16:13 +10:00
parent 0e8bb82f03
commit 2c44f044de
+1 -1
View File
@@ -167,7 +167,7 @@ void common_uart_irq_handler(int uart_id) {
uart->USART.DATA.bit.DATA =
ringbuf_get(&self->write_buffer) | (ringbuf_get(&self->write_buffer) << 8);
}
} else {
} else if (uart->USART.INTENCLR.bit.DRE != 0) {
#if MICROPY_PY_MACHINE_UART_IRQ
// Set the TXIDLE flag
mp_irq_flags |= SERCOM_USART_INTFLAG_TXC;