/** * @brief Services timer and sio handler * * This function calls sio & timer handling functions. */ void pal_task(void) { #if (TOTAL_NUMBER_OF_TIMERS > 0) timer_service(); #endif #ifdef USB0 /* * If the serial communication is done using USB, only then the 'usb_handler' * needs to be called. For UART, the data handling is done in the UART ISR. */ usb_handler(); #endif /* USB0 */ #ifdef WATCHDOG WDT_RESET(); #endif driver_task(); }
/** * @brief Initialization of PAL * * This function initializes the PAL. The RC oscillator is calibrated. * * @return MAC_SUCCESS if PAL initialization is successful, FAILURE otherwise */ retval_t pal_init(void) { /* Clear any pending watchdog reset flag */ uint8_t temp = MCUSR; temp++; /* keep compiler happy */ MCUSR = 0; #ifdef WATCHDOG /* Watchdog Initialization. Enables the watchdog and sets the timeout period */ wdt_init(); #else WDT_RESET(); WDT_DISABLE(); #endif mcu_init(); // see pal_mcu_generic.c timer_init(); // see pal_timer.c gpio_init(); // see pal_board.c driver_init(); return MAC_SUCCESS; }
void wdt_reset_mcu() { // signal wdt to reset on timeout WDT_RESET(); }