[Tinyos-beta-commits]
CVS: tinyos-1.x/beta/Drain/TestDrain Makefile, NONE,
1.1 TestDrain.h, NONE, 1.1 TestDrain.nc, NONE,
1.1 TestDrainM.nc, NONE, 1.1
Gilman Tolle
gtolle at users.sourceforge.net
Mon Feb 14 15:16:39 PST 2005
- Previous message: [Tinyos-beta-commits] CVS: tinyos-1.x/beta/Drain Drain.h, NONE,
1.1 DrainC.nc, NONE, 1.1 DrainLinkEst.nc, NONE,
1.1 DrainLinkEstM.nc, NONE, 1.1 DrainM.nc, NONE, 1.1
- Next message: [Tinyos-beta-commits]
CVS: tinyos-1.x/beta/TOSSIM-CC2420 AM.h, NONE,
1.1 HPLCC2420C.nc, NONE, 1.1 HPLCC2420M.nc, NONE,
1.1 README.txt, NONE, 1.1 hardware.c, NONE,
1.1 hardware.nido.h, NONE, 1.1 platforms.properties, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-1.x/beta/Drain/TestDrain
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13285/TestDrain
Added Files:
Makefile TestDrain.h TestDrain.nc TestDrainM.nc
Log Message:
First checkin of Drain -- untested
--- NEW FILE: Makefile ---
COMPONENT=TestDrain
PFLAGS += -I$(TOSDIR)/../beta/Drain
PFLAGS += -I$(TOSDIR)/../contrib/nucleus/tos/lib/Nucleus
include $(TOSDIR)/../apps/Makerules
--- NEW FILE: TestDrain.h ---
enum {
AM_TESTDRAINMSG = 254,
TESTDRAIN_SEND_PERIOD = 1000,
};
typedef struct TestDrainMsg {
uint16_t data;
} TestDrainMsg;
--- NEW FILE: TestDrain.nc ---
includes TestDrain;
configuration TestDrain {
}
implementation {
components
Main,
TestDrainM,
DrainC,
TimerC,
RandomLFSR,
LedsC as Leds;
Main.StdControl -> DrainC;
Main.StdControl -> TestDrainM;
TestDrainM.Leds -> Leds;
TestDrainM.Send -> DrainC.Send[AM_TESTDRAINMSG];
TestDrainM.Timer -> TimerC.Timer[unique("Timer")];
TestDrainM.Random -> RandomLFSR;
}
--- NEW FILE: TestDrainM.nc ---
module TestDrainM {
provides interface StdControl;
uses {
interface Leds;
interface Send;
interface Timer;
interface Random;
}
}
implementation {
TOS_Msg msgBuf;
bool msgBufBusy;
uint16_t counter;
uint16_t sendPeriod;
command result_t StdControl.init() {
sendPeriod = TESTDRAIN_SEND_PERIOD;
counter = 0;
msgBufBusy = FALSE;
return SUCCESS;
}
command result_t StdControl.start() {
call Timer.start(TIMER_ONE_SHOT,
(call Random.rand() % sendPeriod) + 1);
return SUCCESS;
}
command result_t StdControl.stop() {
call Timer.stop();
return SUCCESS;
}
event result_t Timer.fired() {
uint16_t length;
TestDrainMsg* testMHMsg =
(TestDrainMsg*) call Send.getBuffer(&msgBuf, &length);
call Leds.redOn();
call Timer.start(TIMER_ONE_SHOT, sendPeriod);
if (msgBufBusy) {
return SUCCESS;
} else {
msgBufBusy = TRUE;
}
testMHMsg->data = counter;
if (call Send.send(&msgBuf, sizeof(TestDrainMsg)) == FAIL) {
call Leds.yellowToggle();
msgBufBusy = FALSE;
}
return SUCCESS;
}
event result_t Send.sendDone(TOS_MsgPtr msg, result_t success) {
dbg(DBG_USR1, "sendDone(msg=0x%x,success=%d)\n",
msg, success);
if (msg == &msgBuf) {
msgBufBusy = FALSE;
if (success)
call Leds.redOff();
else
call Leds.greenToggle();
}
counter++;
return SUCCESS;
}
}
- Previous message: [Tinyos-beta-commits] CVS: tinyos-1.x/beta/Drain Drain.h, NONE,
1.1 DrainC.nc, NONE, 1.1 DrainLinkEst.nc, NONE,
1.1 DrainLinkEstM.nc, NONE, 1.1 DrainM.nc, NONE, 1.1
- Next message: [Tinyos-beta-commits]
CVS: tinyos-1.x/beta/TOSSIM-CC2420 AM.h, NONE,
1.1 HPLCC2420C.nc, NONE, 1.1 HPLCC2420M.nc, NONE,
1.1 README.txt, NONE, 1.1 hardware.c, NONE,
1.1 hardware.nido.h, NONE, 1.1 platforms.properties, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-beta-commits
mailing list