rp2/machine_uart: Implement a Python UART IRQ handler.

Supported trigger names: IRQ_RXIDLE, IRQ_TXIDLE, IRQ_BREAK

- IRQ_RXIDLE: The handler for IRQ_RXIDLE is called reliably 31 UART bit
  times after the last incoming data.

- IRQ_TXIDLE: This IRQ is triggered after at least >5 characters are sent
  at once.  It is triggered when the TX FIFO falls below 4 elements.  At
  that time, up to 5 bytes may still be in the FIFO and output shift
  register.

- IRQ_BREAK: The IRQ triggers if a BREAK state is detected at RX.
  Properties & side effects:
  - After a BREAK, a valid character must be received before another break
    can be detected.
  - Each break puts a 0xff character into the input buffer.

The irq.flags() value is cleared only with a new wanted event.  Do not
change the flags otherwise.

Signed-off-by: robert-hh <robert@hammelrath.com>
This commit is contained in:
robert-hh
2024-02-20 18:52:57 +01:00
committed by Damien George
parent fd03a0587f
commit 01c046d2a8
4 changed files with 124 additions and 15 deletions

View File

@@ -8,6 +8,7 @@ void machine_pin_deinit(void);
void machine_i2s_init0(void);
void machine_i2s_deinit_all(void);
void machine_pwm_deinit_all(void);
void machine_uart_deinit_all(void);
struct _machine_spi_obj_t *spi_from_mp_obj(mp_obj_t o);