void suspend_power_down(void) { #ifdef BACKLIGHT_ENABLE backlight_set(0); #endif #ifndef NO_SUSPEND_POWER_DOWN // Enable watchdog to wake from MCU sleep cli(); wdt_reset(); // Watchdog Interrupt and System Reset Mode //wdt_enable(WDTO_1S); //WDTCSR |= _BV(WDIE); // Watchdog Interrupt Mode wdt_intr_enable(WDTO_120MS); // TODO: more power saving // See PicoPower application note // - I/O port input with pullup // - prescale clock // - BOD disable // - Power Reduction Register PRR // sleep in power down mode set_sleep_mode(SLEEP_MODE_PWR_DOWN); sleep_enable(); sei(); sleep_cpu(); sleep_disable(); // Disable watchdog after sleep wdt_disable(); #endif }
static void power_down(uint8_t wdto) { #ifdef PROTOCOL_LUFA if (USB_DeviceState == DEVICE_STATE_Configured) return; #endif wdt_timeout = wdto; // Watchdog Interrupt Mode wdt_intr_enable(wdto); // TODO: more power saving // See PicoPower application note // - I/O port input with pullup // - prescale clock // - BOD disable // - Power Reduction Register PRR set_sleep_mode(SLEEP_MODE_PWR_DOWN); sleep_enable(); sei(); sleep_cpu(); sleep_disable(); // Disable watchdog after sleep wdt_disable(); }