aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster/fsm-standby.c
diff options
context:
space:
mode:
authorSelene ToyKeeper2017-09-24 20:54:07 -0600
committerSelene ToyKeeper2017-09-24 20:54:07 -0600
commit520f5cdb983045c5518325f3c3665f59ca85435e (patch)
treedb05070d81d080743555075150e8133c6e5e84dd /spaghetti-monster/fsm-standby.c
parentForgot to include a copy of the GPL before. (diff)
downloadanduril-520f5cdb983045c5518325f3c3665f59ca85435e.tar.gz
anduril-520f5cdb983045c5518325f3c3665f59ca85435e.tar.bz2
anduril-520f5cdb983045c5518325f3c3665f59ca85435e.zip
Added idle_mode() for slightly lower power use without turning off any regular functions.
(PWM, ADC, WDT all still enabled; only useful in moon mode) Changed default ceilings in Anduril FW3A config.
Diffstat (limited to 'spaghetti-monster/fsm-standby.c')
-rw-r--r--spaghetti-monster/fsm-standby.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/spaghetti-monster/fsm-standby.c b/spaghetti-monster/fsm-standby.c
index 44a2e0a..5312f94 100644
--- a/spaghetti-monster/fsm-standby.c
+++ b/spaghetti-monster/fsm-standby.c
@@ -40,6 +40,9 @@ void sleep_until_eswitch_pressed()
PCINT_on(); // wake on e-switch event
+ // configure sleep mode
+ set_sleep_mode(SLEEP_MODE_PWR_DOWN);
+
sleep_enable();
sleep_bod_disable();
sleep_cpu(); // wait here
@@ -57,4 +60,18 @@ void sleep_until_eswitch_pressed()
WDT_on();
}
+#ifdef USE_IDLE_MODE
+void idle_mode()
+{
+ // configure sleep mode
+ set_sleep_mode(SLEEP_MODE_IDLE);
+
+ sleep_enable();
+ sleep_cpu(); // wait here
+
+ // something happened; wake up
+ sleep_disable();
+}
+#endif
+
#endif