Complete the code to create a heartbeat task that toggles an LED.
void HeartbeatTask(void *pvParameters) {
for(;;) {
ToggleLED();
vTaskDelay([1]);
}
}The heartbeat task should delay for 100 milliseconds to toggle the LED regularly.
Complete the code to initialize the watchdog timer with a timeout.
void InitWatchdog() {
Watchdog_Config config = {
.timeout = [1]
};
Watchdog_Init(&config);
}The watchdog timeout is set to 10000 milliseconds (10 seconds) to allow enough time for system checks.
Fix the error in the watchdog refresh function to prevent system reset.
void RefreshWatchdog() {
[1]();
}The correct function to refresh the watchdog timer is Watchdog_Feed().
Fill both blanks to create a health check task that signals system status.
void HealthCheckTask(void *pvParameters) {
for(;;) {
if(SystemIsHealthy()) {
SignalStatus([1]);
} else {
SignalStatus([2]);
}
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}Use LED_GREEN to indicate healthy status and LED_RED for unhealthy status.
Fill all three blanks to create a dictionary mapping task names to their heartbeat intervals.
const TaskHeartbeatConfig taskHeartbeats = {
[1]: [2],
[3]: 500
};SensorTask has a heartbeat interval of 2000 ms, CommTask has 500 ms.