[Firebug-cvs] fireboard/fireboard/sensors/intersema5534ap Intersema.nc,1.3,1.4 IntersemaLower.nc,1.3
Brought to you by:
doolin
Update of /cvsroot/firebug/fireboard/fireboard/sensors/intersema5534ap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17017/intersema5534ap Modified Files: Intersema.nc IntersemaLower.nc IntersemaLowerM.nc IntersemaM.nc IntersemaPressure.nc IntersemaPressureM.nc intersema_5534ap.h Log Message: Changed to HLSensor. Index: IntersemaPressure.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/fireboard/sensors/intersema5534ap/IntersemaPressure.nc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IntersemaPressure.nc 3 Feb 2004 20:06:44 -0000 1.2 --- IntersemaPressure.nc 26 Mar 2004 00:39:27 -0000 1.3 *************** *** 63,67 **** * Authors: Joe Polastre * - * $Id$ */ --- 63,66 ---- Index: IntersemaLower.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/fireboard/sensors/intersema5534ap/IntersemaLower.nc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** IntersemaLower.nc 3 Feb 2004 20:06:44 -0000 1.3 --- IntersemaLower.nc 26 Mar 2004 00:39:27 -0000 1.4 *************** *** 31,35 **** * Authors: Joe Polastre * - * $Id$ */ --- 31,34 ---- Index: IntersemaPressureM.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/fireboard/sensors/intersema5534ap/IntersemaPressureM.nc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IntersemaPressureM.nc 3 Feb 2004 20:06:44 -0000 1.2 --- IntersemaPressureM.nc 26 Mar 2004 00:39:27 -0000 1.3 *************** *** 1,3 **** - /* -*- Mode: C; c-basic-indent: 3; indent-tabs-mode: nil -*- */ --- 1,2 ---- *************** *** 6,10 **** * Authors: Joe Polastre * - * $Id$ */ --- 5,8 ---- *************** *** 74,78 **** ! /** The #define'd MICAWB_PRESSURE_* are in sensorboard.h. * iostate is IOON = 1, IOOF = 0. Somehow, this is --- 72,76 ---- ! #if 1 /** The #define'd MICAWB_PRESSURE_* are in sensorboard.h. * iostate is IOON = 1, IOOF = 0. Somehow, this is *************** *** 84,98 **** --- 82,102 ---- state = SWITCH_IO1; + atomic { call IOSwitch.set(MICAWB_PRESSURE_SCLK, iostate); } + } else if (state == SWITCH_IO1) { SODbg(DBG_USR2, "IntersemaPressure.IoBus.SCLK switch set \n"); state = SWITCH_IO2; + atomic { call IOSwitch.set(MICAWB_PRESSURE_DIN, iostate); } + } else if (state == SWITCH_IO2) { SODbg(DBG_USR2, "IntersemaPressure.IoBus.Din switch set \n"); state = SWITCH_IO3; + atomic { call IOSwitch.set(MICAWB_PRESSURE_DOUT, iostate); + } } else if (state == SWITCH_IO3) { *************** *** 120,124 **** } ! command result_t SplitControl.init() { --- 124,128 ---- } ! #endif command result_t SplitControl.init() { *************** *** 234,237 **** --- 238,245 ---- + task void startLowerTemp() { + call LowerControl.start(); + call LowerTemp.getData(); + } /****************************************************************************** *************** *** 242,247 **** { state = BUSY; ! call LowerControl.start(); ! call LowerTemp.getData(); return SUCCESS; } --- 250,257 ---- { state = BUSY; ! ! //call LowerControl.start(); ! //call LowerTemp.getData(); ! post startLowerTemp(); return SUCCESS; } *************** *** 258,261 **** --- 268,278 ---- } + + task void startLowerPressure() { + + call LowerControl.start(); + call LowerPressure.getData(); + } + async command result_t Pressure.getData() { *************** *** 267,272 **** iostate = IOON; } ! call LowerControl.start(); ! call LowerPressure.getData(); return SUCCESS; } --- 284,290 ---- iostate = IOON; } ! //call LowerControl.start(); ! //call LowerPressure.getData(); ! post startLowerPressure(); return SUCCESS; } *************** *** 340,344 **** } - } --- 358,361 ---- Index: IntersemaM.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/fireboard/sensors/intersema5534ap/IntersemaM.nc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IntersemaM.nc 22 Jan 2004 00:40:06 -0000 1.2 --- IntersemaM.nc 26 Mar 2004 00:39:27 -0000 1.3 *************** *** 1,3 **** ! /* -*- Mode: C; c-basic-indent: 3; indent-tabs-mode: nil -*- */ --- 1,3 ---- ! *************** *** 38,42 **** provides { interface StdControl; ! interface Sensor; } --- 38,42 ---- provides { interface StdControl; ! interface HLSensor; } *************** *** 105,108 **** --- 105,114 ---- } + task void signalDataReady() { + + signal HLSensor.dataReady(&data_msg); + } + + /****************************************************************************** * Intersema MS5534A barometric pressure/temperature sensor *************** *** 141,145 **** data_msg.baro_pres = Press; ! signal Sensor.dataReady(&data_msg); SODbg(DBG_USR2, "Pressure: Temp(adc): %i Press(adc): %i Temp(degCx10): %i Press(mbar): %i \n", --- 147,151 ---- data_msg.baro_pres = Press; ! post signalDataReady(); SODbg(DBG_USR2, "Pressure: Temp(adc): %i Press(adc): %i Temp(degCx10): %i Press(mbar): %i \n", *************** *** 206,262 **** } /////////////////////////////////////////////////////////// ! command result_t Sensor.powerOn() { call PressureControl.start(); return SUCCESS; } ! default event result_t Sensor.powerOnDone() { return SUCCESS; } ! command result_t Sensor.init() { call PressureControl.init(); return SUCCESS; } ! command result_t Sensor.powerOff() { ! signal Sensor.powerOffDone(); return SUCCESS; } ! default event result_t Sensor.powerOffDone() { return SUCCESS; } ! command result_t Sensor.setSamplingInterval(uint16_t sampling_rate) { return SUCCESS; } ! command result_t Sensor.getSamplingInterval(uint16_t sampling_rate) { return SUCCESS; } ! command result_t Sensor.startSampling() { call Timer.start(TIMER_REPEAT, 1500); return SUCCESS; } ! command result_t Sensor.stopSampling() { return SUCCESS; } ! command result_t Sensor.sampleOnce() { return SUCCESS; } ! default event result_t Sensor.dataReady(void * userdata) { return SUCCESS; } ! command result_t Sensor.loadProgram(uint8_t * program) { return SUCCESS; } ! async default event result_t Sensor.error(uint16_t error_code) { return SUCCESS; } --- 212,268 ---- } /////////////////////////////////////////////////////////// ! command result_t HLSensor.powerOn(uint8_t power_level) { call PressureControl.start(); return SUCCESS; } ! default event result_t HLSensor.powerOnDone() { return SUCCESS; } ! command result_t HLSensor.init() { call PressureControl.init(); return SUCCESS; } ! command result_t HLSensor.powerOff() { ! signal HLSensor.powerOffDone(); return SUCCESS; } ! default event result_t HLSensor.powerOffDone() { return SUCCESS; } ! command result_t HLSensor.setSamplingInterval(uint16_t sampling_rate) { return SUCCESS; } ! command result_t HLSensor.getSamplingInterval(uint16_t sampling_rate) { return SUCCESS; } ! command result_t HLSensor.startSampling() { call Timer.start(TIMER_REPEAT, 1500); return SUCCESS; } ! command result_t HLSensor.stopSampling() { return SUCCESS; } ! command result_t HLSensor.sampleOnce() { return SUCCESS; } ! default event result_t HLSensor.dataReady(void * userdata) { return SUCCESS; } ! command result_t HLSensor.loadProgram(uint8_t * program,uint8_t length) { return SUCCESS; } ! async default event result_t HLSensor.error(uint16_t error_code) { return SUCCESS; } Index: Intersema.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/fireboard/sensors/intersema5534ap/Intersema.nc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Intersema.nc 22 Jan 2004 00:40:06 -0000 1.3 --- Intersema.nc 26 Mar 2004 00:39:27 -0000 1.4 *************** *** 1,3 **** ! /* -*- Mode: C; c-basic-indent: 3; indent-tabs-mode: nil -*- */ --- 1,3 ---- ! *************** *** 70,74 **** provides { interface StdControl; ! interface Sensor; } } --- 70,74 ---- provides { interface StdControl; ! interface HLSensor; } } *************** *** 84,88 **** IntersemaM.StdControl = StdControl; ! Sensor = IntersemaM; StdControl = TimerC; --- 84,88 ---- IntersemaM.StdControl = StdControl; ! HLSensor = IntersemaM; StdControl = TimerC; Index: IntersemaLowerM.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/fireboard/sensors/intersema5534ap/IntersemaLowerM.nc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IntersemaLowerM.nc 3 Feb 2004 20:06:44 -0000 1.2 --- IntersemaLowerM.nc 26 Mar 2004 00:39:27 -0000 1.3 *************** *** 1,5 **** - /* -*- Mode: C; c-basic-indent: 3; indent-tabs-mode: nil -*- */ - - /* tab:4 * --- 1,2 ---- *************** *** 66,70 **** * Authors: Joe Polastre * - * $Id$ */ --- 63,66 ---- *************** *** 90,96 **** enum { IDLE=7, RESET=8, CALIBRATE=9, TEMP=10, PRESSURE=11, DATA_READY=12 }; ! //FIXME: Remove the norace and fix the rest of the atomic r/w warnings norace char state; ! norace char sensor; uint16_t calibration[4]; --- 86,92 ---- enum { IDLE=7, RESET=8, CALIBRATE=9, TEMP=10, PRESSURE=11, DATA_READY=12 }; ! norace char state; ! char sensor; uint16_t calibration[4]; *************** *** 239,242 **** --- 235,240 ---- write_bit(TRUE); } + + atomic { if (sensor == PRESSURE) { write_bit(TRUE); *************** *** 251,254 **** --- 249,254 ---- write_bit(TRUE); } + } + for (i = 0; i < 5; i++) { write_bit(FALSE); *************** *** 273,276 **** --- 273,277 ---- if (timeout > PRESSURE_TIMEOUT_TRIES) { + atomic { if ((sensor == PRESSURE) && (presserror == TRUE)) { errornum = 1; *************** *** 278,282 **** state = IDLE; post signalPressError(); ! return SUCCESS; } else if ((sensor == TEMP) && (temperror == TRUE)) { --- 279,283 ---- state = IDLE; post signalPressError(); ! //return SUCCESS; } else if ((sensor == TEMP) && (temperror == TRUE)) { *************** *** 285,292 **** state = IDLE; post signalTempError(); return SUCCESS; } - - } call Timer.start(TIMER_ONE_SHOT, 20); } --- 286,294 ---- state = IDLE; post signalTempError(); + //return SUCCESS; + } + } return SUCCESS; } call Timer.start(TIMER_ONE_SHOT, 20); } *************** *** 302,305 **** --- 304,309 ---- } + + task void SPITask() { char i; *************** *** 308,311 **** --- 312,316 ---- // if calibration is on, grab the calibration data + atomic { if (sensor == CALIBRATE) { *************** *** 320,328 **** // send the calibration data up to the application ! for (i = 0; i < 4; i++) signal Calibration.dataReady(i+1, calibration[(int)i]); - return; } ! else { // reset the device spi_reset(); --- 325,333 ---- // send the calibration data up to the application ! for (i = 0; i < 4; i++) { signal Calibration.dataReady(i+1, calibration[(int)i]); } ! //return; ! } else { // reset the device spi_reset(); *************** *** 333,336 **** --- 338,344 ---- } } + } + + command result_t StdControl.init() { *************** *** 393,397 **** --- 401,407 ---- if (state == IDLE) { state = RESET; + atomic { sensor = TEMP; + } post SPITask(); return SUCCESS; Index: intersema_5534ap.h =================================================================== RCS file: /cvsroot/firebug/fireboard/fireboard/sensors/intersema5534ap/intersema_5534ap.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** intersema_5534ap.h 5 Jan 2004 21:03:27 -0000 1.1.1.1 --- intersema_5534ap.h 26 Mar 2004 00:39:27 -0000 1.2 *************** *** 13,16 **** --- 13,17 ---- */ + const uint8_t INTERSEMA_POWER_ON = 1; typedef struct _intersema5534ap_data_msg { |