summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-03-08 11:53:33 +0100
committerDaniel Friesel <derf@finalrewind.org>2019-03-08 11:53:33 +0100
commitcd7ee540291f7412153ee9fa1e785cc859c589fe (patch)
treec4c58dc1957dc464fb61cdb3742f7b32d5eb3c18 /include
parentd1668a6fc12062c2c180534e7825910e6fcb05b0 (diff)
msp430fr5969 counter: Track overflows
Diffstat (limited to 'include')
-rw-r--r--include/arch/msp430fr5969lp/driver/counter.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/include/arch/msp430fr5969lp/driver/counter.h b/include/arch/msp430fr5969lp/driver/counter.h
index b95aba1..0d7e140 100644
--- a/include/arch/msp430fr5969lp/driver/counter.h
+++ b/include/arch/msp430fr5969lp/driver/counter.h
@@ -13,7 +13,7 @@ class Counter {
public:
uint16_t value;
- uint8_t overflow;
+ volatile uint8_t overflow;
Counter() : overflow(0) {}
@@ -21,12 +21,16 @@ class Counter {
overflow = 0;
TA2CTL = TASSEL__SMCLK | ID__1 | MC__CONTINUOUS;
TA2EX0 = 0;
- TA2CTL |= TACLR;
+ TA2CTL |= TACLR | TAIE;
+ asm volatile("nop");
+ __eint();
+ asm volatile("nop");
}
inline void stop() {
- TA2CTL = 0;
+ __dint();
value = TA2R;
+ TA2CTL = 0;
}
};