Update of /cvsroot/firebug/mts400/apps/TestSwitch
In directory sc8-pr-cvs1:/tmp/cvs-serv2229/apps/TestSwitch
Added Files:
switchtest.nc switchtestM.nc
Log Message:
Instrumenting the mica switch and adding
test programs to monitor control of flow.
--- NEW FILE: switchtest.nc ---
/* -*- Mode: C; c-basic-indent: 3; indent-tabs-mode: nil -*- */
/**
* Test and example code for the weatherboard i2c
* switches.
*/
includes sensorboard;
configuration switchtest {
}
implementation {
components Main,
switchtestM,
LedsC,
MicaWbSwitch;
Main.StdControl -> switchtestM.StdControl;
Main.StdControl -> MicaWbSwitch.StdControl;
switchtestM.Leds -> LedsC;
switchtestM.PowerSwitch -> MicaWbSwitch.Switch[0];
//switchtestM.IOSwitch -> MicaWbSwitch.Switch[1];
}
--- NEW FILE: switchtestM.nc ---
/* -*- Mode: C; c-basic-indent: 3; indent-tabs-mode: nil -*- */
module switchtestM {
provides {
interface StdControl;
}
uses {
interface Leds;
interface StdControl as SwitchControl;
interface Switch as PowerSwitch;
//interface Switch as IOSwitch;
}
}
implementation {
#include "SODebug.h"
/**
* Initialize the component and its subcomponents.
*
* @return Whether initialization was successful.
*/
command result_t StdControl.init() {
init_debug();
SODbg(DBG_USR2, "switchtestM.StdControl.init()\n");
//call StdControl.start();
return SUCCESS;
}
/**
* Start the component and its subcomponents.
*
* @return Whether starting was successful.
*/
command result_t StdControl.start() {
result_t result;
call Leds.redOn();
SODbg(DBG_USR2, "switchtestM.StdControl.start()\n");
result = call PowerSwitch.set(MICAWB_GPS_POWER,0);
return SUCCESS;
}
/**
* Stop the component and pertinent subcomponents (not all
* subcomponents may be turned off due to wakeup timers, etc.).
*
* @return Whether stopping was successful.
*/
command result_t StdControl.stop() {
call Leds.redOff();
SODbg(DBG_USR2, "switchtestM.StdControl.stop()\n");
return SUCCESS;
}
event result_t PowerSwitch.setDone(bool result) {
signal PowerSwitch.getDone(1);
SODbg(DBG_USR2, "switchtestM.PowerSwitch.setDone()\n");
return SUCCESS;
}
event result_t PowerSwitch.setAllDone(bool result) {
SODbg(DBG_USR2, "switchtestM.PowerSwitch.setAllDone()\n");
return SUCCESS;
}
event result_t PowerSwitch.getDone(char value) {
SODbg(DBG_USR2, "switchtestM.PowerSwitch.getDone()\n");
return SUCCESS;
}
}
|