From dfae018264ab33f4ec0e04fb61805465f905e6a5 Mon Sep 17 00:00:00 2001 From: Sadeep Madurange Date: Mon, 9 Jun 2025 10:29:49 +0800 Subject: Disable watchdog timer and power down. Button presses are finnicky, may need to add a delay. --- main.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'main.c') diff --git a/main.c b/main.c index 7aea82a..f805c48 100644 --- a/main.c +++ b/main.c @@ -34,6 +34,13 @@ int main(void) { + /* disable watchdog timer */ + cli(); + wdt_reset(); + MCUSR &= ~(1 << WDRF); + WDTCSR |= (1 << WDCE) | (1 << WDE); + WDTCSR = 0x00; + /* init input ports */ INPUT_DDR &= ~((1 << BACK_LOCK_PIN) | (1 << BACK_UNLOCK_PIN) | (1 << FRONT_LOCK_PIN) | (1 << FRONT_UNLOCK_PIN) | @@ -61,6 +68,9 @@ int main(void) sei(); for (;;) { + sleep_bod_disable(); + set_sleep_mode(SLEEP_MODE_PWR_DOWN); + sleep_mode(); } return 0; -- cgit v1.2.3