Complete the code to create a FreeRTOS timer named 'statusTimer'.
TimerHandle_t statusTimer = xTimerCreate("StatusTimer", [1], pdTRUE, NULL, vStatusCallback);
The timer period must be specified in ticks. Using pdMS_TO_TICKS(1000) converts 1000 milliseconds to ticks.
Complete the code to start the timer 'statusTimer' with no block time.
xTimerStart(statusTimer, [1]);To start the timer without blocking, use 0 as the block time.
Fix the error in the timer callback function prototype.
void [1](TimerHandle_t xTimer) {
// Status reporting code here
}The callback function name must match the one used when creating the timer, which is vStatusCallback.
Fill both blanks to create a periodic timer and check if it was created successfully.
TimerHandle_t statusTimer = xTimerCreate("StatusTimer", [1], [2], NULL, vStatusCallback); if (statusTimer == NULL) { // Handle error }
The timer period is 2000 milliseconds converted to ticks, and pdTRUE makes the timer auto-reload periodically.
Fill all three blanks to stop the timer safely and delete it.
if (xTimerStop(statusTimer, [1]) == pdPASS) { xTimerDelete(statusTimer, [2]); statusTimer = [3]; }
Use pdFALSE to not block when stopping the timer, 0 to not block when deleting, and set the timer handle to NULL after deletion.
