[Tinyos-commits] CVS: tinyos-1.x/apps/TestDrip Makefile, NONE,
1.1 TestDrip.h, NONE, 1.1 TestDrip.nc, NONE, 1.1 TestDripM.nc,
NONE, 1.1
Gilman Tolle
gtolle at users.sourceforge.net
Tue Jan 31 09:02:17 PST 2006
Update of /cvsroot/tinyos/tinyos-1.x/apps/TestDrip
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6830
Added Files:
Makefile TestDrip.h TestDrip.nc TestDripM.nc
Log Message:
Import of missing TestDrip application.
--- NEW FILE: Makefile ---
COMPONENT=TestDrip
PFLAGS += -I%T/lib/Drip
include $(TOSDIR)/../apps/Makerules
--- NEW FILE: TestDrip.h ---
enum {
AM_TESTDRIPMSG = 254,
};
typedef struct TestDripMsg {
uint16_t data;
} TestDripMsg;
--- NEW FILE: TestDrip.nc ---
includes TestDrip;
configuration TestDrip {
}
implementation {
components
Main,
TestDripM,
DripC,
DripStateC,
TimerC,
LedsC as Leds;
Main.StdControl -> TestDripM;
Main.StdControl -> DripC;
Main.StdControl -> TimerC;
TestDripM.Leds -> Leds;
TestDripM.Timer -> TimerC.Timer[unique("Timer")];
TestDripM.ReceiveDrip -> DripC.Receive[AM_TESTDRIPMSG];
TestDripM.Drip -> DripC.Drip[AM_TESTDRIPMSG];
DripC.DripState[AM_TESTDRIPMSG] -> DripStateC.DripState[unique("DripState")];
}
--- NEW FILE: TestDripM.nc ---
module TestDripM {
provides interface StdControl;
uses {
interface Leds;
interface Timer;
interface Receive as ReceiveDrip;
interface Drip;
}
}
implementation {
uint16_t data;
command result_t StdControl.init() {
call Leds.init();
call Drip.init();
return SUCCESS;
}
command result_t StdControl.start() {
if (TOS_LOCAL_ADDRESS == 1) {
call Timer.start(TIMER_REPEAT, 2048);
}
return SUCCESS;
}
command result_t StdControl.stop() { return SUCCESS; }
event result_t Timer.fired() {
call Drip.change();
return SUCCESS;
}
event TOS_MsgPtr ReceiveDrip.receive(TOS_MsgPtr msg,
void* payload,
uint16_t payloadLen) {
TestDripMsg *tdMsg = (TestDripMsg*)payload;
data = tdMsg->data;
call Leds.redToggle();
return msg;
}
event result_t Drip.rebroadcastRequest(TOS_MsgPtr msg,
void *payload) {
TestDripMsg *tdMsg = (TestDripMsg*)payload;
tdMsg->data = data;
call Leds.greenToggle();
call Drip.rebroadcast(msg, payload, sizeof(TestDripMsg));
return SUCCESS;
}
}
More information about the Tinyos-commits
mailing list