[Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/harvard/spaulding/src/driver DriverC.nc, 1.1.1.1, 1.2 DriverM.nc, 1.2, 1.3
Konrad Lorincz
konradlorincz at users.sourceforge.net
Tue Sep 23 16:23:16 PDT 2008
Update of /cvsroot/tinyos/tinyos-1.x/contrib/harvard/spaulding/src/driver
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv19487/src/driver
Modified Files:
DriverC.nc DriverM.nc
Log Message:
Index: DriverC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/harvard/spaulding/src/driver/DriverC.nc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** DriverC.nc 22 Aug 2007 00:43:53 -0000 1.1.1.1
--- DriverC.nc 23 Sep 2008 23:23:14 -0000 1.2
***************
*** 70,73 ****
--- 70,76 ----
DriverM.LocalTime -> TimerC; // Available on MSP430
DriverM.Timer_Heartbeat -> TimerC.Timer[unique("Timer")];
+ DriverM.Timer_MoteTurnedOn -> TimerC.Timer[unique("Timer")];
+ DriverM.Timer_DataCollection -> TimerC.Timer[unique("Timer")];
+ DriverM.Timer_StopDataCollection -> TimerC.Timer[unique("Timer")];
DriverM.GlobalTime -> TimeSyncC;
DriverM.Sampling -> SamplingC;
Index: DriverM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/harvard/spaulding/src/driver/DriverM.nc,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DriverM.nc 12 Dec 2007 20:44:08 -0000 1.2
--- DriverM.nc 23 Sep 2008 23:23:14 -0000 1.3
***************
*** 51,54 ****
--- 51,57 ----
uses interface LocalTime;
uses interface Timer as Timer_Heartbeat;
+ uses interface Timer as Timer_MoteTurnedOn;
+ uses interface Timer as Timer_DataCollection;
+ uses interface Timer as Timer_StopDataCollection;
uses interface SendMsg;
uses interface ReceiveMsg;
***************
*** 105,108 ****
--- 108,112 ----
#endif
call Timer_Heartbeat.start(TIMER_REPEAT, HEARTBEAT_PERIOD);
+ call Timer_MoteTurnedOn.start(TIMER_REPEAT, 500);
return result;
}
***************
*** 193,196 ****
--- 197,249 ----
}
+ event result_t Timer_MoteTurnedOn.fired()
+ {
+ static uint8_t cntFired = 0;
+
+ if (++cntFired <= 5)
+ call Leds.greenToggle();
+ else {
+ call Leds.greenOff();
+ call Timer_MoteTurnedOn.stop();
+ cntFired = 0;
+ }
+
+ return SUCCESS;
+ }
+
+ event result_t Timer_DataCollection.fired()
+ {
+ static bool isLedOff = TRUE;
+
+ if (isLedOff == TRUE) {
+ call Leds.orangeOn();
+ isLedOff = FALSE;
+ call Timer_DataCollection.start(TIMER_ONE_SHOT, 100);
+ }
+ else {
+ call Leds.orangeOff();
+ isLedOff = TRUE;
+ call Timer_DataCollection.start(TIMER_ONE_SHOT, 10240);
+ }
+
+ return SUCCESS;
+ }
+
+ event result_t Timer_StopDataCollection.fired()
+ {
+ static uint8_t cntFired = 0;
+
+ if (++cntFired <= 5)
+ call Leds.orangeToggle();
+ else {
+ call Leds.orangeOff();
+ call Timer_StopDataCollection.stop();
+ cntFired = 0; // incase we restart data collection
+ }
+
+ return SUCCESS;
+ }
+
+
task void handleRecvMsg()
{
***************
*** 207,212 ****
if (call Sampling.isSampling() == TRUE) { // already sampling, so do nothing
}
! else
call Sampling.startSampling(MERCURY_CHANS, MERCURY_NBR_CHANS, MERCURY_SAMPLING_RATE);
}
else if (requestMsgPtr->type == REQUESTMSG_TYPE_STOPSAMPLING) {
--- 260,267 ----
if (call Sampling.isSampling() == TRUE) { // already sampling, so do nothing
}
! else {
call Sampling.startSampling(MERCURY_CHANS, MERCURY_NBR_CHANS, MERCURY_SAMPLING_RATE);
+ call Timer_DataCollection.start(TIMER_ONE_SHOT, 10);
+ }
}
else if (requestMsgPtr->type == REQUESTMSG_TYPE_STOPSAMPLING) {
***************
*** 214,217 ****
--- 269,275 ----
call Sampling.stopSampling();
call DataStore.saveInfo();
+ call Timer_DataCollection.stop();
+ call Leds.orangeOff();
+ call Timer_StopDataCollection.start(TIMER_REPEAT, 500);
}
else { // already stopped, so do nothing
More information about the Tinyos-contrib-commits
mailing list