summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2018-12-04 07:35:23 +0100
committerDaniel Friesel <derf@finalrewind.org>2018-12-04 07:35:23 +0100
commit2d49d59ba1335ed28cfdd7fc586be4e1637ebe9c (patch)
treef1c54acefd9e0fd43e9e50203e58678ec95b1ac6 /include
parent51c4aca4432963af11db0d85b9ddb4ff2d50fc60 (diff)
arduino-nano: change timer to new API
Diffstat (limited to 'include')
-rw-r--r--include/arch/arduino-nano/driver/counter.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/include/arch/arduino-nano/driver/counter.h b/include/arch/arduino-nano/driver/counter.h
index d387a35..9105219 100644
--- a/include/arch/arduino-nano/driver/counter.h
+++ b/include/arch/arduino-nano/driver/counter.h
@@ -6,7 +6,8 @@ class Counter {
Counter(const Counter &copy);
public:
- uint8_t overflowed;
+ uint16_t value;
+ volatile uint8_t overflowed;
Counter() : overflowed(0) {}
@@ -14,13 +15,13 @@ class Counter {
overflowed = 0;
TCNT1 = 0;
TCCR1A = 0;
- TCCR1B = _BV(CS10);
+ TCCR1B = _BV(CS10); // no prescaler
TIMSK1 = _BV(TOIE1);
}
- inline uint16_t stop() {
+ inline void stop() {
TCCR1B = 0;
- return TCNT1;
+ value = TCNT1;
}
};