Complete the code to create a FreeRTOS timer named myTimer.
TimerHandle_t myTimer = xTimerCreate("Timer", [1], pdTRUE, NULL, TimerCallback);
The timer period must be specified in ticks, so we convert 1000 milliseconds to ticks using 1000 / portTICK_PERIOD_MS.
Complete the code to start the timer myTimer.
xTimerStart([1], 0);
To start the timer, pass its handle myTimer to xTimerStart.
Fix the error in the code to change the timer period at runtime.
xTimerChangePeriod(myTimer, [1], 0);
The new timer period must be in ticks, so convert 500 milliseconds using 500 / portTICK_PERIOD_MS.
Fill both blanks to check if the timer period change was successful and handle failure.
if (xTimerChangePeriod(myTimer, [1], 0) == [2]) { // Period changed successfully } else { // Handle error }
The function returns pdPASS on success. The new period must be in ticks.
Fill all three blanks to create a timer, start it, and then change its period at runtime.
TimerHandle_t timer = xTimerCreate("MyTimer", [1], pdTRUE, NULL, TimerCallback); xTimerStart([2], 0); xTimerChangePeriod(timer, [3], 0);
First, create the timer with a 2000 ms period converted to ticks. Then start the timer by passing its handle timer. Finally, change the period to 1000 ms converted to ticks.
