27.8.1.1.2 Code

Copy-paste the following setup code to your user application:
void configure_wdt(void)
{
    /* Create a new configuration structure for the Watchdog settings and fill
     * with the default module settings. */
    struct wdt_conf config_wdt;
    wdt_get_config_defaults(&config_wdt);

    /* Set the Watchdog configuration settings */
    config_wdt.always_on      = false;
#if !((SAML21) || (SAMC21) || (SAML22))
    config_wdt.clock_source   = GCLK_GENERATOR_4;
#endif
    config_wdt.timeout_period = WDT_PERIOD_2048CLK;

    /* Initialize and enable the Watchdog with the user settings */
    wdt_set_config(&config_wdt);
}
Add to user application initialization (typically the start of main()):
configure_wdt();