diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2015-01-20 15:40:52 +0100 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2015-01-20 15:40:52 +0100 |
commit | b3e9d59041ac38706288874cd2e5572a8d6e0cf7 (patch) | |
tree | 22c7bb1a1957079666c5670bb09b5594ac98423d | |
parent | e748efd36ae4fb41f24baa4cc79d674dba2a8c3f (diff) | |
download | hourglass-b3e9d59041ac38706288874cd2e5572a8d6e0cf7.tar.gz hourglass-b3e9d59041ac38706288874cd2e5572a8d6e0cf7.tar.bz2 hourglass-b3e9d59041ac38706288874cd2e5572a8d6e0cf7.zip |
timer: Fix one-shot mode
-rw-r--r-- | timer.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -25,6 +25,9 @@ ISR(TIMER1_COMPA_vect) { OCR1A = lastcount; } else if (hits >= maxhits) { enableWakeup (WAKE_TIMER); + if (oneshot) { + timerStop (); + } } } @@ -37,9 +40,7 @@ uint32_t timerHit () { disableWakeup (WAKE_TIMER); ret = time; - if (oneshot) { - timerStop (); - } else { + if (!oneshot) { /* reset timer, start again */ hits = 0; time = 0; |