From 2e98ba8cf4f4b07d74f802a2fa536243b3e77f56 Mon Sep 17 00:00:00 2001 From: idgay Date: Mon, 26 Mar 2007 21:46:01 +0000 Subject: [PATCH] wrap around support --- tos/chips/atm128/timer/Atm128AlarmAsyncP.nc | 25 ++++----------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/tos/chips/atm128/timer/Atm128AlarmAsyncP.nc b/tos/chips/atm128/timer/Atm128AlarmAsyncP.nc index 5aff0a88..29f90147 100644 --- a/tos/chips/atm128/timer/Atm128AlarmAsyncP.nc +++ b/tos/chips/atm128/timer/Atm128AlarmAsyncP.nc @@ -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; } -- 2.39.2