A set of classes that mimic the behaviour of Mbed Ticker class but using TIMER0, TIMER1, TIMER2 and the RIT.

Revision:
0:5c7fd96cf29a
Child:
1:e60d949ec09a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Tickers.cpp	Fri Feb 11 10:42:52 2011 +0000
@@ -0,0 +1,84 @@
+/*
+    Copyright (c) 2011 Andy Kirkham
+ 
+    Permission is hereby granted, free of charge, to any person obtaining a copy
+    of this software and associated documentation files (the "Software"), to deal
+    in the Software without restriction, including without limitation the rights
+    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+    copies of the Software, and to permit persons to whom the Software is
+    furnished to do so, subject to the following conditions:
+ 
+    The above copyright notice and this permission notice shall be included in
+    all copies or substantial portions of the Software.
+ 
+    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+    THE SOFTWARE.
+*/
+
+#include "Tickers.h"
+
+TickerA::TickerA() { 
+    counter = 0;
+    _ticker1Sys.addTicker(this);
+}
+
+TickerA::~TickerA() { 
+    _ticker1Sys.delTicker(this);
+}
+    
+void 
+TickerA::tick(void) {
+    if (counter) {
+        counter--;
+        if (counter == 0) {
+            counter = reload;
+            callback.call();
+        }        
+    }
+}
+
+TickerB::TickerB() { 
+    counter = 0;
+    _ticker2Sys.addTicker(this);
+}
+
+TickerB::~TickerB() { 
+    _ticker2Sys.delTicker(this);
+}
+    
+void 
+TickerB::tick(void) {
+    if (counter) {
+        counter--;
+        if (counter == 0) {
+            counter = reload;
+            callback.call();
+        }        
+    }
+}
+
+TickerC::TickerC() { 
+    counter = 0;
+    _tickerRSys.addTicker(this);
+}
+
+TickerC::~TickerC() { 
+    _tickerRSys.delTicker(this);
+}
+    
+void 
+TickerC::tick(void) {
+    if (counter) {
+        counter--;
+        if (counter == 0) {
+            counter = reload;
+            callback.call();
+        }        
+    }
+}
+