summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSadeep Madurange <sadeep@asciimx.com>2025-06-09 10:29:49 +0800
committerSadeep Madurange <sadeep@asciimx.com>2025-06-09 10:29:49 +0800
commitdfae018264ab33f4ec0e04fb61805465f905e6a5 (patch)
tree7c0a6b9bd7c931094b14a5cd0a2be0fb1664b8cf
parentc7ee90c9612721f6458e9126b4425d4b6aef04dc (diff)
downloadfpm-door-lock-dfae018264ab33f4ec0e04fb61805465f905e6a5.tar.gz
Disable watchdog timer and power down. Button presses are finnicky, may need to add a delay.
-rw-r--r--main.c10
1 files changed, 10 insertions, 0 deletions
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;