Skip to content

Commit

Permalink
change(twai): don't panic if twai hal init fail
Browse files Browse the repository at this point in the history
Related to #15068
  • Loading branch information
suda-morris committed Dec 23, 2024
1 parent 19b5381 commit 6326508
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions components/driver/twai/twai.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,8 +547,10 @@ esp_err_t twai_driver_install_v2(const twai_general_config_t *g_config, const tw
.clock_source_hz = clock_source_hz,
.controller_id = controller_id,
};
bool res = twai_hal_init(&p_twai_obj->hal, &hal_config);
assert(res);
if (twai_hal_init(&p_twai_obj->hal, &hal_config) == false) {
ret = ESP_ERR_INVALID_STATE;
goto err;
}
twai_hal_configure(&p_twai_obj->hal, t_config, f_config, DRIVER_DEFAULT_INTERRUPTS, g_config->clkout_divider);

//Assign GPIO and Interrupts
Expand Down

0 comments on commit 6326508

Please sign in to comment.