Hi,
I'm trying to figure out how to properly fill out the ESP32 uart_intr_config_t
structure (as mentioned here: https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/peripherals/uart.html#), 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 every time a packet of 25 bytes arrives at the UART (rxfifo_full_thresh = 25
). Alternatively I'm considering having an interrupt fire after inactivity on the UART rx line of at least 4 ms (@ 100000 baud 8E2, rx_timeout_thresh = 33
), because this is the minimum delay between subsequent 25 byte packets.
I prefer the first option because it introduces less latency (in theory?).
I understand how masks work - that isn't the problem. However, I can't find any info on what/which bits I'm supposed to OR together in the first place...
Could someone show me how it's done? A little example code would be great.