aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2015-01-20 15:40:52 +0100
committerLars-Dominik Braun <lars@6xq.net>2015-01-20 15:40:52 +0100
commitb3e9d59041ac38706288874cd2e5572a8d6e0cf7 (patch)
tree22c7bb1a1957079666c5670bb09b5594ac98423d
parente748efd36ae4fb41f24baa4cc79d674dba2a8c3f (diff)
downloadhourglass-b3e9d59041ac38706288874cd2e5572a8d6e0cf7.tar.gz
hourglass-b3e9d59041ac38706288874cd2e5572a8d6e0cf7.tar.bz2
hourglass-b3e9d59041ac38706288874cd2e5572a8d6e0cf7.zip
timer: Fix one-shot mode
-rw-r--r--timer.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/timer.c b/timer.c
index e4dcd4e..0ca3586 100644
--- a/timer.c
+++ b/timer.c
@@ -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;