Test code for interfacing to megasquirt ECU.

Dependencies:   jtlcd mbed

Revision:
0:cf99a7b873b3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Counter/Counter.h	Sat Feb 14 08:50:32 2015 +0000
@@ -0,0 +1,34 @@
+#ifndef COUNTER_
+#define COUNTER_
+
+#define DEBOUNCING_INTERVAL  200    //  Debouncing interval (in mili-seconds)
+/*=====================================================================================*/
+// Counter object, which also setups up irq
+/*=====================================================================================*/
+
+//from http://mbed.org/handbook/InterruptIn, modified to add debouncing
+class Counter
+{
+public:
+    Counter(PinName pin, void (*function)(void));
+
+void increment();
+
+int read();
+
+int set(int val);
+
+void reset();
+
+private:
+    InterruptIn _interrupt;
+    volatile int _count;
+    Timer             t;               //  To manage debounce by menchanical switch
+protected:
+    //the callback
+    FunctionPointer jim;
+};
+
+
+
+#endif