]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
wrap around support
authoridgay <idgay>
Mon, 26 Mar 2007 21:46:01 +0000 (21:46 +0000)
committeridgay <idgay>
Mon, 26 Mar 2007 21:46:01 +0000 (21:46 +0000)
tos/chips/atm128/timer/Atm128AlarmAsyncP.nc

index 5aff0a8844a9d23e218f605a601975e016f90a5e..29f90147f8dbda2676783b145113cf526c872fd6 100644 (file)
@@ -14,16 +14,10 @@ implementation
 {
   uint8_t set;
   uint32_t t0, dt;
-  uint32_t base, lastNow;
-
-  void oopsT0() {
-  }
-
-  void oopsNow() {
-  }
+  uint32_t base;
 
   enum {
-    MINDT = 10,
+    MINDT = 2,
     MAXT = 230
   };
 
@@ -50,12 +44,8 @@ implementation
        else
          {
            uint32_t now = call Counter.get();
-           if (now < t0) 
-             {
-               oopsT0();
-               t0 = now;
-             }
-           if (now - t0 >= dt)
+
+           if ((uint32_t)(now - t0) >= dt)
              {
                set = FALSE;
                fired = TRUE;
@@ -112,13 +102,6 @@ implementation
          now = base + call Counter.get() + call Timer.get();
        else
          now = base + now8;
-
-       if (now < lastNow)
-         {
-           oopsNow();
-           now = lastNow;
-         }
-       lastNow = now;
       }
     return now;
   }