Commit 32b799a0 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

counter: rename overflowed to overflow

parent bda22fb5
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -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
+4 −4
Original line number Diff line number Diff line
@@ -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;
			}
		}
};
+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:
@@ -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
+4 −4
Original line number Diff line number Diff line
@@ -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;
+3 −3
Original line number Diff line number Diff line
@@ -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;
Loading