27.8.1.2.2 Workflow
- Retrieve the cause of the system reset to determine if the Watchdog module was the cause of the last reset.
enumsystem_reset_cause reset_cause = system_get_reset_cause(); - Turn on or off the board LED based on whether the Watchdog reset the device.
if(reset_cause == SYSTEM_RESET_CAUSE_WDT) {port_pin_set_output_level(LED_0_PIN, LED_0_INACTIVE);}else{port_pin_set_output_level(LED_0_PIN, LED_0_ACTIVE);} - Enter an infinite loop to hold the main program logic.
while(true) { - Test to see if the board button is currently being pressed.
if(port_pin_get_input_level(BUTTON_0_PIN) ==false) { - If the button is pressed, turn on the board LED and reset the Watchdog timer.
port_pin_set_output_level(LED_0_PIN, LED_0_ACTIVE);wdt_reset_count();
