Mark Gottscho / HardwareTimersLib

Fork of HardwareTimersLib by Mark Gottscho

Revision:
2:5056ec8c52e8
Child:
3:dd54446143ee
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Timer_PIT.h	Sun Mar 09 03:02:55 2014 +0000
@@ -0,0 +1,43 @@
+/* Timer_PIT.h
+ * Tested with mbed board: FRDM-KL46Z
+ * Author: Mark Gottscho
+ * mgottscho@ucla.edu
+ */
+
+#ifndef TIMER_PIT_H
+#define TIMER_PIT_H
+
+#include "mbed.h"
+#include "HardwareTimer.h"
+#include "PreciseTime.h"
+
+/**
+ * Base class for PIT timing on the FRDM-KL46Z.
+ */
+class Timer_PIT : public HardwareTimer {
+    public:
+        Timer_PIT(float tickValue);
+        ~Timer_PIT();
+        virtual void enableTimer() = 0;
+        virtual void disableTimer();
+        virtual PreciseTime getTime() = 0;
+        virtual uint32_t getTick();
+    
+    protected:        
+        /**
+         * Sets the hardware PIT timer.
+         * @param count raw value to load into the timer
+         */
+        static void __set_pit(uint32_t count);
+        
+        /**
+         * Interrupt service routine for pit hardware timer.
+         */
+        static void __isr_pit();
+                
+        static bool __initialized_pit;
+        static uint16_t __rolloverValue;
+        static uint32_t __count;
+};
+
+#endif
\ No newline at end of file