diff options
Diffstat (limited to 'include/arch/msp430fr5994lp')
-rw-r--r-- | include/arch/msp430fr5994lp/driver/counter.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/include/arch/msp430fr5994lp/driver/counter.h b/include/arch/msp430fr5994lp/driver/counter.h index b95aba1..1d7800a 100644 --- a/include/arch/msp430fr5994lp/driver/counter.h +++ b/include/arch/msp430fr5994lp/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; value = TA2R; + __dint(); } }; |