27.8.1.1.3 Workflow
- Create a Watchdog module configuration struct, which can be filled out to adjust the configuration of the Watchdog.
struct
wdt_conf config_wdt;
- Initialize the Watchdog configuration struct with the module's default values.
wdt_get_config_defaults(&config_wdt);
Note: This should always be performed before using the configuration struct to ensure that all values are initialized to known default settings. - Adjust the configuration struct to set the timeout period and lock mode of the Watchdog.
config_wdt.always_on =
false
;
#if !((SAML21) || (SAMC21) || (SAML22))
config_wdt.clock_source = GCLK_GENERATOR_4;
#endif
config_wdt.timeout_period = WDT_PERIOD_2048CLK;
- Setups the WDT hardware module with the requested settings.
wdt_set_config(&config_wdt);