summaryrefslogtreecommitdiff
path: root/src/arch
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 /src/arch
parentd1668a6fc12062c2c180534e7825910e6fcb05b0 (diff)
msp430fr5969 counter: Track overflows
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/msp430fr5969lp/driver/counter.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/arch/msp430fr5969lp/driver/counter.cc b/src/arch/msp430fr5969lp/driver/counter.cc
index 62ac778..cd10b5c 100644
--- a/src/arch/msp430fr5969lp/driver/counter.cc
+++ b/src/arch/msp430fr5969lp/driver/counter.cc
@@ -1,7 +1,18 @@
+#include "arch.h"
#include "driver/counter.h"
+#include "driver/gpio.h"
#if defined(TIMER_CYCLES)
#warn "timer_cycles and counter are mutually exclusive. Expect odd behaviour."
#endif
Counter counter;
+
+__attribute__((interrupt(TIMER2_A1_VECTOR))) void handle_timer2_overflow()
+{
+ if (TA2IV == 0x0e) {
+ if (counter.overflow < 255) {
+ counter.overflow++;
+ }
+ }
+}