summaryrefslogtreecommitdiff
path: root/include/arch
diff options
context:
space:
mode:
Diffstat (limited to 'include/arch')
-rw-r--r--include/arch/arduino-nano/driver/counter.h8
-rw-r--r--include/arch/esp8266/driver/counter.h8
-rw-r--r--include/arch/msp430fr5969lp/driver/counter.h15
-rw-r--r--include/arch/msp430fr5994lp/driver/counter.h8
-rw-r--r--include/arch/posix/driver/counter.h6
5 files changed, 25 insertions, 20 deletions
diff --git a/include/arch/arduino-nano/driver/counter.h b/include/arch/arduino-nano/driver/counter.h
index 43ddd15..5685136 100644
--- a/include/arch/arduino-nano/driver/counter.h
+++ b/include/arch/arduino-nano/driver/counter.h
@@ -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:
@@ -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
diff --git a/include/arch/esp8266/driver/counter.h b/include/arch/esp8266/driver/counter.h
index 42f6f14..0b50c8e 100644
--- a/include/arch/esp8266/driver/counter.h
+++ b/include/arch/esp8266/driver/counter.h
@@ -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:
@@ -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));
@@ -31,7 +31,7 @@ class Counter {
if (stop_cycles > start_cycles) {
value = stop_cycles - start_cycles;
} else {
- overflowed = 1;
+ overflow = 1;
}
}
};
diff --git a/include/arch/msp430fr5969lp/driver/counter.h b/include/arch/msp430fr5969lp/driver/counter.h
index 501808b..b95aba1 100644
--- a/include/arch/msp430fr5969lp/driver/counter.h
+++ b/include/arch/msp430fr5969lp/driver/counter.h
@@ -1,8 +1,11 @@
+#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:
@@ -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;
@@ -28,3 +31,5 @@ class Counter {
};
extern Counter counter;
+
+#endif
diff --git a/include/arch/msp430fr5994lp/driver/counter.h b/include/arch/msp430fr5994lp/driver/counter.h
index 21c5ec5..61f0ec1 100644
--- a/include/arch/msp430fr5994lp/driver/counter.h
+++ b/include/arch/msp430fr5994lp/driver/counter.h
@@ -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:
@@ -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;
diff --git a/include/arch/posix/driver/counter.h b/include/arch/posix/driver/counter.h
index 4f575a8..88cb0cc 100644
--- a/include/arch/posix/driver/counter.h
+++ b/include/arch/posix/driver/counter.h
@@ -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:
@@ -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;