@@ -130,7 +130,8 @@ static inline void twai_handle_bus_off(int *alert_req)
130
130
static inline void twai_handle_recovery_complete (int * alert_req )
131
131
{
132
132
//Bus recovery complete.
133
- assert (twai_hal_handle_bus_recov_cplt (& twai_context ));
133
+ bool recov_cplt = twai_hal_handle_bus_recov_cplt (& twai_context );
134
+ assert (recov_cplt );
134
135
135
136
//Reset and set flags to the equivalent of the stopped state
136
137
TWAI_RESET_FLAG (p_twai_obj -> control_flags , CTRL_FLAG_RECOVERING | CTRL_FLAG_ERR_WARN |
@@ -221,7 +222,7 @@ static inline void twai_handle_tx_buffer_frame(BaseType_t *task_woken, int *aler
221
222
222
223
//Update TX message count
223
224
p_twai_obj -> tx_msg_count -- ;
224
- assert (p_twai_obj -> tx_msg_count >= 0 ); //Sanity check
225
+ assert (p_twai_obj -> tx_msg_count >= 0 ); //Sanity check
225
226
226
227
//Check if there are more frames to transmit
227
228
if (p_twai_obj -> tx_msg_count > 0 && p_twai_obj -> tx_queue != NULL ) {
@@ -381,7 +382,8 @@ esp_err_t twai_driver_install(const twai_general_config_t *g_config, const twai_
381
382
}
382
383
periph_module_reset (PERIPH_TWAI_MODULE );
383
384
periph_module_enable (PERIPH_TWAI_MODULE ); //Enable APB CLK to TWAI peripheral
384
- assert (twai_hal_init (& twai_context ));
385
+ bool init = twai_hal_init (& twai_context );
386
+ assert (init );
385
387
twai_hal_configure (& twai_context , t_config , f_config , DRIVER_DEFAULT_INTERRUPTS , g_config -> clkout_divider );
386
388
//Todo: Allow interrupt to be registered to specified CPU
387
389
TWAI_EXIT_CRITICAL ();
@@ -467,7 +469,8 @@ esp_err_t twai_start(void)
467
469
//Todo: Add assert to see if in reset mode. //Should already be in bus-off mode, set again to make sure
468
470
469
471
//Currently in listen only mode, need to set to mode specified by configuration
470
- assert (twai_hal_start (& twai_context , p_twai_obj -> mode ));
472
+ bool started = twai_hal_start (& twai_context , p_twai_obj -> mode );
473
+ assert (started );
471
474
472
475
TWAI_RESET_FLAG (p_twai_obj -> control_flags , CTRL_FLAG_STOPPED );
473
476
TWAI_EXIT_CRITICAL ();
@@ -481,7 +484,8 @@ esp_err_t twai_stop(void)
481
484
TWAI_CHECK_FROM_CRIT (p_twai_obj != NULL , ESP_ERR_INVALID_STATE );
482
485
TWAI_CHECK_FROM_CRIT (!(p_twai_obj -> control_flags & (CTRL_FLAG_STOPPED | CTRL_FLAG_BUS_OFF )), ESP_ERR_INVALID_STATE );
483
486
484
- assert (twai_hal_stop (& twai_context ));
487
+ bool stopped = twai_hal_stop (& twai_context );
488
+ assert (stopped );
485
489
486
490
TWAI_RESET_FLAG (p_twai_obj -> control_flags , CTRL_FLAG_TX_BUFF_OCCUPIED );
487
491
TWAI_SET_FLAG (p_twai_obj -> control_flags , CTRL_FLAG_STOPPED );
@@ -630,7 +634,8 @@ esp_err_t twai_initiate_recovery(void)
630
634
TWAI_SET_FLAG (p_twai_obj -> control_flags , CTRL_FLAG_RECOVERING );
631
635
632
636
//Trigger start of recovery process
633
- assert (twai_hal_start_bus_recovery (& twai_context ));
637
+ bool started = twai_hal_start_bus_recovery (& twai_context );
638
+ assert (started );
634
639
TWAI_EXIT_CRITICAL ();
635
640
636
641
return ESP_OK ;
0 commit comments