From d4f38c14cd22131ba20e3ff5d30fcc43c6fc5b2f Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Fri, 23 Oct 2020 13:35:02 +0200 Subject: use 16bit uint for msp430fr overflow counter --- include/arch/msp430fr5994lp/driver/counter.h | 4 ++-- src/arch/msp430fr5994lp/driver/counter.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/arch/msp430fr5994lp/driver/counter.h b/include/arch/msp430fr5994lp/driver/counter.h index 1d7800a..429de39 100644 --- a/include/arch/msp430fr5994lp/driver/counter.h +++ b/include/arch/msp430fr5994lp/driver/counter.h @@ -5,7 +5,7 @@ #include typedef uint16_t counter_value_t; -typedef uint8_t counter_overflow_t; +typedef uint16_t counter_overflow_t; class Counter { private: @@ -13,7 +13,7 @@ class Counter { public: uint16_t value; - volatile uint8_t overflow; + volatile uint16_t overflow; Counter() : overflow(0) {} diff --git a/src/arch/msp430fr5994lp/driver/counter.cc b/src/arch/msp430fr5994lp/driver/counter.cc index daa7a2d..d69d844 100644 --- a/src/arch/msp430fr5994lp/driver/counter.cc +++ b/src/arch/msp430fr5994lp/driver/counter.cc @@ -6,7 +6,7 @@ Counter counter; __attribute__((interrupt(TIMER2_A1_VECTOR))) void handle_timer2_overflow() { if (TA2IV == 0x0e) { - if (counter.overflow < 255) { + if (counter.overflow < 65535) { counter.overflow++; } } -- cgit v1.2.3