pub type uart_event_type = u32;Expand description
@brief Types of events passed to callback in UART_ASYNC_API
Receiving:
-
To start receiving, uart_rx_enable has to be called with first buffer
-
When receiving starts to current buffer, #UART_RX_BUF_REQUEST will be generated, in response to that user can either:
- Provide second buffer using uart_rx_buf_rsp, when first buffer is filled, receiving will automatically start to second buffer.
- Ignore the event, this way when current buffer is filled #UART_RX_RDY event will be generated and receiving will be stopped.
-
If some data was received and timeout occurred #UART_RX_RDY event will be generated. It can happen multiples times for the same buffer. RX timeout is counted from last byte received i.e. if no data was received, there won’t be any timeout event.
-
#UART_RX_BUF_RELEASED event will be generated when the current buffer is no longer used by the driver. It will immediately follow #UART_RX_RDY event. Depending on the implementation buffer may be released when it is completely or partially filled.
-
If there was second buffer provided, it will become current buffer and we start again at point 2. If no second buffer was specified receiving is stopped and #UART_RX_DISABLED event is generated. After that whole process can be repeated.
Any time during reception #UART_RX_STOPPED event can occur. if there is any data received, #UART_RX_RDY event will be generated. It will be followed by #UART_RX_BUF_RELEASED event for every buffer currently passed to driver and finally by #UART_RX_DISABLED event.
Receiving can be disabled using uart_rx_disable, after calling that function, if there is any data received, #UART_RX_RDY event will be generated. #UART_RX_BUF_RELEASED event will be generated for every buffer currently passed to driver and finally #UART_RX_DISABLED event will occur.
Transmitting:
- Transmitting starts by uart_tx function.
- If whole buffer was transmitted #UART_TX_DONE is generated. If timeout occurred #UART_TX_ABORTED will be generated.
Transmitting can be aborted using @ref uart_tx_abort, after calling that function #UART_TX_ABORTED event will be generated.