[Firebug-cvs] firebug/project/src/multihop CollectDataFB.nc,1.2,1.3 CollectDataMFB.nc,1.5,1.6
Brought to you by:
doolin
From: <do...@us...> - 2003-05-23 14:58:32
|
Update of /cvsroot/firebug/firebug/project/src/multihop In directory sc8-pr-cvs1:/tmp/cvs-serv32007 Modified Files: CollectDataFB.nc CollectDataMFB.nc Log Message: Added random number capability to collectdata for testing purposes. Index: CollectDataFB.nc =================================================================== RCS file: /cvsroot/firebug/firebug/project/src/multihop/CollectDataFB.nc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CollectDataFB.nc 19 May 2003 07:06:46 -0000 1.2 --- CollectDataFB.nc 23 May 2003 14:58:27 -0000 1.3 *************** *** 1,34 **** ! /* -*- Mode: C; c-basic-indent: 3; indent-tabs-mode: nil -*- */ ! ! ! /** ! * Author: Terence Tong, Alec Woo, Max Min Chen ! */ ! ! ! includes RoutingStackShared; ! ! configuration CollectDataFB { ! ! } ! ! ! implementation { ! ! components Main, ! CollectDataMFB, ! MHDispatcher, ! TimerWrapper, ! LedsC, ! BcastCommand; ! ! ! ! Main.StdControl -> CollectDataMFB.StdControl; ! ! CollectDataMFB.MultiHopSend -> MHDispatcher.MultiHopSend[unique("MHDispathcer")]; ! CollectDataMFB.Timer -> TimerWrapper.Timer[unique("Timer")]; ! CollectDataMFB.Leds -> LedsC; ! CollectDataMFB.HandleBcast -> BcastCommand.HandleBcast; ! ! } --- 1,36 ---- ! /* -*- Mode: C; c-basic-indent: 3; indent-tabs-mode: nil -*- */ ! ! ! /** ! * Author: Terence Tong, Alec Woo, Max Min Chen ! */ ! ! ! includes RoutingStackShared; ! ! configuration CollectDataFB { ! ! } ! ! ! implementation { ! ! components Main, ! CollectDataMFB, ! MHDispatcher, ! TimerWrapper, ! LedsC, ! BcastCommand, ! RandomLFSR; ! ! ! ! Main.StdControl -> CollectDataMFB.StdControl; ! ! CollectDataMFB.MultiHopSend -> MHDispatcher.MultiHopSend[unique("MHDispathcer")]; ! CollectDataMFB.Timer -> TimerWrapper.Timer[unique("Timer")]; ! CollectDataMFB.Leds -> LedsC; ! CollectDataMFB.HandleBcast -> BcastCommand.HandleBcast; ! CollectDataMFB.Random -> RandomLFSR; ! ! } Index: CollectDataMFB.nc =================================================================== RCS file: /cvsroot/firebug/firebug/project/src/multihop/CollectDataMFB.nc,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** CollectDataMFB.nc 23 May 2003 00:57:14 -0000 1.5 --- CollectDataMFB.nc 23 May 2003 14:58:27 -0000 1.6 *************** *** 1,3 **** ! /* -*- Mode: C; c-basic-indent: 3; indent-tabs-mode: nil -*- */ /** --- 1,3 ---- ! /* -*- Mode: C; c-basic-indent: 3; indent-tabs-mode: nil; font-lock-mode: t -*- */ /** *************** *** 19,22 **** --- 19,29 ---- includes Routing; + + /** max int is 2^16 for the lfsr random + * number generation scheme used in tinyos. + */ + #define FB_RAND_MAX 256*256 + + module CollectDataMFB { *************** *** 32,35 **** --- 39,43 ---- interface Leds; interface HandleBcast; + interface Random; } *************** *** 79,90 **** float get_temp() { ! #if 0 ! int randnum; ! int max = RAND_MAX; float x1,x2,w,y1,y2; do { ! x1 = (2*(rand()/max)) - 1; ! x2 = (2*(rand()/max)) - 1; w = x1*x1 + x2*x2; } while (w >= 1.0); --- 87,96 ---- float get_temp() { ! //#if 0 float x1,x2,w,y1,y2; do { ! x1 = (2*((call Random.rand())/FB_RAND_MAX)) - 1; ! x2 = (2*((call Random.rand())/FB_RAND_MAX)) - 1; w = x1*x1 + x2*x2; } while (w >= 1.0); *************** *** 93,97 **** y1 = x1*w; y2 = x2*w; ! #endif return 72.1; --- 99,103 ---- y1 = x1*w; y2 = x2*w; ! //#endif return 72.1; |