I have an issue where I need to create a timer for de-bouncing a switch input. I am looking through an existing code base where timers are working and have tried to follow the same methodology. The issue is that when I do a Timer_Create an assert occurs causing the application to hang. The code that I am using to create the timer is:
static TimerHandle_t debounceTimerHandle ;
// Create a de-bounce timer
TimerParameters_t timerParameters =
{
.oneShot = TRUE,
.startAfterCreation = FALSE,
.periodMs = 50,
.argument = 4,
.callback = Drill_DebounceTimerCallback,
};
Timer_Create(&debounceTimerHandle, &timerParameters);
HAL_ASSERT( debounceTimerHandle != NULL );
It looks like we never actually get to the HAL_ASSERT statement. An assert is thrown during the execution of the Timer_Create statement.
It there some config setting that could be an issue?
I have read a suggestion on this sight that a person should use the Clock api. I guess I don't understand why there is a difference between the Timer api and the Clock api. Is one preferred over the other?