Complete the code to create a software timer with FreeRTOS.
TimerHandle_t xTimer = xTimerCreate("Timer", pdMS_TO_TICKS([1]), pdTRUE, 0, vTimerCallback);
The timer period is set in milliseconds. Here, 1000 ms means the timer triggers every 1 second.
Complete the code to start the software timer after creation.
if (xTimer != NULL) { xTimer[1](xTimer, 0); }
xTimerStart starts the timer so it begins counting and calling the callback.
Fix the error in the callback function signature for a FreeRTOS software timer.
void [1](TimerHandle_t xTimer) {
// Timer callback code
}The callback function name is user-defined but commonly starts with 'v' and matches the name used when creating the timer.
Fill both blanks to create a software timer that does not auto-reload and starts immediately.
TimerHandle_t xTimer = xTimerCreate("OneShot", pdMS_TO_TICKS([1]), [2], 0, vTimerCallback); xTimerStart(xTimer, 0);
The timer period is 500 ms and pdFALSE means the timer is one-shot (does not auto-reload).
Fill all three blanks to create a periodic timer with a 2-second period and start it.
TimerHandle_t xTimer = xTimerCreate("Periodic", pdMS_TO_TICKS([1]), [2], 0, [3]); xTimerStart(xTimer, 0);
The timer period is 2000 ms (2 seconds), pdTRUE means it auto-reloads, and the callback function is vTimerCallback.
