Loading include/arch/msp430fr5969lp/driver/counter.h 0 → 100644 +26 −0 Original line number Diff line number Diff line #include <msp430.h> #include <stdint.h> class Counter { private: Counter(const Counter ©); public: uint8_t overflowed; Counter() : overflowed(0) {} inline void start() { overflowed = 0; TA2CTL = TASSEL__SMCLK | ID__1 | MC__CONTINUOUS; TA2EX0 = 0; TA2CTL |= TACLR; } inline uint16_t stop() { TA2CTL = 0; return TA2R; } }; extern Counter counter; src/arch/msp430fr5969lp/Makefile.inc +4 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,10 @@ ifneq ($(findstring timer,${arch_drivers}), ) CXX_TARGETS += src/arch/msp430fr5969lp/driver/timer.cc endif ifneq ($(findstring counter,${arch_drivers}), ) CXX_TARGETS += src/arch/msp430fr5969lp/driver/counter.cc endif ifneq (${cpu_freq}, ) COMMON_FLAGS += -DF_CPU=${cpu_freq}UL else Loading src/arch/msp430fr5969lp/driver/counter.cc 0 → 100644 +7 −0 Original line number Diff line number Diff line #include "driver/counter.h" #if defined(TIMER_CYCLES) #warn "timer_cycles and counter are mutually exclusive. Expect odd behaviour." #endif Counter counter; Loading
include/arch/msp430fr5969lp/driver/counter.h 0 → 100644 +26 −0 Original line number Diff line number Diff line #include <msp430.h> #include <stdint.h> class Counter { private: Counter(const Counter ©); public: uint8_t overflowed; Counter() : overflowed(0) {} inline void start() { overflowed = 0; TA2CTL = TASSEL__SMCLK | ID__1 | MC__CONTINUOUS; TA2EX0 = 0; TA2CTL |= TACLR; } inline uint16_t stop() { TA2CTL = 0; return TA2R; } }; extern Counter counter;
src/arch/msp430fr5969lp/Makefile.inc +4 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,10 @@ ifneq ($(findstring timer,${arch_drivers}), ) CXX_TARGETS += src/arch/msp430fr5969lp/driver/timer.cc endif ifneq ($(findstring counter,${arch_drivers}), ) CXX_TARGETS += src/arch/msp430fr5969lp/driver/counter.cc endif ifneq (${cpu_freq}, ) COMMON_FLAGS += -DF_CPU=${cpu_freq}UL else Loading
src/arch/msp430fr5969lp/driver/counter.cc 0 → 100644 +7 −0 Original line number Diff line number Diff line #include "driver/counter.h" #if defined(TIMER_CYCLES) #warn "timer_cycles and counter are mutually exclusive. Expect odd behaviour." #endif Counter counter;