Alarm library for use with mbed.

Revision:
1:f4c7f13e5553
Parent:
0:33dddd0644c5
Child:
2:23e65cacea5a
--- a/AlarmTimeDate.cpp	Sat Oct 30 23:41:22 2010 +0000
+++ b/AlarmTimeDate.cpp	Sun Oct 31 08:13:17 2010 +0000
@@ -182,6 +182,7 @@
 }
 
 void AlarmTimeDate::Expire() {
+    iFn(iPtr);
     struct tm * sectm;
     switch (Repeat()) {
         case EDaily:
@@ -214,8 +215,6 @@
         default:
             iTime = 0;
     }
-    printf( "Calling %x\n",iFn);
-    iFn(iPtr);
 }
 
 void AlarmTimeDate::Init() {
@@ -231,6 +230,7 @@
 }
 
 void AlarmTimeDate::Tick(SleepFn aFn,void* aParam) {
+    if (aFn) aFn(aParam); // sleep first
     AlarmTimeDate* p = list;
     AlarmTimeDate* toSet = NULL;
     time_t seconds = time(NULL);
@@ -258,5 +258,4 @@
     if (toSet) {
         toSet->Set();
     }
-    if (aFn) aFn(aParam);
 }