X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=tos%2Fchips%2Frf2xx%2Flayers%2FLowPowerListeningLayerP.nc;h=b965af8a4f61c159edae10bbdf1b112990bed615;hb=80947dbfb5b56d7b65bc51a4518b320643821ab3;hp=7efab6dc21311283ac63822f1cb1949b6f7cec5c;hpb=a8214d93267fc47a4edb5417f91f152bc505ea67;p=tinyos-2.x.git diff --git a/tos/chips/rf2xx/layers/LowPowerListeningLayerP.nc b/tos/chips/rf2xx/layers/LowPowerListeningLayerP.nc index 7efab6dc..b965af8a 100644 --- a/tos/chips/rf2xx/layers/LowPowerListeningLayerP.nc +++ b/tos/chips/rf2xx/layers/LowPowerListeningLayerP.nc @@ -48,6 +48,8 @@ module LowPowerListeningLayerP interface LowPowerListeningConfig as Config; interface Timer; interface SystemLowPowerListening; + + interface Leds; } } @@ -55,9 +57,6 @@ implementation { enum { - // minimum wakeup time to catch a transmission in milliseconds - LISTEN_WAKEUP = 6U, // use xxxL if LISTEN_WAKEUP * 10000 > 65535 - MIN_SLEEP = 2, // the minimum sleep interval in milliseconds }; @@ -108,7 +107,10 @@ implementation ASSERT( error == SUCCESS || error == EBUSY ); if( error == SUCCESS ) + { + call Leds.led2On(); ++state; + } else post transition(); } @@ -118,7 +120,10 @@ implementation ASSERT( error == SUCCESS || error == EBUSY ); if( error == SUCCESS ) + { ++state; + call Leds.led2Off(); + } else post transition(); } @@ -138,7 +143,7 @@ implementation { state = LISTEN; if( sleepInterval > 0 ) - call Timer.startOneShot(LISTEN_WAKEUP); + call Timer.startOneShot(call Config.getListenLength()); } else if( state == SLEEP_TIMER ) { @@ -158,7 +163,8 @@ implementation transmitInterval = call LowPowerListening.getRemoteWakeupInterval(txMsg); if( transmitInterval > 0 ) - call Timer.startOneShot(transmitInterval); + call Timer.startOneShot(transmitInterval + + 2 * call Config.getListenLength()); state = SEND_SUBSEND; post transition(); @@ -264,6 +270,8 @@ implementation event message_t* SubReceive.receive(message_t* msg) { + call Leds.led0Toggle(); + if( state == SLEEP_SUBSTOP ) state = LISTEN; @@ -341,6 +349,9 @@ implementation state = SEND_SUBSEND; post transition(); + + if( error == SUCCESS ) + call Leds.led1Toggle(); } /*----------------- LowPowerListening -----------------*/