Loading include/arch/arduino-nano/driver/counter.h +4 −4 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ #include <avr/interrupt.h> typedef counter_value_t uint16_t; typedef counter_overflowed_t uint8_t; typedef counter_overflow_t uint8_t; class Counter { private: Loading @@ -10,12 +10,12 @@ class Counter { public: uint16_t value; volatile uint8_t overflowed; volatile uint8_t overflow; Counter() : overflowed(0) {} Counter() : overflow(0) {} inline void start() { overflowed = 0; overflow = 0; TCNT1 = 0; TCCR1A = 0; TCCR1B = _BV(CS10); // no prescaler Loading include/arch/esp8266/driver/counter.h +4 −4 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ extern "C" { #include "c_types.h" typedef counter_value_t uint32_t; typedef counter_overflowed_t uint32_t; typedef counter_overflow_t uint32_t; class Counter { private: Loading @@ -17,9 +17,9 @@ class Counter { public: uint32_t value; uint32_t overflowed; uint32_t overflow; Counter() : start_cycles(0), value(0), overflowed(0) {} Counter() : start_cycles(0), value(0), overflow(0) {} inline void start() { asm volatile ("esync; rsr %0,ccount":"=a" (start_cycles)); Loading @@ -31,7 +31,7 @@ class Counter { if (stop_cycles > start_cycles) { value = stop_cycles - start_cycles; } else { overflowed = 1; overflow = 1; } } }; Loading include/arch/msp430fr5969lp/driver/counter.h +10 −5 Original line number Diff line number Diff line #ifndef COUNTER_H #define COUNTER_H #include <msp430.h> #include <stdint.h> typedef counter_value_t uint16_t; typedef counter_overflowed_t uint8_t; typedef uint16_t counter_value_t; typedef uint8_t counter_overflow_t; class Counter { private: Loading @@ -10,12 +13,12 @@ class Counter { public: uint16_t value; uint8_t overflowed; uint8_t overflow; Counter() : overflowed(0) {} Counter() : overflow(0) {} inline void start() { overflowed = 0; overflow = 0; TA2CTL = TASSEL__SMCLK | ID__1 | MC__CONTINUOUS; TA2EX0 = 0; TA2CTL |= TACLR; Loading @@ -28,3 +31,5 @@ class Counter { }; extern Counter counter; #endif include/arch/msp430fr5994lp/driver/counter.h +4 −4 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ #include <stdint.h> typedef uint16_t counter_value_t; typedef uint8_t counter_overflowed_t; typedef uint8_t counter_overflow_t; class Counter { private: Loading @@ -10,12 +10,12 @@ class Counter { public: uint16_t value; uint8_t overflowed; uint8_t overflow; Counter() : overflowed(0) {} Counter() : overflow(0) {} inline void start() { overflowed = 0; overflow = 0; TA2CTL = TASSEL__SMCLK | ID__1 | MC__CONTINUOUS; TA2EX0 = 0; TA2CTL |= TACLR; Loading include/arch/posix/driver/counter.h +3 −3 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ #include <time.h> typedef uint64_t counter_value_t; typedef uint8_t counter_overflowed_t; typedef uint8_t counter_overflow_t; class Counter { private: Loading @@ -11,9 +11,9 @@ class Counter { public: uint64_t value; volatile uint8_t overflowed; volatile uint8_t overflow; Counter() : overflowed(0) {} Counter() : overflow(0) {} inline void start() { struct timespec ts; Loading Loading
include/arch/arduino-nano/driver/counter.h +4 −4 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ #include <avr/interrupt.h> typedef counter_value_t uint16_t; typedef counter_overflowed_t uint8_t; typedef counter_overflow_t uint8_t; class Counter { private: Loading @@ -10,12 +10,12 @@ class Counter { public: uint16_t value; volatile uint8_t overflowed; volatile uint8_t overflow; Counter() : overflowed(0) {} Counter() : overflow(0) {} inline void start() { overflowed = 0; overflow = 0; TCNT1 = 0; TCCR1A = 0; TCCR1B = _BV(CS10); // no prescaler Loading
include/arch/esp8266/driver/counter.h +4 −4 Original line number Diff line number Diff line Loading @@ -8,7 +8,7 @@ extern "C" { #include "c_types.h" typedef counter_value_t uint32_t; typedef counter_overflowed_t uint32_t; typedef counter_overflow_t uint32_t; class Counter { private: Loading @@ -17,9 +17,9 @@ class Counter { public: uint32_t value; uint32_t overflowed; uint32_t overflow; Counter() : start_cycles(0), value(0), overflowed(0) {} Counter() : start_cycles(0), value(0), overflow(0) {} inline void start() { asm volatile ("esync; rsr %0,ccount":"=a" (start_cycles)); Loading @@ -31,7 +31,7 @@ class Counter { if (stop_cycles > start_cycles) { value = stop_cycles - start_cycles; } else { overflowed = 1; overflow = 1; } } }; Loading
include/arch/msp430fr5969lp/driver/counter.h +10 −5 Original line number Diff line number Diff line #ifndef COUNTER_H #define COUNTER_H #include <msp430.h> #include <stdint.h> typedef counter_value_t uint16_t; typedef counter_overflowed_t uint8_t; typedef uint16_t counter_value_t; typedef uint8_t counter_overflow_t; class Counter { private: Loading @@ -10,12 +13,12 @@ class Counter { public: uint16_t value; uint8_t overflowed; uint8_t overflow; Counter() : overflowed(0) {} Counter() : overflow(0) {} inline void start() { overflowed = 0; overflow = 0; TA2CTL = TASSEL__SMCLK | ID__1 | MC__CONTINUOUS; TA2EX0 = 0; TA2CTL |= TACLR; Loading @@ -28,3 +31,5 @@ class Counter { }; extern Counter counter; #endif
include/arch/msp430fr5994lp/driver/counter.h +4 −4 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ #include <stdint.h> typedef uint16_t counter_value_t; typedef uint8_t counter_overflowed_t; typedef uint8_t counter_overflow_t; class Counter { private: Loading @@ -10,12 +10,12 @@ class Counter { public: uint16_t value; uint8_t overflowed; uint8_t overflow; Counter() : overflowed(0) {} Counter() : overflow(0) {} inline void start() { overflowed = 0; overflow = 0; TA2CTL = TASSEL__SMCLK | ID__1 | MC__CONTINUOUS; TA2EX0 = 0; TA2CTL |= TACLR; Loading
include/arch/posix/driver/counter.h +3 −3 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ #include <time.h> typedef uint64_t counter_value_t; typedef uint8_t counter_overflowed_t; typedef uint8_t counter_overflow_t; class Counter { private: Loading @@ -11,9 +11,9 @@ class Counter { public: uint64_t value; volatile uint8_t overflowed; volatile uint8_t overflow; Counter() : overflowed(0) {} Counter() : overflow(0) {} inline void start() { struct timespec ts; Loading