How to use uart_intr_config_t?
Posted: Sun Mar 10, 2024 10:45 am
Hi,
I'm trying to figure out how to properly fill out the uart_intr_config_t structure, in particular the first field, which is the interrupt mask.
typedef struct {
uint32_t intr_enable_mask; /*!< UART interrupt enable mask, choose from UART_XXXX_INT_ENA_M under UART_INT_ENA_REG(i), connect with bit-or operator*/
uint8_t rx_timeout_thresh; /*!< UART timeout interrupt threshold (unit: time of sending one byte)*/
uint8_t txfifo_empty_intr_thresh; /*!< UART TX empty interrupt threshold.*/
uint8_t rxfifo_full_thresh; /*!< UART RX full interrupt threshold.*/
} uart_intr_config_t;
Why am I doing this? Because I want to have an interrupt fire when a packet of 25 bytes has arrived at the UART. Another thing I'm considering is having an interrupt fire after inactivity on the rx line of the UART of at least 4 ms, but I prefer the first option because it introduces less latency.
Could someone show me how it migtht be done?
Many thanks.
I'm trying to figure out how to properly fill out the uart_intr_config_t structure, in particular the first field, which is the interrupt mask.
typedef struct {
uint32_t intr_enable_mask; /*!< UART interrupt enable mask, choose from UART_XXXX_INT_ENA_M under UART_INT_ENA_REG(i), connect with bit-or operator*/
uint8_t rx_timeout_thresh; /*!< UART timeout interrupt threshold (unit: time of sending one byte)*/
uint8_t txfifo_empty_intr_thresh; /*!< UART TX empty interrupt threshold.*/
uint8_t rxfifo_full_thresh; /*!< UART RX full interrupt threshold.*/
} uart_intr_config_t;
Why am I doing this? Because I want to have an interrupt fire when a packet of 25 bytes has arrived at the UART. Another thing I'm considering is having an interrupt fire after inactivity on the rx line of the UART of at least 4 ms, but I prefer the first option because it introduces less latency.
Could someone show me how it migtht be done?
Many thanks.