Time (seconds) counter based on TimerSubscriber

Revision:
0:b72c7c2ee5f3
Child:
1:49c28e93d358
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TimeCounter.h	Wed Jun 04 22:36:51 2014 +0000
@@ -0,0 +1,30 @@
+#pragma once
+#include "mbed.h"
+#include "TimerSubscriber.h"
+
+/*-------------------------------------------------------------
+
+(c) W.D. 2014
+
+-------------------------------------------------------------*/
+
+/*  ------ sample usage------
+*/
+#define SAMPLES_TO_DEBOUNCE 64
+
+extern TimerSubscriber timer_user;
+
+class TimeCounter : TimerDependent
+{
+public:
+    TimeCounter();
+    virtual ~TimeCounter();
+    inline long int ReadSeconds(void){return ticks / TicksPerSecond;};
+    inline long int ReadTicks(void){return ticks;};
+    inline void SetSeconds(long int InSeconds){this->ticks = InSeconds * TicksPerSecond;};
+    virtual void TimerEvent(void);
+private:
+    long long int ticks;
+    int TicksPerSecond;
+};
+  
\ No newline at end of file