[Tinyos-commits]
CVS: tinyos-1.x/tos/platform/telos Hamamatsu.h, 1.3,
1.4 HamamatsuC.nc, 1.4, 1.5 HamamatsuM.nc, 1.5, 1.6
Joe Polastre
jpolastre at users.sourceforge.net
Fri Jun 17 17:24:58 PDT 2005
- Previous message: [Tinyos-commits] CVS: tinyos-1.x/tos/platform/telosb GoldenImage.h,
1.2, 1.3
- Next message: [Tinyos-commits] CVS: tinyos-1.x/tos/platform/telos HumidityC.nc,
1.2, 1.3 HumidityM.nc, 1.4, 1.5 HumidityProtocolM.nc, 1.2,
1.3 HumidityProtocolC.nc, 1.3, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-1.x/tos/platform/telos
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29280
Modified Files:
Hamamatsu.h HamamatsuC.nc HamamatsuM.nc
Log Message:
added ADCSingle and ADCMultiple interfaces to the PAR and TSR sensors
Index: Hamamatsu.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/platform/telos/Hamamatsu.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Hamamatsu.h 22 Nov 2004 18:48:54 -0000 1.3
--- Hamamatsu.h 18 Jun 2005 00:24:55 -0000 1.4
***************
*** 40,43 ****
--- 40,48 ----
};
+ #define MSP430ADC12_PAR ADC12_SETTINGS( \
+ INPUT_CHANNEL_A4, REFERENCE_VREFplus_AVss, SAMPLE_HOLD_4_CYCLES, \
+ SHT_SOURCE_ACLK, SHT_CLOCK_DIV_1, SAMPCON_SOURCE_SMCLK, \
+ SAMPCON_CLOCK_DIV_1, REFVOLT_LEVEL_1_5)
+
// TSR, Total Solar Radiation
enum
***************
*** 52,55 ****
--- 57,65 ----
};
+ #define MSP430ADC12_TSR ADC12_SETTINGS( \
+ INPUT_CHANNEL_A5, REFERENCE_VREFplus_AVss, SAMPLE_HOLD_4_CYCLES, \
+ SHT_SOURCE_ACLK, SHT_CLOCK_DIV_1, SAMPCON_SOURCE_SMCLK, \
+ SAMPCON_CLOCK_DIV_1, REFVOLT_LEVEL_1_5)
+
#endif//_H_Hamamatsu_h
Index: HamamatsuC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/platform/telos/HamamatsuC.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** HamamatsuC.nc 20 Nov 2004 02:30:04 -0000 1.4
--- HamamatsuC.nc 18 Jun 2005 00:24:55 -0000 1.5
***************
*** 1,4 ****
/* tab:4
! * "Copyright (c) 2000-2003 The Regents of the University of California.
* All rights reserved.
*
--- 1,5 ----
+ // $Id$
/* tab:4
! * "Copyright (c) 2000-2005 The Regents of the University of California.
* All rights reserved.
*
***************
*** 20,28 ****
*
*/
! /*
! *
! * Authors: Joe Polastre
! *
! * $Id$
*/
--- 21,26 ----
*
*/
! /**
! * @author Joe Polastre
*/
***************
*** 34,37 ****
--- 32,39 ----
interface ADC as PAR;
interface ADC as TSR;
+ interface ADCSingle as PARSingle;
+ interface ADCSingle as TSRSingle;
+ interface ADCMultiple as PARMultiple;
+ interface ADCMultiple as TSRMultiple;
interface StdControl;
}
***************
*** 39,43 ****
implementation
{
! components HamamatsuM, ADCC;
StdControl = ADCC;
--- 41,45 ----
implementation
{
! components HamamatsuM, MSP430ADC12C, ADCC;
StdControl = ADCC;
***************
*** 47,51 ****
--- 49,65 ----
TSR = ADCC.ADC[TOS_ADC_TSR_PORT];
+ PARSingle = HamamatsuM.PARSingle;
+ PARMultiple = HamamatsuM.PARMultiple;
+
+ TSRSingle = HamamatsuM.TSRSingle;
+ TSRMultiple = HamamatsuM.TSRMultiple;
+
HamamatsuM.ADCControl -> ADCC;
+ HamamatsuM.MSP430ADC12SinglePAR -> MSP430ADC12C.MSP430ADC12Single[unique("MSP430ADC12")];
+ HamamatsuM.MSP430ADC12SingleTSR -> MSP430ADC12C.MSP430ADC12Single[unique("MSP430ADC12")];
+ HamamatsuM.MSP430ADC12MultiplePAR -> MSP430ADC12C.MSP430ADC12Multiple[unique("MSP430ADC12")];
+ HamamatsuM.MSP430ADC12MultipleTSR -> MSP430ADC12C.MSP430ADC12Multiple[unique("MSP430ADC12")];
+
+
}
Index: HamamatsuM.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/tos/platform/telos/HamamatsuM.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** HamamatsuM.nc 13 Jun 2005 04:17:36 -0000 1.5
--- HamamatsuM.nc 18 Jun 2005 00:24:55 -0000 1.6
***************
*** 1,4 ****
/* tab:4
! * "Copyright (c) 2000-2003 The Regents of the University of California.
* All rights reserved.
*
--- 1,5 ----
+ // $Id$
/* tab:4
! * "Copyright (c) 2000-2005 The Regents of the University of California.
* All rights reserved.
*
***************
*** 20,28 ****
*
*/
! /*
! *
! * Authors: Joe Polastre
! *
! * $Id$
*/
--- 21,26 ----
*
*/
! /**
! * @author Joe Polastre
*/
***************
*** 32,41 ****
--- 30,49 ----
provides {
interface StdControl;
+ interface ADCSingle as PARSingle;
+ interface ADCSingle as TSRSingle;
+ interface ADCMultiple as PARMultiple;
+ interface ADCMultiple as TSRMultiple;
}
uses {
interface ADCControl;
+ interface MSP430ADC12Single as MSP430ADC12SinglePAR;
+ interface MSP430ADC12Multiple as MSP430ADC12MultiplePAR;
+ interface MSP430ADC12Single as MSP430ADC12SingleTSR;
+ interface MSP430ADC12Multiple as MSP430ADC12MultipleTSR;
}
}
implementation {
+ norace bool contMode;
+
command result_t StdControl.init() {
return SUCCESS;
***************
*** 49,52 ****
--- 57,64 ----
ok &= call ADCControl.bindPort(TOS_ADC_PAR_PORT,
TOSH_ACTUAL_ADC_PAR_PORT);
+ call MSP430ADC12SinglePAR.bind(MSP430ADC12_PAR);
+ call MSP430ADC12SingleTSR.bind(MSP430ADC12_TSR);
+ call MSP430ADC12MultiplePAR.bind(MSP430ADC12_PAR);
+ call MSP430ADC12MultipleTSR.bind(MSP430ADC12_TSR);
return ok;
}
***************
*** 55,57 ****
--- 67,285 ----
return SUCCESS;
}
+
+ async command adcresult_t PARSingle.getData()
+ {
+ if (call MSP430ADC12SinglePAR.getData() != MSP430ADC12_FAIL)
+ return ADC_SUCCESS;
+ return ADC_FAIL;
+ }
+
+ async command adcresult_t PARSingle.getDataContinuous()
+ {
+ if (call MSP430ADC12SinglePAR.getDataRepeat(0) != MSP430ADC12_FAIL)
+ return ADC_SUCCESS;
+ return ADC_FAIL;
+ }
+
+ async command adcresult_t PARSingle.reserve()
+ {
+ if (call MSP430ADC12SinglePAR.reserve() == SUCCESS)
+ return ADC_SUCCESS;
+ return ADC_FAIL;
+ }
+
+ async command adcresult_t PARSingle.reserveContinuous()
+ {
+ if (call MSP430ADC12SinglePAR.reserveRepeat(0) == SUCCESS)
+ return ADC_SUCCESS;
+ return ADC_FAIL;
+ }
+
+ async command adcresult_t PARSingle.unreserve()
+ {
+ if (call MSP430ADC12SinglePAR.unreserve() == SUCCESS)
+ return ADC_SUCCESS;
+ return ADC_FAIL;
+ }
+
+ async event result_t MSP430ADC12SinglePAR.dataReady(uint16_t data)
+ {
+ return signal PARSingle.dataReady(ADC_SUCCESS, data);
+ }
+
+
+ default async event result_t PARSingle.dataReady(adcresult_t result, uint16_t data)
+ {
+ return FAIL;
+ }
+
+ async command adcresult_t PARMultiple.getData(uint16_t *buf, uint16_t length)
+ {
+ if (call MSP430ADC12MultiplePAR.getData(buf, length, 0) != MSP430ADC12_FAIL)
+ return ADC_SUCCESS;
+ return ADC_FAIL;
+ }
+
+ async command adcresult_t PARMultiple.getDataContinuous(uint16_t *buf, uint16_t length)
+ {
+ if (length <= 16) {
+ if (call MSP430ADC12MultiplePAR.getDataRepeat(buf, length, 0) != MSP430ADC12_FAIL)
+ return ADC_SUCCESS;
+ return ADC_FAIL;
+ } else {
+ if (call MSP430ADC12MultiplePAR.getData(buf, length, 0) != MSP430ADC12_FAIL){
+ contMode = TRUE;
+ return ADC_SUCCESS;
+ } else
+ return ADC_FAIL;
+ }
+ }
+
+ async command adcresult_t PARMultiple.reserve(uint16_t *buf, uint16_t length)
+ {
+ if (call MSP430ADC12MultiplePAR.reserve(buf, length, 0) != MSP430ADC12_FAIL)
+ return ADC_SUCCESS;
+ return ADC_FAIL;
+ }
+
+ async command adcresult_t PARMultiple.reserveContinuous(uint16_t *buf, uint16_t length)
+ {
+ if (call MSP430ADC12MultiplePAR.reserveRepeat(buf, length, 0) != MSP430ADC12_FAIL)
+ return ADC_SUCCESS;
+ return ADC_FAIL;
+ }
+
+ async command adcresult_t PARMultiple.unreserve()
+ {
+ if (call MSP430ADC12MultiplePAR.unreserve() == SUCCESS)
+ return ADC_SUCCESS;
+ return ADC_FAIL;
+ }
+
+ async event uint16_t* MSP430ADC12MultiplePAR.dataReady(uint16_t *buf, uint16_t length)
+ {
+ uint16_t *nextbuf;
+ if (!contMode)
+ nextbuf = signal PARMultiple.dataReady(SUCCESS, buf, length);
+ else
+ if ((nextbuf = signal PARMultiple.dataReady(SUCCESS, buf, length)))
+ call MSP430ADC12MultiplePAR.getData(nextbuf, length, 0);
+ else
+ contMode = FALSE;
+ return nextbuf;
+ }
+
+ default async event uint16_t* PARMultiple.dataReady(adcresult_t result, uint16_t *buf, uint16_t length)
+ {
+ return 0;
+ }
+
+ async command adcresult_t TSRSingle.getData()
+ {
+ if (call MSP430ADC12SingleTSR.getData() != MSP430ADC12_FAIL)
+ return ADC_SUCCESS;
+ return ADC_FAIL;
+ }
+
+ async command adcresult_t TSRSingle.getDataContinuous()
+ {
+ if (call MSP430ADC12SingleTSR.getDataRepeat(0) != MSP430ADC12_FAIL)
+ return ADC_SUCCESS;
+ return ADC_FAIL;
+ }
+
+ async command adcresult_t TSRSingle.reserve()
+ {
+ if (call MSP430ADC12SingleTSR.reserve() == SUCCESS)
+ return ADC_SUCCESS;
+ return ADC_FAIL;
+ }
+
+ async command adcresult_t TSRSingle.reserveContinuous()
+ {
+ if (call MSP430ADC12SingleTSR.reserveRepeat(0) == SUCCESS)
+ return ADC_SUCCESS;
+ return ADC_FAIL;
+ }
+
+ async command adcresult_t TSRSingle.unreserve()
+ {
+ if (call MSP430ADC12SingleTSR.unreserve() == SUCCESS)
+ return ADC_SUCCESS;
+ return ADC_FAIL;
+ }
+
+ async event result_t MSP430ADC12SingleTSR.dataReady(uint16_t data)
+ {
+ return signal TSRSingle.dataReady(ADC_SUCCESS, data);
+ }
+
+
+ default async event result_t TSRSingle.dataReady(adcresult_t result, uint16_t data)
+ {
+ return FAIL;
+ }
+
+ async command adcresult_t TSRMultiple.getData(uint16_t *buf, uint16_t length)
+ {
+ if (call MSP430ADC12MultipleTSR.getData(buf, length, 0) != MSP430ADC12_FAIL)
+ return ADC_SUCCESS;
+ return ADC_FAIL;
+ }
+
+ async command adcresult_t TSRMultiple.getDataContinuous(uint16_t *buf, uint16_t length)
+ {
+ if (length <= 16) {
+ if (call MSP430ADC12MultipleTSR.getDataRepeat(buf, length, 0) != MSP430ADC12_FAIL)
+ return ADC_SUCCESS;
+ return ADC_FAIL;
+ } else {
+ if (call MSP430ADC12MultipleTSR.getData(buf, length, 0) != MSP430ADC12_FAIL){
+ contMode = TRUE;
+ return ADC_SUCCESS;
+ } else
+ return ADC_FAIL;
+ }
+ }
+
+ async command adcresult_t TSRMultiple.reserve(uint16_t *buf, uint16_t length)
+ {
+ if (call MSP430ADC12MultipleTSR.reserve(buf, length, 0) != MSP430ADC12_FAIL)
+ return ADC_SUCCESS;
+ return ADC_FAIL;
+ }
+
+ async command adcresult_t TSRMultiple.reserveContinuous(uint16_t *buf, uint16_t length)
+ {
+ if (call MSP430ADC12MultipleTSR.reserveRepeat(buf, length, 0) != MSP430ADC12_FAIL)
+ return ADC_SUCCESS;
+ return ADC_FAIL;
+ }
+
+ async command adcresult_t TSRMultiple.unreserve()
+ {
+ if (call MSP430ADC12MultipleTSR.unreserve() == SUCCESS)
+ return ADC_SUCCESS;
+ return ADC_FAIL;
+ }
+
+ async event uint16_t* MSP430ADC12MultipleTSR.dataReady(uint16_t *buf, uint16_t length)
+ {
+ uint16_t *nextbuf;
+ if (!contMode)
+ nextbuf = signal TSRMultiple.dataReady(SUCCESS, buf, length);
+ else
+ if ((nextbuf = signal TSRMultiple.dataReady(SUCCESS, buf, length)))
+ call MSP430ADC12MultipleTSR.getData(nextbuf, length, 0);
+ else
+ contMode = FALSE;
+ return nextbuf;
+ }
+
+ default async event uint16_t* TSRMultiple.dataReady(adcresult_t result, uint16_t *buf, uint16_t length)
+ {
+ return 0;
+ }
+
+
}
- Previous message: [Tinyos-commits] CVS: tinyos-1.x/tos/platform/telosb GoldenImage.h,
1.2, 1.3
- Next message: [Tinyos-commits] CVS: tinyos-1.x/tos/platform/telos HumidityC.nc,
1.2, 1.3 HumidityM.nc, 1.4, 1.5 HumidityProtocolM.nc, 1.2,
1.3 HumidityProtocolC.nc, 1.3, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-commits
mailing list