[Tinyos-2-commits] CVS: tinyos-2.x/tos/sensorboards/mts300 .sensor,
1.5, 1.6 AccelConfigP.nc, 1.1, 1.2 AccelP.nc, 1.1,
1.2 PhotoC.nc, 1.1, 1.2 PhotoTempP.nc, 1.1,
1.2 SensorMts300C.nc, 1.4, 1.5 SensorMts300P.nc, 1.4,
1.5 SounderC.nc, 1.1, 1.2 SounderP.nc, 1.1, 1.2 mts300.h, 1.1, 1.2
Pi Peng
pipeng at users.sourceforge.net
Thu Feb 15 02:28:48 PST 2007
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/apps/tests/mica2/mts300
XMTS300.h, NONE, 1.1 Makefile, 1.3, 1.4 TestMts300C.nc, 1.4,
1.5 TestMts300P.nc, 1.4, 1.5
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/sensorboards/mts300
AccelC.nc, NONE, 1.1 Mag.nc, NONE, 1.1 MagC.nc, NONE,
1.1 MagConfigP.nc, NONE, 1.1 MagP.nc, NONE, 1.1 Mic.nc, 1.2,
1.3 MicC.nc, NONE, 1.1 MicDeviceP.nc, NONE,
1.1 MicInterrupt.nc, NONE, 1.1 MicP.nc, NONE,
1.1 PhotoTempDeviceP.nc, NONE, 1.1 TempC.nc, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/tinyos/tinyos-2.x/tos/sensorboards/mts300
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv30709
Modified Files:
.sensor AccelConfigP.nc AccelP.nc PhotoC.nc PhotoTempP.nc
SensorMts300C.nc SensorMts300P.nc SounderC.nc SounderP.nc
mts300.h
Log Message:
update the latest driver code for T2.
Index: .sensor
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/sensorboards/mts300/.sensor,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** .sensor 8 Feb 2007 17:55:35 -0000 1.5
--- .sensor 15 Feb 2007 10:28:46 -0000 1.6
***************
*** 11,14 ****
#
push( @includes, qw(
! %T/sensorboards/mts300
) );
--- 11,16 ----
#
push( @includes, qw(
! %T/sensorboards/mts300_me
! %T/chips/atm128/i2c
! # %T/chips/atm128/adc
) );
Index: AccelConfigP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/sensorboards/mts300/AccelConfigP.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** AccelConfigP.nc 8 Feb 2007 17:55:35 -0000 1.1
--- AccelConfigP.nc 15 Feb 2007 10:28:46 -0000 1.2
***************
*** 1,41 ****
! /* $Id$
! * Copyright (c) 2006 Intel Corporation
! * All rights reserved.
! *
! * This file is distributed under the terms in the attached INTEL-LICENSE
! * file. If you do not find these files, copies can be found by writing to
! * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
! * 94704. Attention: Intel License Inquiry.
! */
! /**
! * Internal component for basicsb photodiode. Arbitrates access to the photo
! * diode and automatically turns it on or off based on user requests.
! *
! * @author David Gay
! */
!
! configuration AccelConfigP {
! provides {
! interface Resource[uint8_t client];
! interface Atm128AdcConfig as ConfigX;
! interface Atm128AdcConfig as ConfigY;
! }
! }
! implementation {
! components AccelP, MicaBusC, new TimerMilliC() as WarmupTimer,
! new RoundRobinArbiterC(UQ_ACCEL_RESOURCE) as Arbiter,
! new SplitControlPowerManagerC() as PowerManager;
!
! Resource = Arbiter;
! ConfigX = AccelP.ConfigX;
! ConfigY = AccelP.ConfigY;
!
! PowerManager.ResourceDefaultOwner -> Arbiter;
! PowerManager.ArbiterInfo -> Arbiter;
! PowerManager.SplitControl -> AccelP;
!
! AccelP.Timer -> WarmupTimer;
! AccelP.AccelPin -> MicaBusC.PW4;
! AccelP.AccelAdcX -> MicaBusC.Adc3;
! AccelP.AccelAdcY -> MicaBusC.Adc4;
! }
--- 1,44 ----
! /* $Id$
! * Copyright (c) 2006 Intel Corporation
! * All rights reserved.
! *
! * This file is distributed under the terms in the attached INTEL-LICENSE
! * file. If you do not find these files, copies can be found by writing to
! * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
! * 94704. Attention: Intel License Inquiry.
! */
! /**
! * Internal component for basicsb photodiode. Arbitrates access to the photo
! * diode and automatically turns it on or off based on user requests.
! *
! * @author David Gay
! */
!
! #include "mts300.h"
!
! configuration AccelConfigP {
! provides {
! interface Init;
! interface StdControl;
!
! interface Atm128AdcConfig as ConfigX;
! interface Atm128AdcConfig as ConfigY;
! interface ResourceConfigure as ResourceX;
! interface ResourceConfigure as ResourceY;
! }
! }
! implementation {
! components AccelP, MicaBusC;
!
! Init = AccelP;
! StdControl = AccelP;
!
! ConfigX = AccelP.ConfigX;
! ConfigY = AccelP.ConfigY;
! ResourceX = AccelP.ResourceX;
! ResourceY = AccelP.ResourceY;
!
! AccelP.AccelPower -> MicaBusC.PW4;
! AccelP.AccelAdcX -> MicaBusC.Adc3;
! AccelP.AccelAdcY -> MicaBusC.Adc4;
! }
Index: AccelP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/sensorboards/mts300/AccelP.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** AccelP.nc 8 Feb 2007 17:55:35 -0000 1.1
--- AccelP.nc 15 Feb 2007 10:28:46 -0000 1.2
***************
*** 1,76 ****
! /* $Id$
! * Copyright (c) 2006 Intel Corporation
! * All rights reserved.
! *
! * This file is distributed under the terms in the attached INTEL-LICENSE
! * file. If you do not find these files, copies can be found by writing to
! * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
! * 94704. Attention: Intel License Inquiry.
! */
! /**
! * ADXL202JE accelerometer ADC configuration and power management.
! * @author David Gay <david.e.gay at intel.com>
! */
! module AccelP
! {
! provides {
! interface SplitControl;
! interface Atm128AdcConfig as ConfigX;
! interface Atm128AdcConfig as ConfigY;
! }
! uses {
! interface Timer<TMilli>;
! interface GeneralIO as AccelPin;
! interface MicaBusAdc as AccelAdcX;
! interface MicaBusAdc as AccelAdcY;
! }
! }
! implementation
! {
! async command uint8_t ConfigX.getChannel() {
! return call AccelAdcX.getChannel();
! }
!
! async command uint8_t ConfigX.getRefVoltage() {
! return ATM128_ADC_VREF_OFF;
! }
!
! async command uint8_t ConfigX.getPrescaler() {
! return ATM128_ADC_PRESCALE;
! }
!
! async command uint8_t ConfigY.getChannel() {
! return call AccelAdcY.getChannel();
! }
!
! async command uint8_t ConfigY.getRefVoltage() {
! return ATM128_ADC_VREF_OFF;
! }
!
! async command uint8_t ConfigY.getPrescaler() {
! return ATM128_ADC_PRESCALE;
! }
!
! command error_t SplitControl.start() {
! call AccelPin.makeOutput();
! call AccelPin.set();
! /* Startup time is 16.3ms for 0.1uF capacitors,
! according to the ADXL202E data sheet */
! call Timer.startOneShot(17);
! return SUCCESS;
! }
!
! event void Timer.fired() {
! signal SplitControl.startDone(SUCCESS);
! }
!
! task void stopDone() {
! call AccelPin.clr();
! signal SplitControl.stopDone(SUCCESS);
! }
!
! command error_t SplitControl.stop() {
! post stopDone();
! return SUCCESS;
! }
! }
--- 1,71 ----
! #include "mts300.h"
! #include "Timer.h"
!
! module AccelP
! {
! provides interface Init;
! provides interface StdControl;
!
! provides interface Atm128AdcConfig as ConfigX;
! provides interface Atm128AdcConfig as ConfigY;
! provides interface ResourceConfigure as ResourceX;
! provides interface ResourceConfigure as ResourceY;
!
! uses interface GeneralIO as AccelPower;
! uses interface MicaBusAdc as AccelAdcX;
! uses interface MicaBusAdc as AccelAdcY;
! }
!
! implementation
! {
! command error_t Init.init()
! {
! call AccelPower.makeOutput();
! call AccelPower.clr();
!
! return SUCCESS;
! }
!
! command error_t StdControl.start()
! {
! call AccelPower.set();
! return SUCCESS;
! }
!
! command error_t StdControl.stop()
! {
! call AccelPower.clr();
! call AccelPower.makeInput();
!
! return SUCCESS;
! }
!
! async command uint8_t ConfigX.getChannel() {
! return call AccelAdcX.getChannel();
! }
!
! async command uint8_t ConfigX.getRefVoltage() {
! return ATM128_ADC_VREF_OFF;
! }
!
! async command uint8_t ConfigX.getPrescaler() {
! return ATM128_ADC_PRESCALE;
! }
!
! async command uint8_t ConfigY.getChannel() {
! return call AccelAdcY.getChannel();
! }
!
! async command uint8_t ConfigY.getRefVoltage() {
! return ATM128_ADC_VREF_OFF;
! }
!
! async command uint8_t ConfigY.getPrescaler() {
! return ATM128_ADC_PRESCALE;
! }
!
! async command void ResourceX.configure() { }
! async command void ResourceX.unconfigure() { }
! async command void ResourceY.configure() { }
! async command void ResourceY.unconfigure() {}
! }
\ No newline at end of file
Index: PhotoC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/sensorboards/mts300/PhotoC.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PhotoC.nc 8 Feb 2007 17:55:36 -0000 1.1
--- PhotoC.nc 15 Feb 2007 10:28:46 -0000 1.2
***************
*** 1,25 ****
! /* $Id$
! * Copyright (c) 2006 Intel Corporation
! * All rights reserved.
*
! * This file is distributed under the terms in the attached INTEL-LICENSE
! * file. If you do not find these files, copies can be found by writing to
! * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
! * 94704. Attention: Intel License Inquiry.
*/
! /**
! * Photodiode of the mts300 sensor board.
! *
! * @author David Gay
*/
#include "mts300.h"
! generic configuration PhotoC() {
provides interface Read<uint16_t>;
}
! implementation {
! components ArbitratedPhotoDeviceP;
! Read = ArbitratedPhotoDeviceP.Read[unique(UQ_PHOTO_RESOURCE)];
}
--- 1,49 ----
! /**
! * Copyright (c) 2005-2006 Crossbow Technology, Inc.
! * All rights reserved.
*
! * Permission to use, copy, modify, and distribute this software and its
! * documentation for any purpose, without fee, and without written
! * agreement is hereby granted, provided that the above copyright
! * notice, the (updated) modification history and the author appear in
! * all copies of this source code.
! *
! * Permission is also granted to distribute this software under the
! * standard BSD license as contained in the TinyOS distribution.
! *
! * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
! * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
! * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA,
! * OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
! * THE POSSIBILITY OF SUCH DAMAGE.
*/
! /*
! * @author Hu Siquan <husq at xbow.com>
! *
! * $Id$
*/
#include "mts300.h"
! generic configuration PhotoC()
! {
provides interface Read<uint16_t>;
+ provides interface StdControl;
+ provides interface Init;
}
! implementation
! {
! components new AdcReadClientC(), PhotoTempDeviceP;
! Init = PhotoTempDeviceP;
! StdControl = PhotoTempDeviceP;
!
! Read = AdcReadClientC;
! AdcReadClientC.Atm128AdcConfig -> PhotoTempDeviceP.PhotoAtm128AdcConfig;
! AdcReadClientC.ResourceConfigure -> PhotoTempDeviceP.PhotoResourceConfigure;
}
Index: PhotoTempP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/sensorboards/mts300/PhotoTempP.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** PhotoTempP.nc 8 Feb 2007 17:55:36 -0000 1.1
--- PhotoTempP.nc 15 Feb 2007 10:28:46 -0000 1.2
***************
*** 1,32 ****
! /* $Id$
! * Copyright (c) 2007 Intel Corporation
! * All rights reserved.
! *
! * This file is distributed under the terms in the attached INTEL-LICENSE
! * file. If you do not find these files, copies can be found by writing to
! * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
! * 94704. Attention: Intel License Inquiry.
! */
! /**
! * MTS300 photo and temp sensor ADC configuration.
! * @author David Gay <david.e.gay at intel.com>
! */
! module PhotoTempP
! {
! provides interface Atm128AdcConfig;
! uses interface MicaBusAdc as PhotoTempAdc;
! }
! implementation
! {
! async command uint8_t Atm128AdcConfig.getChannel() {
! return call PhotoTempAdc.getChannel();
! }
!
! async command uint8_t Atm128AdcConfig.getRefVoltage() {
! return ATM128_ADC_VREF_OFF;
! }
!
! async command uint8_t Atm128AdcConfig.getPrescaler() {
! return ATM128_ADC_PRESCALE;
! }
! }
--- 1,194 ----
! /**
! * Copyright (c) 2005-2006 Crossbow Technology, Inc.
! * All rights reserved.
! *
! * Permission to use, copy, modify, and distribute this software and its
! * documentation for any purpose, without fee, and without written
! * agreement is hereby granted, provided that the above copyright
! * notice, the (updated) modification history and the author appear in
! * all copies of this source code.
! *
! * Permission is also granted to distribute this software under the
! * standard BSD license as contained in the TinyOS distribution.
! *
! * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
! * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
! * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA,
! * OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
! * THE POSSIBILITY OF SUCH DAMAGE.
! *
! * @author Martin Turon <mturon at xbow.com>
! * @author Hu Siquan <husq at xbow.com>
! *
! * $Id$
! */
!
! #include "Timer.h"
!
! module PhotoTempP
! {
! provides
! {
! interface Init; //!< Standard Initialization
! interface StdControl; //!< Start/Stop for Temp Sensor's Power Management
! interface ResourceConfigure as TempResourceConfigure;
! interface ResourceConfigure as PhotoResourceConfigure;
! interface Atm128AdcConfig as TempAtm128AdcConfig;
! interface Atm128AdcConfig as PhotoAtm128AdcConfig;
! }
! uses
! {
! interface GeneralIO as TempPower;
! interface GeneralIO as LightPower;
! interface MicaBusAdc as SensorAdc;
! interface Leds as DebugLeds;
! }
! }
! implementation
! {
! /*
! enum
! {
! STATE_IDLE = 0,
! STATE_LIGHT_WARMING, //!< Powering on sensor
! STATE_LIGHT_READY, //!< Power up of sensor complete
! STATE_LIGHT_SAMPLING, //!< Sampling sensor
! STATE_TEMP_WARMING, //!< Powering on sensor
! STATE_TEMP_READY, //!< Power up of sensor complete
! STATE_TEMP_SAMPLING, //!< Sampling sensor
! };
!
! /// Yes, this could be a simple uint8_t. There used to be more bits here,
! /// but they were optimized out and removed.
! union
! {
! uint8_t flat;
! struct
! {
! uint8_t state : 4; //!< sensorboard state
! } bits;
! } g_flags;
! */
!
! void inline TOSH_uwait(int u_sec)
! {
! /* In most cases (constant arg), the test is elided at compile-time */
! if (u_sec)
! /* loop takes 4 cycles, aka 1us */
! asm volatile (
! "1: sbiw %0,1\n"
! " brne 1b" : "+w" (u_sec));
! }
! /**
! * Initialize this component. Initialization should not assume that
! * any component is running: init() cannot call any commands besides
! * those that initialize other components.
! *
! */
! command error_t Init.init()
! {
! return SUCCESS;
! }
!
!
! /**
! * Start the component and its subcomponents.
! *
! * @return SUCCESS if the component was successfully started.
! */
! command error_t StdControl.start()
! {
! call TempPower.makeOutput();
! call TempPower.clr();
! call LightPower.makeOutput();
! call LightPower.clr();
!
! return SUCCESS;
! }
!
! /**
! * Stop the component and pertinent subcomponents (not all
! * subcomponents may be turned off due to wakeup timers, etc.).
! *
! * @return SUCCESS if the component was successfully stopped.
! */
! command error_t StdControl.stop()
! {
! call TempPower.clr();
! call LightPower.clr();
! call TempPower.makeInput();
! call LightPower.makeInput();
!
! return SUCCESS;
! }
!
! async command uint8_t TempAtm128AdcConfig.getChannel()
! {
! return call SensorAdc.getChannel();
! }
!
! async command uint8_t TempAtm128AdcConfig.getRefVoltage()
! {
! return ATM128_ADC_VREF_OFF;
! }
!
! async command uint8_t TempAtm128AdcConfig.getPrescaler()
! {
! return ATM128_ADC_PRESCALE;
! }
!
! async command uint8_t PhotoAtm128AdcConfig.getChannel()
! {
! return call SensorAdc.getChannel();
! }
!
! async command uint8_t PhotoAtm128AdcConfig.getRefVoltage()
! {
! return ATM128_ADC_VREF_OFF;
! }
!
! async command uint8_t PhotoAtm128AdcConfig.getPrescaler()
! {
! return ATM128_ADC_PRESCALE;
! }
!
! async command void TempResourceConfigure.configure()
! {
! call DebugLeds.led0On();
! call LightPower.clr();
! call LightPower.makeInput();
! call TempPower.makeOutput();
! call TempPower.set();
! TOSH_uwait(1000);
! }
!
! async command void TempResourceConfigure.unconfigure()
! {
! call DebugLeds.led0Off();
! call TempPower.clr();
! call TempPower.makeInput();
! }
!
! /** Turns on the light sensor and turns the thermistor off. */
! async command void PhotoResourceConfigure.configure()
! {
! call DebugLeds.led1On();
! call TempPower.clr();
! call TempPower.makeInput();
! call LightPower.makeOutput();
! call LightPower.set();
! TOSH_uwait(1000);
! }
!
! async command void PhotoResourceConfigure.unconfigure()
! {
! call DebugLeds.led1Off();
! call LightPower.clr();
! call LightPower.makeInput();
! }
! }
Index: SensorMts300C.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/sensorboards/mts300/SensorMts300C.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** SensorMts300C.nc 12 Dec 2006 18:23:46 -0000 1.4
--- SensorMts300C.nc 15 Feb 2007 10:28:46 -0000 1.5
***************
*** 1,4 ****
/**
! * Copyright (c) 2004-2005 Crossbow Technology, Inc.
* All rights reserved.
*
--- 1,4 ----
/**
! * Copyright (c) 2005-2006 Crossbow Technology, Inc.
* All rights reserved.
*
***************
*** 13,62 ****
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
! * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
! * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA,
! * OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* @author Martin Turon <mturon at xbow.com>
! * @author Miguel Freitas
*
* $Id$
*/
! configuration SensorMts300C
{
! provides {
! interface Init; //!< Standard Initialization
! interface StdControl; //!< Start/Stop for Power Management
! interface Read<uint16_t> as Temp; //!< Thermister
! interface Read<uint16_t> as Light; //!< Photo sensor
! }
}
! implementation
{
! components
! SensorMts300P,
! SensorMts300DeviceP,
! HplAtm128GeneralIOC as IO,
! new AdcReadClientC() as SensorADC,
! new TimerMilliC() as WarmUpTimer
! ;
Init = SensorMts300P.Init;
StdControl = SensorMts300P.StdControl;
Temp = SensorMts300P.Temp;
Light = SensorMts300P.Light;
! SensorADC.Atm128AdcConfig -> SensorMts300DeviceP;
! SensorADC.ResourceConfigure -> SensorMts300DeviceP;
! SensorMts300P.SensorADC -> SensorADC;
! SensorMts300P.TempPower -> IO.PortE6;
SensorMts300P.LightPower -> IO.PortE5;
! SensorMts300P.WarmUpTimer -> WarmUpTimer;
}
--- 13,94 ----
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
! * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
! * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA,
! * OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* @author Martin Turon <mturon at xbow.com>
! * @author Hu Siquan <husq at xbow.com>
*
* $Id$
*/
! //configuration SensorMts300C
! generic configuration SensorMts300C()
{
! provides
! {
! interface Init; //!< Standard Initialization
! interface StdControl; //!< Start/Stop for Power Management
! interface Read<uint16_t> as Vref; //!< voltage
! interface Read<uint16_t> as Temp; //!< Thermister
! interface Read<uint16_t> as Light; //!< Photo sensor
! interface Read<uint16_t> as Microphone; //!< Mic sensor
! interface Read<uint16_t> as AccelX; //!< Accelerometer sensor
! interface Read<uint16_t> as AccelY; //!< Accelerometer sensor
! interface Read<uint16_t> as MagX; //!< magnetometer sensor
! interface Read<uint16_t> as MagY; //!< magnetometer sensor
! }
}
! implementation
{
! components SensorMts300P, HplAtm128GeneralIOC as IO,
! new VoltageC(),
! new PhotoC(),
! new TempC(),
! new MicC(),
! new MagC(),
! new AccelC(),
! new TimerMilliC() as WarmUpTimer;
Init = SensorMts300P.Init;
+ Init = PhotoC.Init;
+ Init = MicC.Init;
StdControl = SensorMts300P.StdControl;
+ Vref = SensorMts300P.Vref;
Temp = SensorMts300P.Temp;
Light = SensorMts300P.Light;
+ Microphone = SensorMts300P.Microphone;
+ AccelX = SensorMts300P.AccelX;
+ AccelY = SensorMts300P.AccelY;
+ MagX = SensorMts300P.MagX;
+ MagY = SensorMts300P.MagY;
! SensorMts300P.WarmUpTimer -> WarmUpTimer;
! SensorMts300P.VrefRead -> VoltageC.Read;
! SensorMts300P.PhotoControl -> PhotoC.StdControl;
! SensorMts300P.TempRead -> TempC.Read;
! SensorMts300P.LightRead -> PhotoC.Read;
SensorMts300P.LightPower -> IO.PortE5;
! SensorMts300P.TempPower -> IO.PortE6;
!
! SensorMts300P.MicControl -> MicC.StdControl;
! SensorMts300P.Mic -> MicC.Mic;
! SensorMts300P.MicRead -> MicC.Read;
!
! SensorMts300P.MagControl -> MagC.StdControl;
! SensorMts300P.Mag -> MagC.Mag;
! SensorMts300P.MagXRead -> MagC.MagX;
! SensorMts300P.MagYRead -> MagC.MagY;
!
! SensorMts300P.AccelControl -> AccelC.StdControl;
! SensorMts300P.AccelXRead -> AccelC.AccelX;
! SensorMts300P.AccelYRead -> AccelC.AccelY;
!
}
Index: SensorMts300P.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/sensorboards/mts300/SensorMts300P.nc,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** SensorMts300P.nc 12 Dec 2006 18:23:46 -0000 1.4
--- SensorMts300P.nc 15 Feb 2007 10:28:46 -0000 1.5
***************
*** 1,4 ****
/**
! * Copyright (c) 2004-2005 Crossbow Technology, Inc.
* All rights reserved.
*
--- 1,4 ----
/**
! * Copyright (c) 2005-2006 Crossbow Technology, Inc.
* All rights reserved.
*
***************
*** 13,28 ****
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
! * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
! * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA,
! * OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* @author Martin Turon <mturon at xbow.com>
- * @author Miguel Freitas
*
* $Id$
--- 13,27 ----
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
! * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
! * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA,
! * OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* @author Martin Turon <mturon at xbow.com>
*
* $Id$
***************
*** 34,44 ****
* This component is the "platform" of the sensorboard space.
* It handles particulars of initialization, and glues all the
! * member sensor "chips" into one place. The current implementation
! * is overly monolithic, and should be divided into smaller
* components that handle each individual sensor. The temperature
* and light sensors are tightly coupled however and in the case
* of the micaz, interfere with the radio (INT2), so more can
* be done to clean up the design here.
! *
* @author Martin Turon
* @date October 19, 2005
--- 33,43 ----
* This component is the "platform" of the sensorboard space.
* It handles particulars of initialization, and glues all the
! * member sensor "chips" into one place. The current implementation
! * is overly monolithic, and should be divided into smaller
* components that handle each individual sensor. The temperature
* and light sensors are tightly coupled however and in the case
* of the micaz, interfere with the radio (INT2), so more can
* be done to clean up the design here.
! *
* @author Martin Turon
* @date October 19, 2005
***************
*** 46,93 ****
module SensorMts300P
{
! provides {
! interface Init; //!< Standard Initialization
! interface StdControl; //!< Start/Stop for Power Management
! interface Read<uint16_t> as Temp; //!< Thermister
! interface Read<uint16_t> as Light; //!< Photo sensor
! }
! uses {
! interface GeneralIO as TempPower;
! interface GeneralIO as LightPower;
! interface Read<uint16_t> as SensorADC;
! interface Timer<TMilli> as WarmUpTimer;
! }
}
! implementation
{
! enum {
! STATE_IDLE = 0,
! STATE_LIGHT_WARMING, //!< Powering on sensor
! STATE_LIGHT_READY, //!< Power up of sensor complete
! STATE_LIGHT_SAMPLING, //!< Sampling sensor
! STATE_TEMP_WARMING, //!< Powering on sensor
! STATE_TEMP_READY, //!< Power up of sensor complete
! STATE_TEMP_SAMPLING, //!< Sampling sensor
! };
/// Yes, this could be a simple uint8_t. There used to be more bits here,
/// but they were optimized out and removed.
! union {
! uint8_t flat;
! struct {
uint8_t state : 4; //!< sensorboard state
! } bits;
! } g_flags;
/**
* Initialize this component. Initialization should not assume that
* any component is running: init() cannot call any commands besides
! * those that initialize other components.
*
*/
! command error_t Init.init() {
! g_flags.flat = STATE_IDLE;
! return SUCCESS;
}
--- 45,124 ----
module SensorMts300P
{
! provides
! {
! interface Init; //!< Standard Initialization
! interface StdControl; //!< Start/Stop for Power Management
! interface Read<uint16_t> as Vref; //!< voltage
! interface Read<uint16_t> as Temp; //!< Thermister
! interface Read<uint16_t> as Light; //!< Photo sensor
! interface Read<uint16_t> as Microphone; //!< Mic sensor
! interface Read<uint16_t> as AccelX; //!< Accelerometer sensor
! interface Read<uint16_t> as AccelY; //!< Accelerometer sensor
! interface Read<uint16_t> as MagX; //!< magnetometer sensor
! interface Read<uint16_t> as MagY; //!< magnetometer sensor
! }
! uses
! {
! interface GeneralIO as TempPower;
! interface GeneralIO as LightPower;
! interface StdControl as PhotoControl;
! interface StdControl as MicControl;
! interface Mic;
! interface StdControl as MagControl;
! interface Mag;
! interface StdControl as AccelControl;
!
! interface Read<uint16_t> as VrefRead;
! interface Read<uint16_t> as TempRead; //!< Thermister
! interface Read<uint16_t> as LightRead; //!< Photo sensor
! interface Read<uint16_t> as MicRead; //!< Mic sensor
! interface Read<uint16_t> as AccelXRead; //!< Magnetometer sensor
! interface Read<uint16_t> as AccelYRead; //!< Magnetometer sensor
! interface Read<uint16_t> as MagXRead; //!< Magnetometer sensor
! interface Read<uint16_t> as MagYRead; //!< Magnetometer sensor
! interface Timer<TMilli> as WarmUpTimer;
! }
}
! implementation
{
! enum
! {
! STATE_IDLE = 0,
! STATE_LIGHT_WARMING, //!< Powering on sensor
! STATE_LIGHT_READY, //!< Power up of sensor complete
! STATE_LIGHT_SAMPLING, //!< Sampling sensor
! STATE_TEMP_WARMING, //!< Powering on sensor
! STATE_TEMP_READY, //!< Power up of sensor complete
! STATE_TEMP_SAMPLING, //!< Sampling sensor
! STATE_MIC_WARMING, //!< Powering on sensor
! STATE_MIC_READY, //!< Power up of sensor complete
! STATE_MIC_SAMPLING, //!< Sampling sensor
! };
/// Yes, this could be a simple uint8_t. There used to be more bits here,
/// but they were optimized out and removed.
! union
! {
! uint8_t flat;
! struct
! {
uint8_t state : 4; //!< sensorboard state
! } bits;
! } g_flags;
/**
* Initialize this component. Initialization should not assume that
* any component is running: init() cannot call any commands besides
! * those that initialize other components.
*
*/
! command error_t Init.init()
! {
! g_flags.flat = STATE_IDLE;
! call Mic.muxSel(1); // Set the mux so that raw microhpone output is selected
! call Mic.gainAdjust(64); // Set the gain of the microphone.
!
! return SUCCESS;
}
***************
*** 97,104 ****
* @return SUCCESS if the component was successfully started.
*/
! command error_t StdControl.start() {
! return SUCCESS;
}
!
/**
* Stop the component and pertinent subcomponents (not all
--- 128,140 ----
* @return SUCCESS if the component was successfully started.
*/
! command error_t StdControl.start()
! {
! call PhotoControl.start();
! call MicControl.start();
! call MagControl.start();
! call AccelControl.start();
! return SUCCESS;
}
!
/**
* Stop the component and pertinent subcomponents (not all
***************
*** 107,203 ****
* @return SUCCESS if the component was successfully stopped.
*/
! command error_t StdControl.stop() {
! call TempPower.clr();
! call LightPower.clr();
! call TempPower.makeInput();
! call LightPower.makeInput();
! atomic g_flags.bits.state = STATE_IDLE;
! return SUCCESS;
}
/** Turns on the light sensor and turns the thermistor off. */
! void switchLightOn() {
! atomic g_flags.bits.state = STATE_LIGHT_WARMING;
! call TempPower.clr();
! call TempPower.makeInput();
! call LightPower.makeOutput();
! call LightPower.set();
! call WarmUpTimer.startOneShot(10);
}
/** Turns on the thermistor and turns the light sensor off. */
! void switchTempOn() {
! atomic g_flags.bits.state = STATE_TEMP_WARMING;
! call LightPower.clr();
! call LightPower.makeInput();
! call TempPower.makeOutput();
! call TempPower.set();
! call WarmUpTimer.startOneShot(10);
}
! task void getLightSample() {
! switch (g_flags.bits.state) {
! case STATE_TEMP_WARMING:
! case STATE_TEMP_READY:
! case STATE_TEMP_SAMPLING:
! // If Temperature is busy, repost and try again later.
! // This will not let the CPU sleep. Add delay timer.
! post getLightSample();
! return;
!
! case STATE_IDLE:
! // Okay, grab the sensor.
! switchLightOn();
! return;
!
! case STATE_LIGHT_WARMING:
! // Warm-up Timer will switch out of this state.
! return;
!
! case STATE_LIGHT_READY:
! // Start the sample.
! atomic { g_flags.bits.state = STATE_LIGHT_SAMPLING; }
! call SensorADC.read();
! return;
!
! case STATE_LIGHT_SAMPLING:
! // SensorADC.dataReady will switch out of this state.
! return;
! }
}
! task void getTempSample() {
! switch (g_flags.bits.state) {
! case STATE_LIGHT_WARMING:
! case STATE_LIGHT_READY:
! case STATE_LIGHT_SAMPLING:
! // If Temperature is busy, repost and try again later.
! // This will not let the CPU sleep. Add delay timer.
! post getTempSample();
! return;
!
! case STATE_IDLE:
! // Okay, grab the sensor.
! switchTempOn();
! return;
!
! case STATE_TEMP_WARMING:
! // Warm-up Timer will switch out of this state.
! return;
! case STATE_TEMP_READY:
! // Start the sample.
! atomic { g_flags.bits.state = STATE_TEMP_SAMPLING; }
! call SensorADC.read();
! return;
! case STATE_TEMP_SAMPLING:
! // SensorADC.dataReady will switch out of this state.
! return;
! }
}
! /**
! * Start Temperature data acquisition.
*
* This will post a task which will handle sequential states:
--- 143,255 ----
* @return SUCCESS if the component was successfully stopped.
*/
! command error_t StdControl.stop()
! {
! call TempPower.clr();
! call LightPower.clr();
! call TempPower.makeInput();
! call LightPower.makeInput();
! atomic g_flags.bits.state = STATE_IDLE;
!
! call PhotoControl.stop();
! call MicControl.stop();
! call MagControl.stop();
! call AccelControl.stop();
!
! return SUCCESS;
}
/** Turns on the light sensor and turns the thermistor off. */
! void switchLightOn()
! {
! atomic g_flags.bits.state = STATE_LIGHT_WARMING;
! call TempPower.clr();
! call TempPower.makeInput();
! call LightPower.makeOutput();
! call LightPower.set();
! call WarmUpTimer.startOneShot(10);
}
/** Turns on the thermistor and turns the light sensor off. */
! void switchTempOn()
! {
! atomic g_flags.bits.state = STATE_TEMP_WARMING;
! call LightPower.clr();
! call LightPower.makeInput();
! call TempPower.makeOutput();
! call TempPower.set();
! call WarmUpTimer.startOneShot(10);
}
! void switchMicOn()
! {
! atomic g_flags.bits.state = STATE_MIC_WARMING;
! call WarmUpTimer.startOneShot(10);
}
! task void getLightSample()
! {
! switch (g_flags.bits.state)
! {
! case STATE_IDLE:
! // Okay, grab the sensor.
! switchLightOn();
! return;
! case STATE_LIGHT_READY:
! // Start the sample.
! atomic { g_flags.bits.state = STATE_LIGHT_SAMPLING; }
! call LightRead.read();
! return;
! case STATE_LIGHT_WARMING:
! // Warm-up Timer will switch out of this state.
! case STATE_LIGHT_SAMPLING:
! // LightRead.readDone will switch out of this state.
! return;
! }
! }
! task void getTempSample()
! {
! switch (g_flags.bits.state)
! {
! case STATE_IDLE:
! // Okay, grab the sensor.
! switchTempOn();
! return;
! case STATE_TEMP_READY:
! // Start the sample.
! atomic { g_flags.bits.state = STATE_TEMP_SAMPLING; }
! call TempRead.read();
! return;
! case STATE_TEMP_WARMING:
! // Warm-up Timer will switch out of this state.
! case STATE_TEMP_SAMPLING:
! // TempRead.readDone will switch out of this state.
! return;
! }
! }
! task void getMicSample()
! {
! switch (g_flags.bits.state)
! {
! case STATE_IDLE:
! // Okay, grab the sensor.
! switchMicOn();
! return;
! case STATE_MIC_READY:
! // Start the sample.
! atomic { g_flags.bits.state = STATE_MIC_SAMPLING; }
! call MicRead.read();
! return;
! case STATE_MIC_WARMING:
! // Warm-up Timer will switch out of this state.
! case STATE_MIC_SAMPLING:
! // MicRead.readDone will switch out of this state.
! return;
! }
}
! /**
! * Start Temperature data acquisition.
*
* This will post a task which will handle sequential states:
***************
*** 208,283 ****
* 'dataReady' or 'error' will be signaled if SUCCESS is returned
*/
! command error_t Temp.read() {
! post getTempSample();
! return SUCCESS;
}
!
! /**
! * Start Light data acquisition.
! *
! * This will post a task which will handle sequential states:
! * WARMING, READY, SAMPLING, DONE (IDLE)
! * and repost itself until it is completed.
! *
! * @return SUCCESS if request accepted, EBUSY if it is refused
! * 'dataReady' or 'error' will be signaled if SUCCESS is returned
! */
! command error_t Light.read() {
! post getLightSample();
! return SUCCESS;
}
!
! /**
* Timer to allow either thermistor or light sensor to warm up for 10 msec.
*/
! event void WarmUpTimer.fired() {
! switch (g_flags.bits.state) {
! case STATE_LIGHT_WARMING:
! atomic { g_flags.bits.state = STATE_LIGHT_READY; }
! post getLightSample();
! return;
! case STATE_TEMP_WARMING:
! atomic { g_flags.bits.state = STATE_TEMP_READY; }
! post getTempSample();
! return;
! default:
! //ERROR!!!
! signal Light.readDone( FAIL, 0 );
! signal Temp.readDone( FAIL, 0 );
! }
! // Worst case -- return to the IDLE state so next task can progress !!
! atomic { g_flags.bits.state = STATE_IDLE; }
}
! /**
* Data has been acquired.
! * @param data Acquired value
! * Values are "left-justified" within each 16-bit integer, i.e., if
! * the data is acquired with n bits of precision, each value is
! * shifted left by 16-n bits.
*/
! event void SensorADC.readDone( error_t result, uint16_t data ) {
! switch (g_flags.bits.state) {
case STATE_LIGHT_SAMPLING:
! signal Light.readDone(result, data);
! break;
case STATE_TEMP_SAMPLING:
! signal Temp.readDone(result, data);
! break;
!
! default:
! //ERROR!!!
! signal Light.readDone( FAIL, 0 );
! signal Temp.readDone( FAIL, 0 );
! }
! // ADC.dataReady must return to IDLE state so next task can progress !!
! atomic { g_flags.bits.state = STATE_IDLE; }
}
}
--- 260,449 ----
* 'dataReady' or 'error' will be signaled if SUCCESS is returned
*/
! command error_t Temp.read()
! {
! post getTempSample();
! return SUCCESS;
}
! command error_t Light.read()
! {
! post getLightSample();
! return SUCCESS;
}
! command error_t Microphone.read()
! {
! post getMicSample();
! return SUCCESS;
! }
! command error_t Vref.read()
! {
! call VrefRead.read();
! return SUCCESS;
! }
! command error_t AccelX.read()
! {
! //signal AccelX.readDone(SUCCESS,0x1);
! call AccelXRead.read();
! return SUCCESS;
! }
! command error_t AccelY.read()
! {
! //signal AccelY.readDone(SUCCESS,0x2);
! call AccelYRead.read();
! return SUCCESS;
! }
! command error_t MagX.read()
! {
! //signal MagX.readDone(SUCCESS,0x3);
! call MagXRead.read();
! return SUCCESS;
! }
! command error_t MagY.read()
! {
! //signal MagY.readDone(SUCCESS,0x4);
! call MagYRead.read();
! return SUCCESS;
! }
! /**
* Timer to allow either thermistor or light sensor to warm up for 10 msec.
*/
! event void WarmUpTimer.fired()
! {
! switch (g_flags.bits.state)
! {
! case STATE_LIGHT_WARMING:
! atomic { g_flags.bits.state = STATE_LIGHT_READY; }
! post getLightSample();
! return;
! case STATE_TEMP_WARMING:
! atomic { g_flags.bits.state = STATE_TEMP_READY; }
! post getTempSample();
! return;
! case STATE_MIC_WARMING:
! atomic { g_flags.bits.state = STATE_MIC_READY; }
! post getMicSample();
! return;
!
! default:
! //ERROR!!!
! signal Light.readDone(FAIL,0);
! signal Temp.readDone(FAIL,0);
! signal Microphone.readDone(FAIL,0);
! }
! // Worst case -- return to the IDLE state so next task can progress !!
! atomic { g_flags.bits.state = STATE_IDLE; }
}
! /**
* Data has been acquired.
! * @param result Acquired success flag
! * @param val Acquired value
*/
! event void LightRead.readDone( error_t result, uint16_t val )
! {
! //val = (val >>6);
! val &= 0x3ff;
! switch (g_flags.bits.state)
! {
case STATE_LIGHT_SAMPLING:
! signal Light.readDone(result,val);
! break;
! default: //ERROR!!!
! signal Light.readDone(FAIL,0);
! }
! // state must return to IDLE state so next task can progress !!
! atomic { g_flags.bits.state = STATE_IDLE; }
! }
+ event void TempRead.readDone( error_t result, uint16_t val )
+ {
+ //val = (val >>6);
+ val &= 0x3ff;
+ switch (g_flags.bits.state)
+ {
case STATE_TEMP_SAMPLING:
! signal Temp.readDone(result,val);
! break;
! default: //ERROR!!!
! signal Temp.readDone(FAIL,0);
! }
! // state must return to IDLE state so next task can progress !!
! atomic { g_flags.bits.state = STATE_IDLE; }
}
+ event void MicRead.readDone( error_t result, uint16_t val )
+ {
+ //val = (val >>6);
+ val &= 0x3ff;
+ switch (g_flags.bits.state)
+ {
+ case STATE_MIC_SAMPLING:
+ signal Microphone.readDone(result,val);
+ break;
+ default: //ERROR!!!
+ signal Microphone.readDone(FAIL,0);
+ }
+ // state must return to IDLE state so next task can progress !!
+ atomic { g_flags.bits.state = STATE_IDLE; }
+ }
+
+ event void VrefRead.readDone( error_t result, uint16_t val )
+ {
+ //val = (val >>6);
+ val &= 0x3ff;
+ signal Vref.readDone(result,val);
+ // state must return to IDLE state so next task can progress !!
+ atomic { g_flags.bits.state = STATE_IDLE; }
+ }
+
+ event void AccelXRead.readDone( error_t result, uint16_t val )
+ {
+ //val = (val >>6);
+ val &= 0x3ff;
+ signal AccelX.readDone(result,val);
+ // state must return to IDLE state so next task can progress !!
+ atomic { g_flags.bits.state = STATE_IDLE; }
+ }
+
+ event void AccelYRead.readDone( error_t result, uint16_t val )
+ {
+ //val = (val >>6);
+ val &= 0x3ff;
+ signal AccelY.readDone(result,val);
+ // state must return to IDLE state so next task can progress !!
+ atomic { g_flags.bits.state = STATE_IDLE; }
+ }
+
+ event void MagXRead.readDone( error_t result, uint16_t val )
+ {
+ //val = (val >>6);
+ val &= 0x3ff;
+ signal MagX.readDone(result,val);
+ // state must return to IDLE state so next task can progress !!
+ atomic { g_flags.bits.state = STATE_IDLE; }
+ }
+
+ event void MagYRead.readDone( error_t result, uint16_t val )
+ {
+ //val = (val >>6);
+ val &= 0x3ff;
+ signal MagY.readDone(result,val);
+ // state must return to IDLE state so next task can progress !!
+ atomic { g_flags.bits.state = STATE_IDLE; }
+ }
+
+ event error_t Mag.gainAdjustXDone(bool result)
+ {
+ return result;
+ }
+ event error_t Mag.gainAdjustYDone(bool result)
+ {
+ return result;
+ }
}
+
+
Index: SounderC.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/sensorboards/mts300/SounderC.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SounderC.nc 8 Feb 2007 17:55:36 -0000 1.1
--- SounderC.nc 15 Feb 2007 10:28:46 -0000 1.2
***************
*** 1,12 ****
configuration SounderC
{
! provides interface Mts300Sounder;
}
implementation
{
! components SounderP, new TimerMilliC(), MicaBusC;
! Mts300Sounder = SounderP;
! SounderP.Timer -> TimerMilliC;
SounderP.SounderPin -> MicaBusC.PW2;
}
--- 1,45 ----
+ /**
+ * Copyright (c) 2005-2006 Crossbow Technology, Inc.
+ * All rights reserved.
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose, without fee, and without written
+ * agreement is hereby granted, provided that the above copyright
+ * notice, the (updated) modification history and the author appear in
+ * all copies of this source code.
+ *
+ * Permission is also granted to distribute this software under the
+ * standard BSD license as contained in the TinyOS distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA,
+ * OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+ /*
+ * @author Hu Siquan <husq at xbow.com>
+ *
+ * $Id$
+ */
+
+ #include "mts300.h"
+
configuration SounderC
{
! provides interface Init;
! provides interface StdControl;
}
implementation
{
! components SounderP, MicaBusC;
! Init = SounderP;
! StdControl = SounderP;
SounderP.SounderPin -> MicaBusC.PW2;
}
Index: SounderP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/sensorboards/mts300/SounderP.nc,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** SounderP.nc 8 Feb 2007 17:55:36 -0000 1.1
--- SounderP.nc 15 Feb 2007 10:28:46 -0000 1.2
***************
*** 1,31 ****
! module SounderP
{
! provides interface Mts300Sounder;
! uses {
! interface Timer<TMilli>;
! interface GeneralIO as SounderPin;
! }
}
- implementation
- {
- command void Mts300Sounder.beep(uint16_t length) {
- if (call Timer.isRunning())
- {
- uint32_t remaining = call Timer.getdt(),
- elapsed = call Timer.getNow() - call Timer.gett0();
! /* If more time left than we are requesting, just exit */
! if (remaining > elapsed && (remaining - elapsed) > length)
! return;
!
! /* Override timer with new duration */
! }
! call Timer.startOneShot(length);
call SounderPin.makeOutput();
call SounderPin.set();
}
! event void Timer.fired() {
call SounderPin.clr();
}
}
--- 1,65 ----
! /**
! * Copyright (c) 2005-2006 Crossbow Technology, Inc.
! * All rights reserved.
! *
! * Permission to use, copy, modify, and distribute this software and its
! * documentation for any purpose, without fee, and without written
! * agreement is hereby granted, provided that the above copyright
! * notice, the (updated) modification history and the author appear in
! * all copies of this source code.
! *
! * Permission is also granted to distribute this software under the
! * standard BSD license as contained in the TinyOS distribution.
! *
! * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
! * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
! * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
! * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
! * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, LOSS OF USE, DATA,
! * OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
! * THE POSSIBILITY OF SUCH DAMAGE.
! *
! * @author Hu Siquan <husq at xbow.com>
! *
! * $Id$
! */
!
! #include "mts300.h"
!
! module SounderP
{
! provides interface Init;
! provides interface StdControl;
! uses interface GeneralIO as SounderPin;
}
! implementation
! {
! command error_t Init.init()
! {
! #if SOUNDER
call SounderPin.makeOutput();
+ call SounderPin.clr();
+ #endif
+ return SUCCESS;
+ }
+
+ command error_t StdControl.start()
+ {
+ #if SOUNDER
call SounderPin.set();
+ #endif
+ return SUCCESS;
}
! command error_t StdControl.stop()
! {
! #if SOUNDER
call SounderPin.clr();
+ #endif
+ return SUCCESS;
}
}
Index: mts300.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/sensorboards/mts300/mts300.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** mts300.h 9 Feb 2007 21:31:12 -0000 1.1
--- mts300.h 15 Feb 2007 10:28:46 -0000 1.2
***************
*** 1,9 ****
! #ifndef MTS300_H
! #define MTS300_H
! #define UQ_ACCEL_RESOURCE "mts300.accel"
! #define UQ_PHOTO_RESOURCE "mts300.photo"
! #define UQ_TEMP_RESOURCE "mts300.temp"
! #define UQ_PHOTOTEMP_RESOURCE "mts300.phototemp"
#endif
--- 1,55 ----
! /* $Id$ */
! /*
! * Copyright (c) 2005-2006 Crossbow Technology, Inc. All rights reserved.
! *
! * Permission to use, copy, modify, and distribute this software and its
! * documentation for any purpose, without fee, and without written agreement is
! * hereby granted, provided that the above copyright notice, the following
! * two paragraphs and the author appear in all copies of this software.
! *
! * IN NO EVENT SHALL CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS BE LIABLE TO
! * ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
! * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
! * IF CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
! * DAMAGE.
! *
! * CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL WARRANTIES,
! * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
! * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
! * ON AN "AS IS" BASIS, AND NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY
! * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
! * MODIFICATIONS.
! */
! /**
! *
! * @author Hu Siquan <husq at xbow.com>
! * Revision: $Revision$
! *
! */
! #ifndef _MTS300_H
! #define _MTS300_H
+ // sounder enable (1) /disable (0)
+ #ifndef SOUNDER
+ #define SOUNDER 1
#endif
+
+ #define MTS3X0_PHOTO_TEMP "mts300.photo.temp"
+ #define MTS3X0_MAG_RESOURCE "mts300.mag"
+
+ enum
+ {
+ TOS_MIC_POT_ADDR = 0x5A,
+ TOS_MAG_POT_ADDR = 0x58,
+ };
+
+ // debug leds
+ //#define _DEBUG_LEDS
+ #ifdef _DEBUG_LEDS
+ #define DEBUG_LEDS(X) X.DebugLeds -> LedsC
+ #else
+ #define DEBUG_LEDS(X) X.DebugLeds -> NoLedsC
+ #endif
+ #endif /* _MTS300_H */
+
- Previous message: [Tinyos-2-commits] CVS: tinyos-2.x/apps/tests/mica2/mts300
XMTS300.h, NONE, 1.1 Makefile, 1.3, 1.4 TestMts300C.nc, 1.4,
1.5 TestMts300P.nc, 1.4, 1.5
- Next message: [Tinyos-2-commits] CVS: tinyos-2.x/tos/sensorboards/mts300
AccelC.nc, NONE, 1.1 Mag.nc, NONE, 1.1 MagC.nc, NONE,
1.1 MagConfigP.nc, NONE, 1.1 MagP.nc, NONE, 1.1 Mic.nc, 1.2,
1.3 MicC.nc, NONE, 1.1 MicDeviceP.nc, NONE,
1.1 MicInterrupt.nc, NONE, 1.1 MicP.nc, NONE,
1.1 PhotoTempDeviceP.nc, NONE, 1.1 TempC.nc, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Tinyos-2-commits
mailing list