Commit d4f38c14 authored by Daniel Friesel's avatar Daniel Friesel
Browse files

use 16bit uint for msp430fr overflow counter

parent c03bff93
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
#include <stdint.h>

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) {}

+1 −1
Original line number Diff line number Diff line
@@ -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++;
		}
	}