include/timer.h
changeset 1 04b8d469ae4c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/timer.h	Wed Sep 24 22:30:30 2014 +0300
@@ -0,0 +1,21 @@
+#ifndef QMSK_ARDUINO_TIMER_H
+#define QMSK_ARDUINO_TIMER_H
+
+#define TIMER_FLAGS     GPIOR0
+#define TIMER1_BUSY     1
+
+/*
+ * Setup timers.
+ */
+void timer_init (void);
+
+/*
+ * Sleep on timer1 interrupt.
+ *
+ * Starts fresh timer that sleeps given cycles if given, or continues on the running timer.
+ *
+ * Returns 1 on timeout, 0 on other interrupt.
+ */
+byte timer_sleep (unsigned cycles);
+
+#endif