diff options
| author | Selene ToyKeeper | 2018-06-17 18:18:38 -0600 |
|---|---|---|
| committer | Selene ToyKeeper | 2018-06-17 18:18:38 -0600 |
| commit | cfedb2eaf4a0d62969ff05307ac40d4f1cdab2d9 (patch) | |
| tree | 0d4ecd59e65b3152c44e50c9a93e679a260fac5c /spaghetti-monster/fsm-wdt.c | |
| parent | Added dual-switch support (tail clicky + e-switch) to muggle mode. (diff) | |
| download | anduril-cfedb2eaf4a0d62969ff05307ac40d4f1cdab2d9.tar.gz anduril-cfedb2eaf4a0d62969ff05307ac40d4f1cdab2d9.tar.bz2 anduril-cfedb2eaf4a0d62969ff05307ac40d4f1cdab2d9.zip | |
Implemented halfsleep mode.
Will probably change it quite a bit though, so I'm checking in changes first.
Needs to be "tick during standby" instead of "half sleep".
Diffstat (limited to '')
| -rw-r--r-- | spaghetti-monster/fsm-wdt.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spaghetti-monster/fsm-wdt.c b/spaghetti-monster/fsm-wdt.c index ff96ffb..06b0b6d 100644 --- a/spaghetti-monster/fsm-wdt.c +++ b/spaghetti-monster/fsm-wdt.c @@ -45,6 +45,23 @@ inline void WDT_off() // clock tick -- this runs every 16ms (62.5 fps) ISR(WDT_vect) { + #ifdef USE_HALFSLEEP_MODE + f_wdt = 1; // WDT event happened + + static uint16_t sleep_counter = 0; + // handle halfsleep mode specially + if (halfsleep_mode) { + // emit a halfsleep tick, and process it + emit(EV_halfsleep_tick, sleep_counter); + sleep_counter ++; + process_emissions(); + //if (! halfsleep_mode) + // sleep_counter = 0; + return; + } + sleep_counter = 0; + #endif + // detect and emit button change events uint8_t was_pressed = button_last_state; uint8_t pressed = button_is_pressed(); |
