Commit 2d49d59b authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

arduino-nano: change timer to new API

parent 51c4aca4
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -6,7 +6,8 @@ class Counter {
		Counter(const Counter &copy);

	public:
		uint8_t overflowed;
		uint16_t value;
		volatile uint8_t overflowed;

		Counter() : overflowed(0) {}

@@ -14,13 +15,13 @@ class Counter {
			overflowed = 0;
			TCNT1 = 0;
			TCCR1A = 0;
			TCCR1B = _BV(CS10);
			TCCR1B = _BV(CS10); // no prescaler
			TIMSK1 = _BV(TOIE1);
		}

		inline uint16_t stop() {
		inline void stop() {
			TCCR1B = 0;
			return TCNT1;
			value = TCNT1;
		}
};

+4 −0
Original line number Diff line number Diff line
#include "driver/counter.h"

#if defined(TIMER_S) || defined(WITH_LOOP)
#warn "timer/loop and counter are mutually exclusive. Expect odd behaviour."
#endif

Counter counter;

ISR(TIMER1_OVF_vect)