int main (void) { system_init(); configure_port_pins(); configure_usart(); printf("--TEST prepare: ATMEL SAMD10 watchdog callback!\r\n"); configure_wdt(); configure_wdt_callbacks(); printf("--TEST prepare: Config WDT:4096 ms!\r\n"); printf("--TEST prepare: Config WDT:Early Warning,2048ms!\r\n"); system_interrupt_enable_global(); printf("--TEST prepare: Enable gobale Interrupt!\r\n"); printf("--TEST information: Waitting for WDT Early Warning Interrupt!\r\n"); printf("\r\n\r\n\r\n"); while(1) { ; } /* Insert application code here, after the board has been initialized. */ }
int main(void) { system_init(); //! [setup_init] configure_wdt(); //! [setup_init] //! [main] //! [main_1] enum system_reset_cause reset_cause = system_get_reset_cause(); //! [main_1] //! [main_2] 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); } //! [main_2] //! [main_3] while (true) { //! [main_3] //! [main_4] if (port_pin_get_input_level(BUTTON_0_PIN) == false) { //! [main_4] //! [main_5] port_pin_set_output_level(LED_0_PIN, LED_0_ACTIVE); wdt_reset_count(); //! [main_5] } } //! [main] }