From: klueska Date: Tue, 21 Aug 2007 04:44:09 +0000 (+0000) Subject: Initial checkin of driver for the mda100ca/cb sensorboard. Devices attached to the... X-Git-Tag: release_tinyos_2_1_0_0~787 X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=commitdiff_plain;h=c19e79604a31c7f08e963f6d0a27d487cab8dff0;p=tinyos-2.x.git Initial checkin of driver for the mda100ca/cb sensorboard. Devices attached to the prototype portion of the board should have drivers that follow a similar implementation pattern as the ones for the Photo and Temperature sensors. --- diff --git a/tos/sensorboards/mda100/ArbitratedPhotoDeviceP.nc b/tos/sensorboards/mda100/ArbitratedPhotoDeviceP.nc new file mode 100644 index 00000000..7668a039 --- /dev/null +++ b/tos/sensorboards/mda100/ArbitratedPhotoDeviceP.nc @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007 Stanford University. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * - Neither the name of the Stanford University nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 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 STANFORD + * UNIVERSITY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * 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 Kevin Klues + * @date August 20th, 2007 + */ + +configuration ArbitratedPhotoDeviceP +{ + provides interface Read[uint8_t client]; +} +implementation +{ + components PhotoImplP, + new ArbitratedReadC(uint16_t) as ArbitrateRead; + + Read = ArbitrateRead; + ArbitrateRead.Service -> PhotoImplP.Read; + ArbitrateRead.Resource -> PhotoImplP.Resource; +} diff --git a/tos/sensorboards/mda100/ArbitratedTempDeviceP.nc b/tos/sensorboards/mda100/ArbitratedTempDeviceP.nc new file mode 100644 index 00000000..94f7af96 --- /dev/null +++ b/tos/sensorboards/mda100/ArbitratedTempDeviceP.nc @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2007 Stanford University. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * - Neither the name of the Stanford University nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 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 STANFORD + * UNIVERSITY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * 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 Kevin Klues + * @date August 20th, 2007 + */ + +configuration ArbitratedTempDeviceP +{ + provides interface Read[uint8_t client]; +} +implementation +{ + components TempImplP, + new ArbitratedReadC(uint16_t) as ArbitrateRead; + + Read = ArbitrateRead; + ArbitrateRead.Service -> TempImplP.Read; + ArbitrateRead.Resource -> TempImplP.Resource; +} diff --git a/tos/sensorboards/mda100/DemoSensorC.nc b/tos/sensorboards/mda100/DemoSensorC.nc new file mode 100644 index 00000000..3e67b8e2 --- /dev/null +++ b/tos/sensorboards/mda100/DemoSensorC.nc @@ -0,0 +1,23 @@ +/* $Id$ + * Copyright (c) 2005 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. + */ +/** + * Demo sensor for basicsb sensorboard. + * + * @author David Gay + */ + +generic configuration DemoSensorC() { + provides interface Read; +} +implementation { + components new PhotoC() as Sensor; + + Read = Sensor; +} diff --git a/tos/sensorboards/mda100/PhotoC.nc b/tos/sensorboards/mda100/PhotoC.nc new file mode 100644 index 00000000..05fd6aea --- /dev/null +++ b/tos/sensorboards/mda100/PhotoC.nc @@ -0,0 +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 mda100 sensor board. + * + * @author David Gay + */ + +#include "mda100.h" + +generic configuration PhotoC() { + provides interface Read; +} +implementation { + components ArbitratedPhotoDeviceP; + + Read = ArbitratedPhotoDeviceP.Read[unique(UQ_MDA100_PHOTO_RESOURCE)]; +} diff --git a/tos/sensorboards/mda100/PhotoImplP.nc b/tos/sensorboards/mda100/PhotoImplP.nc new file mode 100644 index 00000000..d85ff7b9 --- /dev/null +++ b/tos/sensorboards/mda100/PhotoImplP.nc @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2007 Stanford University. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * - Neither the name of the Stanford University nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 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 STANFORD + * UNIVERSITY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * 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 Kevin Klues + * @date August 20th, 2007 + */ + +#include "mda100.h" + +configuration PhotoImplP { + provides { + interface Resource[uint8_t]; + interface Read[uint8_t]; + } +} +implementation { + components new SharedAnalogDeviceC(UQ_MDA100_PHOTO_RESOURCE, 10); + components MicaBusC; + components PhotoTempConfigC as PhotoConfigC; + + Resource = SharedAnalogDeviceC; + Read = SharedAnalogDeviceC; + SharedAnalogDeviceC.AdcConfig -> PhotoConfigC; + SharedAnalogDeviceC.EnablePin -> MicaBusC.Int1; +} diff --git a/tos/sensorboards/mda100/PhotoTempConfigC.nc b/tos/sensorboards/mda100/PhotoTempConfigC.nc new file mode 100644 index 00000000..82374a46 --- /dev/null +++ b/tos/sensorboards/mda100/PhotoTempConfigC.nc @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2007 Stanford University. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * - Neither the name of the Stanford University nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 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 STANFORD + * UNIVERSITY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * 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 Kevin Klues + * @date August 20th, 2007 + */ + +configuration PhotoTempConfigC { + provides interface Atm128AdcConfig; +} +implementation { + components PhotoTempConfigP; + components MicaBusC; + Atm128AdcConfig = PhotoTempConfigP; + + PhotoTempConfigP.PhotoTempAdc -> MicaBusC.Adc1; +} diff --git a/tos/sensorboards/mda100/PhotoTempConfigP.nc b/tos/sensorboards/mda100/PhotoTempConfigP.nc new file mode 100644 index 00000000..9cbbd645 --- /dev/null +++ b/tos/sensorboards/mda100/PhotoTempConfigP.nc @@ -0,0 +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. + */ +/** + * MDA100 photo and temp sensor ADC configuration. + * @author David Gay + */ +module PhotoTempConfigP +{ + 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; + } +} diff --git a/tos/sensorboards/mda100/SharedAnalogDeviceC.nc b/tos/sensorboards/mda100/SharedAnalogDeviceC.nc new file mode 100644 index 00000000..d9a87f22 --- /dev/null +++ b/tos/sensorboards/mda100/SharedAnalogDeviceC.nc @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2007 Stanford University. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * - Neither the name of the Stanford University nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 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 STANFORD + * UNIVERSITY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * 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 Kevin Klues + * @date August 20th, 2007 + */ + +generic configuration SharedAnalogDeviceC(char resourceName[], uint32_t startup_delay) { + provides { + interface Resource[uint8_t]; + interface Read[uint8_t]; + } + uses { + interface Atm128AdcConfig as AdcConfig; + interface GeneralIO as EnablePin; + } +} +implementation { + components new RoundRobinArbiterC(resourceName) as Arbiter; + components new SplitControlPowerManagerC() as PowerManager; + components new SharedAnalogDeviceP(startup_delay) as AnalogDevice; + components new AdcReadNowClientC() as Adc; + components new TimerMilliC(); + Resource = Arbiter; + Read = AnalogDevice; + + PowerManager.ArbiterInfo -> Arbiter; + PowerManager.SplitControl -> AnalogDevice; + PowerManager.ResourceDefaultOwner -> Arbiter; + AnalogDevice.ActualRead -> Adc; + AnalogDevice.Timer -> TimerMilliC; + AnalogDevice.AnalogDeviceResource -> Adc; + + Adc.Atm128AdcConfig = AdcConfig; + AnalogDevice.EnablePin = EnablePin; +} diff --git a/tos/sensorboards/mda100/SharedAnalogDeviceP.nc b/tos/sensorboards/mda100/SharedAnalogDeviceP.nc new file mode 100644 index 00000000..d6d017d0 --- /dev/null +++ b/tos/sensorboards/mda100/SharedAnalogDeviceP.nc @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2007 Stanford University. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * - Neither the name of the Stanford University nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 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 STANFORD + * UNIVERSITY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * 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 Kevin Klues + * @date August 20th, 2007 + */ + +generic module SharedAnalogDeviceP(uint32_t startup_delay) { + provides { + interface SplitControl; + interface Read[uint8_t]; + } + uses { + interface Resource as AnalogDeviceResource; + interface Timer; + interface GeneralIO as EnablePin; + interface ReadNow as ActualRead; + } +} +implementation { + bool started = FALSE; + bool busy = FALSE; + uint8_t client_id; + norace error_t read_result; + norace uint16_t read_val; + + command error_t SplitControl.start() { + error_t error; + if(started == FALSE) { + error = call AnalogDeviceResource.request(); + if(error == SUCCESS) + started = TRUE; + return error; + } + return FAIL; + } + + event void AnalogDeviceResource.granted() { + call EnablePin.makeOutput(); + call EnablePin.set(); + call Timer.startOneShot(startup_delay); + } + + event void Timer.fired() { + signal SplitControl.startDone(SUCCESS); + } + + task void stopDone() { + call AnalogDeviceResource.release(); + started = FALSE; + signal SplitControl.stopDone(SUCCESS); + } + + command error_t SplitControl.stop() { + if(started == TRUE) { + call EnablePin.clr(); + call EnablePin.makeInput(); + post stopDone(); + return SUCCESS; + } + else if(busy == TRUE) + return EBUSY; + return FAIL; + } + + command error_t Read.read[uint8_t id]() { + error_t error; + if(call AnalogDeviceResource.isOwner() && busy == FALSE) { + error = call ActualRead.read(); + if(error == SUCCESS) { + busy = TRUE; + client_id = id; + } + return error; + } + return FAIL; + } + + task void readDoneTask() { + busy = FALSE; + signal Read.readDone[client_id](read_result, read_val); + } + + async event void ActualRead.readDone(error_t result, uint16_t val) { + read_result = result; + read_val = val; + post readDoneTask(); + } +} diff --git a/tos/sensorboards/mda100/TempC.nc b/tos/sensorboards/mda100/TempC.nc new file mode 100644 index 00000000..6bdfb60f --- /dev/null +++ b/tos/sensorboards/mda100/TempC.nc @@ -0,0 +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 mda100 sensor board. + * + * @author David Gay + */ + +#include "mda100.h" + +generic configuration TempC() { + provides interface Read; +} +implementation { + components ArbitratedTempDeviceP; + + Read = ArbitratedTempDeviceP.Read[unique(UQ_MDA100_TEMP_RESOURCE)]; +} diff --git a/tos/sensorboards/mda100/ca/TempImplP.nc b/tos/sensorboards/mda100/ca/TempImplP.nc new file mode 100644 index 00000000..94a1494a --- /dev/null +++ b/tos/sensorboards/mda100/ca/TempImplP.nc @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2007 Stanford University. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * - Neither the name of the Stanford University nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 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 STANFORD + * UNIVERSITY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * 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 Kevin Klues + * @date August 20th, 2007 + */ + +#include "mda100.h" + +configuration TempImplP { + provides { + interface Resource[uint8_t]; + interface Read[uint8_t]; + } +} +implementation { + components new SharedAnalogDeviceC(UQ_MDA100_TEMP_RESOURCE, 10); + components MicaBusC; + components PhotoTempConfigC as TempConfigC; + + Resource = SharedAnalogDeviceC; + Read = SharedAnalogDeviceC; + SharedAnalogDeviceC.AdcConfig -> TempConfigC; + SharedAnalogDeviceC.EnablePin -> MicaBusC.Int2; +} diff --git a/tos/sensorboards/mda100/cb/TempImplP.nc b/tos/sensorboards/mda100/cb/TempImplP.nc new file mode 100644 index 00000000..588a3292 --- /dev/null +++ b/tos/sensorboards/mda100/cb/TempImplP.nc @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2007 Stanford University. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * - Neither the name of the Stanford University nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 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 STANFORD + * UNIVERSITY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * 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 Kevin Klues + * @date August 20th, 2007 + */ + +#include "mda100.h" + +configuration TempImplP { + provides { + interface Resource[uint8_t]; + interface Read[uint8_t]; + } +} +implementation { + components new SharedAnalogDeviceC(UQ_MDA100_TEMP_RESOURCE, 10); + components MicaBusC; + components PhotoTempConfigC as TempConfigC; + + Resource = SharedAnalogDeviceC; + Read = SharedAnalogDeviceC; + SharedAnalogDeviceC.AdcConfig -> TempConfigC; + SharedAnalogDeviceC.EnablePin -> MicaBusC.PW0; +} diff --git a/tos/sensorboards/mda100/mda100.h b/tos/sensorboards/mda100/mda100.h new file mode 100644 index 00000000..50e690d3 --- /dev/null +++ b/tos/sensorboards/mda100/mda100.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2007 Stanford University. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * - Neither the name of the Stanford University nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 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 STANFORD + * UNIVERSITY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * 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 Kevin Klues + * @date August 20th, 2007 + */ + +#ifndef _MDA100_H +#define _MDA100_H + +#define UQ_MDA100_PHOTO_RESOURCE "mda100.photo" +#define UQ_MDA100_TEMP_RESOURCE "mda100.temp" + +#endif /* _MDA100_H */ +