diff options
author | Daniel Friesel <derf@finalrewind.org> | 2016-03-14 19:43:23 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2016-03-14 19:43:23 +0100 |
commit | 8e4050b25db4c3535a85f9f082e24e445fed8df8 (patch) | |
tree | 29072ffef6f492468cb90e20c9b7ed13fda9876e /src | |
parent | 9c6b819653834f49ce12a3afa2eb982c19df7e5f (diff) |
wakeup: Do not return until both buttons have been released (closes #3)
Diffstat (limited to 'src')
-rw-r--r-- | src/system.cc | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/system.cc b/src/system.cc index 37e9ea5..bf18003 100644 --- a/src/system.cc +++ b/src/system.cc @@ -309,17 +309,24 @@ void System::shutdown() // Don't disable PCICR, something else might need it. PCMSK1 &= ~(_BV(PCINT15) | _BV(PCINT11)); - // debounce - _delay_ms(50); - // turn on display loadPattern(current_anim_no); display.enable(); - // ... and modem + // wait for wakeup button(s) to be released + while (!((PINC & _BV(PC3)) && (PINC & _BV(PC7)))) + display.update(); + + // debounce + for (i = 0; i < 50; i++) { + display.update(); + _delay_ms(2); + } + + // finally, turn on the modem... modem.enable(); - // also, reset state machine + // ... and reset the receive state machine rxExpect = START1; } |