Thread: [Firebug-cvs] fireboard/fireboard/sensors/taos_tsl250rd TaosPhoto.nc,1.2,1.3 TaosPhotoM.nc,1.3,1.4 t
Brought to you by:
doolin
From: David M. D. <do...@us...> - 2004-03-26 00:50:20
|
Update of /cvsroot/firebug/fireboard/fireboard/sensors/taos_tsl250rd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17017/taos_tsl250rd Modified Files: TaosPhoto.nc TaosPhotoM.nc taos.nc taosM.nc taos_tsl250rd.h Log Message: Changed to HLSensor. Index: TaosPhoto.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/fireboard/sensors/taos_tsl250rd/TaosPhoto.nc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TaosPhoto.nc 3 Feb 2004 20:06:44 -0000 1.2 --- TaosPhoto.nc 26 Mar 2004 00:39:27 -0000 1.3 *************** *** 63,67 **** * Authors: Joe Polastre * - * $Id$ */ --- 63,66 ---- Index: taosM.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/fireboard/sensors/taos_tsl250rd/taosM.nc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** taosM.nc 22 Jan 2004 21:59:22 -0000 1.2 --- taosM.nc 26 Mar 2004 00:39:28 -0000 1.3 *************** *** 1,3 **** - /* -*- Mode: C; c-basic-indent: 3; indent-tabs-mode: nil -*- */ --- 1,2 ---- *************** *** 19,23 **** provides { interface StdControl; ! interface Sensor; } --- 18,22 ---- provides { interface StdControl; ! interface HLSensor; } *************** *** 41,45 **** uint16_t TaosData; ! uint16_t sampling_interval = 2000; taos_tsl250rd_data_msg data_msg = {0}; --- 40,44 ---- uint16_t TaosData; ! uint16_t sampling_interval;// = 2000; taos_tsl250rd_data_msg data_msg = {0}; *************** *** 58,65 **** --- 57,67 ---- command result_t StdControl.start() { + call TaosControl.start(); return SUCCESS; } command result_t StdControl.stop() { + call TaosControl.stop(); + signal HLSensor.powerOffDone(); return SUCCESS; } *************** *** 67,76 **** event result_t Timer.fired() { ! SODbg(DBG_USR2, "taosM.Timer.fired() \r\n") ; ! call TaosControl.start(); return SUCCESS; } /** * Taos- tsl2250 light sensor --- 69,82 ---- event result_t Timer.fired() { ! SODbg(DBG_USR2, "$taosM.Timer.fired() \r\n") ; return SUCCESS; } + task void signalDataready() { + + signal HLSensor.dataReady(&data_msg); + } + /** * Taos- tsl2250 light sensor *************** *** 108,112 **** atomic { if (TaosData == 0xff) { ! signal Sensor.error(0); SODbg(DBG_USR2, "Taos Ch0 data: OVERFLOW \n") ; } --- 114,118 ---- atomic { if (TaosData == 0xff) { ! signal HLSensor.error(0); SODbg(DBG_USR2, "Taos Ch0 data: OVERFLOW \n") ; } *************** *** 123,127 **** } ! signal Sensor.dataReady(&data_msg); //SODbg(DBG_USR2, "Taos Ch0 data: %i Cord: %i Step: %i ADC Counts: %i \n", TaosData & 0x0FF, CH1,ST1,ACNT0); --- 129,134 ---- } ! signal HLSensor.dataReady(&data_msg); ! //post signalDataready(); //SODbg(DBG_USR2, "Taos Ch0 data: %i Cord: %i Step: %i ADC Counts: %i \n", TaosData & 0x0FF, CH1,ST1,ACNT0); *************** *** 136,140 **** Lux = (float)ACNT0*0.46/exp(3.13*R); if (data == 0xff) { ! signal Sensor.error(0); SODbg(DBG_USR2, "Taos Ch1 data: OVERFLOW \n"); } --- 143,147 ---- Lux = (float)ACNT0*0.46/exp(3.13*R); if (data == 0xff) { ! signal HLSensor.error(0); SODbg(DBG_USR2, "Taos Ch1 data: OVERFLOW \n"); } *************** *** 149,157 **** } ! signal Sensor.dataReady(&data_msg); //SODbg(DBG_USR2, "Taos Ch1 data: %i Cord: %i Step: %i ADC Counts: %i Light(lux): %i \n", data & 0x0FF, CH1,ST1,ACNT1,(int)Lux); ! call TaosControl.stop(); return SUCCESS; } --- 156,165 ---- } ! signal HLSensor.dataReady(&data_msg); ! //post signalDataready(); //SODbg(DBG_USR2, "Taos Ch1 data: %i Cord: %i Step: %i ADC Counts: %i Light(lux): %i \n", data & 0x0FF, CH1,ST1,ACNT1,(int)Lux); ! //call TaosControl.stop(); return SUCCESS; } *************** *** 176,180 **** event result_t TaosControl.stopDone() { ! signal Sensor.powerOffDone(); return SUCCESS; } --- 184,188 ---- event result_t TaosControl.stopDone() { ! signal HLSensor.powerOffDone(); return SUCCESS; } *************** *** 182,186 **** /////////////////////////////////////////////////////////// ! command result_t Sensor.powerOn() { call TaosControl.start(); --- 190,194 ---- /////////////////////////////////////////////////////////// ! command result_t HLSensor.powerOn(uint8_t power_level) { call TaosControl.start(); *************** *** 188,210 **** } ! default event result_t Sensor.powerOnDone() { return SUCCESS; } ! command result_t Sensor.init() { return SUCCESS; } ! command result_t Sensor.powerOff() { call TaosControl.stop(); return SUCCESS; } ! default event result_t Sensor.powerOffDone() { return SUCCESS; } ! command result_t Sensor.setSamplingInterval(uint16_t interval) { atomic { --- 196,219 ---- } ! default event result_t HLSensor.powerOnDone() { return SUCCESS; } ! command result_t HLSensor.init() { return SUCCESS; } ! command result_t HLSensor.powerOff() { call TaosControl.stop(); + signal HLSensor.powerOffDone(); return SUCCESS; } ! default event result_t HLSensor.powerOffDone() { return SUCCESS; } ! command result_t HLSensor.setSamplingInterval(uint16_t interval) { atomic { *************** *** 214,244 **** } ! command result_t Sensor.getSamplingInterval(uint16_t sampling_rate) { return SUCCESS; } ! command result_t Sensor.startSampling() { ! SODbg(DBG_USR2, "taosM.Sensor.startSampling() \r\n") ; call Timer.start(TIMER_REPEAT, sampling_interval); 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; } ! default async event result_t Sensor.error(uint16_t error_code) { return SUCCESS; } ! command result_t Sensor.loadProgram(uint8_t * program) { return SUCCESS; } --- 223,254 ---- } ! command result_t HLSensor.getSamplingInterval(uint16_t sampling_rate) { return SUCCESS; } ! command result_t HLSensor.startSampling() { ! SODbg(DBG_USR2, "$taosM.Sensor.startSampling() \r\n") ; ! call TaosControl.start(); call Timer.start(TIMER_REPEAT, sampling_interval); 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; } ! default async event result_t HLSensor.error(uint16_t error_code) { return SUCCESS; } ! command result_t HLSensor.loadProgram(uint8_t * program,uint8_t length) { return SUCCESS; } Index: TaosPhotoM.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/fireboard/sensors/taos_tsl250rd/TaosPhotoM.nc,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TaosPhotoM.nc 3 Feb 2004 20:06:44 -0000 1.3 --- TaosPhotoM.nc 26 Mar 2004 00:39:28 -0000 1.4 *************** *** 1,3 **** ! /* -*- Mode: C; c-basic-indent: 3; indent-tabs-mode: nil -*- */ /* tab:4 --- 1,3 ---- ! /* tab:4 *************** *** 65,69 **** * Authors: Joe Polastre * - * $Id$ */ --- 65,68 ---- *************** *** 97,100 **** --- 96,102 ---- norace char state; norace char tempvalue; + + result_t switch_write_result; + bool power; char data_adc; *************** *** 211,214 **** --- 213,235 ---- + task void readChannel0() { + + tempvalue = 0x43; + state = READ_0; + atomic { + switch_write_result = call I2CPacket.writePacket(1,(char*)&tempvalue,0x01); + } + } + + task void readChannel1() { + + tempvalue = 0x83; + state = READ_1; + atomic { + switch_write_result = call I2CPacket.writePacket(1,(char*)&tempvalue,0x01); + } + } + + /** * Read Taos adc data *************** *** 223,226 **** --- 244,248 ---- if (id == 0) { + /* //read channel 0 atomic { *************** *** 229,233 **** --- 251,259 ---- } return call I2CPacket.writePacket(1,(char*)&tempvalue,0x01); + */ + post readChannel0(); + } else if (id == 1) { + /* //read channel 1 atomic { *************** *** 236,240 **** --- 262,269 ---- } return call I2CPacket.writePacket(1,(char*)&tempvalue,0x01); + */ + post readChannel1(); } + return switch_write_result; } state = IDLE; Index: taos.nc =================================================================== RCS file: /cvsroot/firebug/fireboard/fireboard/sensors/taos_tsl250rd/taos.nc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** taos.nc 22 Jan 2004 00:40:07 -0000 1.2 --- taos.nc 26 Mar 2004 00:39:28 -0000 1.3 *************** *** 1,6 **** - /* -*- Mode: C; c-basic-indent: 3; indent-tabs-mode: nil -*- */ - - - /** --- 1,2 ---- *************** *** 18,22 **** configuration taos { provides interface StdControl; ! provides interface Sensor; } --- 14,18 ---- configuration taos { provides interface StdControl; ! provides interface HLSensor; } *************** *** 24,28 **** components taosM, ! //MicaWbSwitch, TimerC, NoLeds, --- 20,24 ---- components taosM, ! MicaWbSwitch, TimerC, NoLeds, *************** *** 34,38 **** taosM.StdControl = StdControl; ! Sensor = taosM; StdControl = TimerC; --- 30,34 ---- taosM.StdControl = StdControl; ! HLSensor = taosM; StdControl = TimerC; Index: taos_tsl250rd.h =================================================================== RCS file: /cvsroot/firebug/fireboard/fireboard/sensors/taos_tsl250rd/taos_tsl250rd.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** taos_tsl250rd.h 5 Jan 2004 21:03:27 -0000 1.1.1.1 --- taos_tsl250rd.h 26 Mar 2004 00:39:28 -0000 1.2 *************** *** 12,15 **** --- 12,16 ---- */ + const uint8_t TAOS_POWER_ON = 1; typedef struct _taos_tsl250rd { |