Skip to content

Commit

Permalink
Merge branch 'contrib/github_pr_12998' into 'master'
Browse files Browse the repository at this point in the history
fix(twai): TWAI_GENERAL_CONFIG_DEFAULT initialize controller_id (GitHub PR)

Closes IDFGH-11917

See merge request espressif/esp-idf!28554
  • Loading branch information
wanckl committed Jan 18, 2024
2 parents 9a7e88e + bd9711d commit 2bd7e67
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions components/driver/twai/include/driver/twai.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,26 @@ extern "C" {
/**
* @brief Initializer macro for general configuration structure.
*
* This initializer macros allows the TX GPIO, RX GPIO, and operating mode to be
* configured. The other members of the general configuration structure are
* This initializer macros allows the controller ID, TX GPIO, RX GPIO, and operating
* mode to be configured. The other members of the general configuration structure are
* assigned default values.
*/
#define TWAI_GENERAL_CONFIG_DEFAULT(tx_io_num, rx_io_num, op_mode) {.mode = op_mode, .tx_io = tx_io_num, .rx_io = rx_io_num, \
#define TWAI_GENERAL_CONFIG_DEFAULT_V2(controller_num, tx_io_num, rx_io_num, op_mode) {.controller_id = controller_num, \
.mode = op_mode, .tx_io = tx_io_num, .rx_io = rx_io_num, \
.clkout_io = TWAI_IO_UNUSED, .bus_off_io = TWAI_IO_UNUSED, \
.tx_queue_len = 5, .rx_queue_len = 5, \
.alerts_enabled = TWAI_ALERT_NONE, .clkout_divider = 0, \
.intr_flags = ESP_INTR_FLAG_LEVEL1}

/**
* @brief Initializer macro for general configuration structure.
*
* This initializer macros allows the TX GPIO, RX GPIO, and operating mode to be
* configured. Controller ID is set to 0 and he other members of the general configuration
* structure are assigned default values.
*/
#define TWAI_GENERAL_CONFIG_DEFAULT(tx_io_num, rx_io_num, op_mode) TWAI_GENERAL_CONFIG_DEFAULT_V2(0, tx_io_num, rx_io_num, op_mode)

/**
* @brief Alert flags
*
Expand Down

0 comments on commit 2bd7e67

Please sign in to comment.