[Firebug-cvs] firebug/project/src/FireBase .cvsignore,NONE,1.1 FireBase.nc,NONE,1.1 FireBaseM.nc,NON
Brought to you by:
doolin
From: <do...@us...> - 2003-12-17 13:06:58
|
Update of /cvsroot/firebug/firebug/project/src/FireBase In directory sc8-pr-cvs1:/tmp/cvs-serv4064 Added Files: .cvsignore FireBase.nc FireBaseM.nc Makefile Log Message: Added files for firebase. --- NEW FILE: .cvsignore --- build --- NEW FILE: FireBase.nc --- /* -*- Mode: C; c-basic-indent: 3; indent-tabs-mode: nil -*- */ /** * @author Terence Tong * @author Alec Woo * @author Max Min Chen * @author David M. Doolin */ includes RoutingStack; configuration FireBase { } implementation { components Main, FireBaseM, MHSender, TimerWrapper, LedsC, VirtualComm, ParentSelection; Main.StdControl -> FireBaseM.StdControl; Main.StdControl -> MHSender.StdControl; FireBaseM.MultiHopSend -> MHSender.MultiHopSend[RS_DATA_TYPE]; FireBaseM.Timer -> TimerWrapper.Timer[unique("Timer")]; FireBaseM.Leds -> LedsC; ParentSelection.InForwardReceive -> VirtualComm.ReceiveMsg[RS_DATA_TYPE]; } --- NEW FILE: FireBaseM.nc --- /* -*- Mode: C; c-basic-indent: 3; indent-tabs-mode: nil -*- */ /** * This is an example of a general application using * the Routing Stack to send message to * basestation. It store a message in its frame, call * getUsablePortion to get the right location * to add in its own data. passed the data down the * stack with the send command. A Send done * command will come back. A recommended way to send * another message is to have a one shot * Time. When the clock fired, we make another attempt to send again * * @author Terence Tong * @author Alec Woo * @author Max Min Chen * @author David M. Doolin */ includes RoutingStack; module FireBaseM { provides { interface StdControl; } uses { interface Send as MultiHopSend; interface Timer as Timer; interface Leds; } } #define DATA_FREQ 3000 implementation { TOS_Msg msgToSend; struct DataFormat_t { uint8_t addr; uint8_t cnt; uint8_t sampledata; }; uint8_t counter; uint8_t sending; command result_t StdControl.init() { return SUCCESS; } command result_t StdControl.start() { int i; counter = 0; for (i = 0; i < 29; i++) { msgToSend.data[i] = 0; } //call Timer.start(TIMER_REPEAT, DATA_FREQ); return SUCCESS; } command result_t StdControl.stop() { return SUCCESS; } /*////////////////////////////////////////////////////////*/ /** * When the clock fired we are ready to send, collectdata ask the stack * where in the data payload we can safely put our data. We then call * Multihop passed the pointer down the stack * @author: terence * @param: void * @return: always return success */ event result_t Timer.fired() { uint8_t result; // struct DataFormat_t *dataPortion; uint8_t *dataPortion; uint16_t availableLength = 0; struct DataFormat_t *df; if (sending == 1) return SUCCESS; dataPortion = call MultiHopSend.getBuffer(&msgToSend, &availableLength); df = (struct DataFormat_t *) dataPortion; df->addr = TOS_LOCAL_ADDRESS; df->cnt = counter++; df->sampledata=1; sending = 1; result = call MultiHopSend.send(&msgToSend, sizeof(struct DataFormat_t)); return SUCCESS; } /** * When a message is sent, send done event is trigger. We then schedule the * time to generate another message to send * * @author: terence * @param: void * @return: void */ event result_t MultiHopSend.sendDone(TOS_MsgPtr msg, uint8_t success) { sending = 0; return SUCCESS; } } --- NEW FILE: Makefile --- COMPONENT=FireBase SENSORBOARD=leadtek9546 include ../Makelocal include $(TOSROOT)/apps/Makerules |