From 230e3a391fb85cf528910fd82512ae1f7ce70c95 Mon Sep 17 00:00:00 2001 From: pipeng Date: Wed, 14 Mar 2007 07:26:16 +0000 Subject: [PATCH] Remove some old files . --- tos/sensorboards/mts300/.sensor | 16 - tos/sensorboards/mts300/AccelC.nc | 57 --- tos/sensorboards/mts300/MagC.nc | 59 --- tos/sensorboards/mts300/Mic.nc | 72 ---- tos/sensorboards/mts300/MicInterrupt.nc | 67 --- tos/sensorboards/mts300/PhotoTempDeviceP.nc | 51 --- tos/sensorboards/mts300/SensorMts300P.nc | 449 -------------------- 7 files changed, 771 deletions(-) delete mode 100644 tos/sensorboards/mts300/.sensor delete mode 100644 tos/sensorboards/mts300/AccelC.nc delete mode 100644 tos/sensorboards/mts300/MagC.nc delete mode 100644 tos/sensorboards/mts300/Mic.nc delete mode 100644 tos/sensorboards/mts300/MicInterrupt.nc delete mode 100644 tos/sensorboards/mts300/PhotoTempDeviceP.nc delete mode 100644 tos/sensorboards/mts300/SensorMts300P.nc diff --git a/tos/sensorboards/mts300/.sensor b/tos/sensorboards/mts300/.sensor deleted file mode 100644 index 191bed2b..00000000 --- a/tos/sensorboards/mts300/.sensor +++ /dev/null @@ -1,16 +0,0 @@ -# -# FILE: mts300/.sensor -# -# Includes that should take precedence come first. Sensorboard "superclasses" -# come before because they may override files. These must be specified as -# @includes instead of -I's to @opts, otherwise the %T won't be processed -# by ncc. And because of that, the current sensorboard's include directory -# must be specified, otherwise its search order is last instead of first. -# -# $Id$ -# -push( @includes, qw( - %T/sensorboards/mts300_me - %T/chips/atm128/i2c -# %T/chips/atm128/adc -) ); diff --git a/tos/sensorboards/mts300/AccelC.nc b/tos/sensorboards/mts300/AccelC.nc deleted file mode 100644 index 00102abb..00000000 --- a/tos/sensorboards/mts300/AccelC.nc +++ /dev/null @@ -1,57 +0,0 @@ -// $Id$ - -/* tab:4 - * "Copyright (c) 2000-2003 The Regents of the University of California. - * 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 THE UNIVERSITY OF CALIFORNIA 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 THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY 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 THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." - * - * Copyright (c) 2002-2003 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. - */ -#include "mts300.h" - -generic configuration AccelC () -{ - provides interface Init; - provides interface StdControl; - provides interface Read as AccelX; - provides interface Read as AccelY; -} -implementation -{ - components AccelConfigP, - new AdcReadClientC() as AdcX, - new AdcReadClientC() as AdcY; - - Init = AccelConfigP; - StdControl = AccelConfigP; - - AccelX = AdcX; - AdcX.Atm128AdcConfig -> AccelConfigP.ConfigX; - AdcX.ResourceConfigure -> AccelConfigP.ResourceX; - - AccelY = AdcY; - AdcY.Atm128AdcConfig -> AccelConfigP.ConfigY; - AdcY.ResourceConfigure -> AccelConfigP.ResourceY; -} - diff --git a/tos/sensorboards/mts300/MagC.nc b/tos/sensorboards/mts300/MagC.nc deleted file mode 100644 index 0945d43d..00000000 --- a/tos/sensorboards/mts300/MagC.nc +++ /dev/null @@ -1,59 +0,0 @@ -// $Id$ - -/* tab:4 - * "Copyright (c) 2000-2003 The Regents of the University of California. - * 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 THE UNIVERSITY OF CALIFORNIA 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 THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY 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 THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." - * - * Copyright (c) 2002-2003 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. - */ -#include "mts300.h" - -generic configuration MagC () -{ - provides interface Init; - provides interface StdControl; - provides interface Read as MagX; - provides interface Read as MagY; - provides interface Mag; -} -implementation -{ - components MagConfigP, - new AdcReadClientC() as AdcX, - new AdcReadClientC() as AdcY; - - Init = MagConfigP; - StdControl = MagConfigP; - Mag = MagConfigP; - - MagX = AdcX; - AdcX.Atm128AdcConfig -> MagConfigP.ConfigX; - AdcX.ResourceConfigure -> MagConfigP.ResourceX; - - MagY = AdcY; - AdcY.Atm128AdcConfig -> MagConfigP.ConfigY; - AdcY.ResourceConfigure -> MagConfigP.ResourceY; -} - diff --git a/tos/sensorboards/mts300/Mic.nc b/tos/sensorboards/mts300/Mic.nc deleted file mode 100644 index 8c68a64b..00000000 --- a/tos/sensorboards/mts300/Mic.nc +++ /dev/null @@ -1,72 +0,0 @@ -// $Id$ - -/* tab:4 - * "Copyright (c) 2000-2003 The Regents of the University of California. - * 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 THE UNIVERSITY OF CALIFORNIA 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 THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY 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 THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." - * - * Copyright (c) 2002-2003 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. - */ - -/* - * Authors: Alec Woo - * Date last modified: 8/20/02 - * - * The microphone on the mica sensor board has two methods for control and - * one method to read the binary output of the tone detector. (Note: The tone - * detector's binary output can be configured as an interrupt. Please see MicInterrupt.ti) - * - * muxSel allows users to switch the ADC to sample from phase lock loop output of - * the tone detector (by setting the value to 0 (default)) or the raw voice-band output - * of the micrphone (by setting the value to 1). - * - * gainAdjust allows users to adjust the amplification gain on the microphone. The range - * is 0 to 255 with 0 being the minmum and 255 being the maximum amplification. Note that - * setting amplification too high can result in clipping (signal distortion). - * - * If an audio signal at 4.3kHz is picked up by the microphone, the tone - * detect will decode it and generate a binary ouput (0 meaning tone is detected, 1 meaning - * tone is not detected). Users can read this output simply by calling readToneDetector(). - * - */ - -/** - * @author Alec Woo - */ - -interface Mic { - /* Effect: Set the multiplexer's setting on the microphone - * Return: returns SUCCESS or FAIL - */ - command error_t muxSel(uint8_t sel); - /* Effect: Set the amplificatoin gain on the microphone - * Return: returns SUCCESS or FAIL - */ - command error_t gainAdjust(uint8_t val); - - /* Effect: returns the binary tone detector's output - * Return: 0 meaning tone is detected, 1 meanning tone is not detected - */ - command uint8_t readToneDetector(); -} diff --git a/tos/sensorboards/mts300/MicInterrupt.nc b/tos/sensorboards/mts300/MicInterrupt.nc deleted file mode 100644 index 780f70ce..00000000 --- a/tos/sensorboards/mts300/MicInterrupt.nc +++ /dev/null @@ -1,67 +0,0 @@ -// $Id$ - -/* tab:4 - * "Copyright (c) 2000-2003 The Regents of the University of California. - * 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 THE UNIVERSITY OF CALIFORNIA 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 THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY 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 THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS." - * - * Copyright (c) 2002-2003 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. - */ -/* - * Authors: Alec Woo - * Date last modified: 8/20/02 - * - * The microphone on the mica sensor board has the tone detector interrupt. - * If an audio signal at 4.3kHz is picked up by the microphone, the tone - * detect will decode it and generate a toneDetected interrupt if the - * interrupt is enabled. - * - */ - -/** - * @author Alec Woo - */ - - - -interface MicInterrupt -{ - /* Effects: disable interrupts - Returns: SUCCESS - */ - async command error_t disable(); - - /* Effects: enable interrupts - Returns: SUCCESS - */ - async command error_t enable(); - - /* Interrupt signal for tone detected. Note that MicInterrupt is automatically disabled - * before this event is signaled. (Upper layer needs to reenable this interrupt for future - * tone detect. - * - * Returns: SUCCESS - */ - async event error_t toneDetected(); -} diff --git a/tos/sensorboards/mts300/PhotoTempDeviceP.nc b/tos/sensorboards/mts300/PhotoTempDeviceP.nc deleted file mode 100644 index 9678df50..00000000 --- a/tos/sensorboards/mts300/PhotoTempDeviceP.nc +++ /dev/null @@ -1,51 +0,0 @@ -/* $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 PhotoTempDeviceP -{ - provides - { - interface Init; - interface StdControl; - interface ResourceConfigure as PhotoResourceConfigure; - interface Atm128AdcConfig as PhotoAtm128AdcConfig; - interface ResourceConfigure as TempResourceConfigure; - interface Atm128AdcConfig as TempAtm128AdcConfig; - } -} -implementation -{ - components PhotoTempP, MicaBusC, HplAtm128GeneralIOC as Pins; -// components new FcfsArbiterC(MTS3X0_PHOTO_TEMP) as Arbiter; - components LedsC, NoLedsC; - - Init = PhotoTempP; - StdControl = PhotoTempP; - - PhotoResourceConfigure = PhotoTempP.PhotoResourceConfigure; - PhotoAtm128AdcConfig = PhotoTempP.PhotoAtm128AdcConfig; - - TempResourceConfigure = PhotoTempP.TempResourceConfigure; - TempAtm128AdcConfig = PhotoTempP.TempAtm128AdcConfig; - - PhotoTempP.LightPower -> Pins.PortE5; - PhotoTempP.TempPower -> Pins.PortE6; - PhotoTempP.SensorAdc -> MicaBusC.Adc1; - - DEBUG_LEDS(PhotoTempP); -} diff --git a/tos/sensorboards/mts300/SensorMts300P.nc b/tos/sensorboards/mts300/SensorMts300P.nc deleted file mode 100644 index 82a90bde..00000000 --- a/tos/sensorboards/mts300/SensorMts300P.nc +++ /dev/null @@ -1,449 +0,0 @@ -/** - * 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 - * - * $Id$ - */ - -#include "Timer.h" - -/** - * 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 - */ -module SensorMts300P -{ - provides - { - interface Init; //!< Standard Initialization - interface StdControl; //!< Start/Stop for Power Management - interface Read as Vref; //!< voltage - interface Read as Temp; //!< Thermister - interface Read as Light; //!< Photo sensor - interface Read as Microphone; //!< Mic sensor - interface Read as AccelX; //!< Accelerometer sensor - interface Read as AccelY; //!< Accelerometer sensor - interface Read as MagX; //!< magnetometer sensor - interface Read 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 as VrefRead; - interface Read as TempRead; //!< Thermister - interface Read as LightRead; //!< Photo sensor - interface Read as MicRead; //!< Mic sensor - interface Read as AccelXRead; //!< Magnetometer sensor - interface Read as AccelYRead; //!< Magnetometer sensor - interface Read as MagXRead; //!< Magnetometer sensor - interface Read as MagYRead; //!< Magnetometer sensor - interface Timer 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; - } - - /** - * Start the component and its subcomponents. - * - * @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 - * 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(); - 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: - * 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 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; - } -} - - - - - -- 2.39.2