EasyManua.ls Logo

Espressif ESP32-S2 - Page 467

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Chapter 2. API Reference
[out] current_alerts: Bit field of currently raised alerts. Set to NULL if unused
esp_err_t twai_initiate_recovery(void)
Start the bus recovery process.
This function initiates the bus recovery process when the TWAI driver is in the bus-off state. Once initiated,
the TWAI driver will enter the recovering state and wait for 128 occurrences of the bus-free signal on the
TWAI bus before returning to the stopped state. This function will reset the TX queue, clearing any messages
pending transmission.
Note The BUS_RECOVERED alert can be enabled to alert the application when the bus recovery process
completes.
Return
ESP_OK: Bus recovery started
ESP_ERR_INVALID_STATE: TWAI driver is not in the bus-off state, or is not installed
esp_err_t twai_get_status_info(twai_status_info_t *status_info)
Get current status information of the TWAI driver.
Return
ESP_OK: Status information retrieved
ESP_ERR_INVALID_ARG: Arguments are invalid
ESP_ERR_INVALID_STATE: TWAI driver is not installed
Parameters
[out] status_info: Status information
esp_err_t twai_clear_transmit_queue(void)
Clear the transmit queue.
This function will clear the transmit queue of all messages.
Note The transmit queue is automatically cleared when twai_stop() or twai_initiate_recovery() is called.
Return
ESP_OK: Transmit queue cleared
ESP_ERR_INVALID_STATE: TWAI driver is not installed or TX queue is disabled
esp_err_t twai_clear_receive_queue(void)
Clear the receive queue.
This function will clear the receive queue of all messages.
Note The receive queue is automatically cleared when twai_start() is called.
Return
ESP_OK: Transmit queue cleared
ESP_ERR_INVALID_STATE: TWAI driver is not installed
Structures
struct twai_general_config_t
Structure for general configuration of the TWAI driver.
Note Macro initializers are available for this structure
Public Members
twai_mode_t mode
Mode of TWAI controller
gpio_num_t tx_io
Transmit GPIO number
gpio_num_t rx_io
Receive GPIO number
Espressif Systems 456
Submit Document Feedback
Release v4.4

Table of Contents