--- /dev/null
+/*
+ * 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 <klueska@cs.stanford.edu>
+ * @date August 20th, 2007
+ */
+
+configuration ArbitratedPhotoDeviceP
+{
+ provides interface Read<uint16_t>[uint8_t client];
+}
+implementation
+{
+ components PhotoImplP,
+ new ArbitratedReadC(uint16_t) as ArbitrateRead;
+
+ Read = ArbitrateRead;
+ ArbitrateRead.Service -> PhotoImplP.Read;
+ ArbitrateRead.Resource -> PhotoImplP.Resource;
+}
--- /dev/null
+/*\r
+ * Copyright (c) 2007 Stanford University.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * - Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * - Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the\r
+ * distribution.\r
+ * - Neither the name of the Stanford University nor the names of\r
+ * its contributors may be used to endorse or promote products derived\r
+ * from this software without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\r
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD\r
+ * UNIVERSITY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\r
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\r
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r
+ * OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ */\r
+\r
+/**\r
+ * @author Kevin Klues <klueska@cs.stanford.edu>\r
+ * @date August 20th, 2007\r
+ */\r
+\r
+configuration ArbitratedTempDeviceP\r
+{\r
+ provides interface Read<uint16_t>[uint8_t client];\r
+}\r
+implementation\r
+{\r
+ components TempImplP,\r
+ new ArbitratedReadC(uint16_t) as ArbitrateRead;\r
+\r
+ Read = ArbitrateRead;\r
+ ArbitrateRead.Service -> TempImplP.Read;\r
+ ArbitrateRead.Resource -> TempImplP.Resource;\r
+}\r
--- /dev/null
+/* $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<uint16_t>;
+}
+implementation {
+ components new PhotoC() as Sensor;
+
+ Read = Sensor;
+}
--- /dev/null
+/* $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<uint16_t>;
+}
+implementation {
+ components ArbitratedPhotoDeviceP;
+
+ Read = ArbitratedPhotoDeviceP.Read[unique(UQ_MDA100_PHOTO_RESOURCE)];
+}
--- /dev/null
+/*
+ * 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 <klueska@cs.stanford.edu>
+ * @date August 20th, 2007
+ */
+
+#include "mda100.h"
+
+configuration PhotoImplP {
+ provides {
+ interface Resource[uint8_t];
+ interface Read<uint16_t>[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;
+}
--- /dev/null
+/*
+ * 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 <klueska@cs.stanford.edu>
+ * @date August 20th, 2007
+ */
+
+configuration PhotoTempConfigC {
+ provides interface Atm128AdcConfig;
+}
+implementation {
+ components PhotoTempConfigP;
+ components MicaBusC;
+ Atm128AdcConfig = PhotoTempConfigP;
+
+ PhotoTempConfigP.PhotoTempAdc -> MicaBusC.Adc1;
+}
--- /dev/null
+/* $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 <david.e.gay@intel.com>
+ */
+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;
+ }
+}
--- /dev/null
+/*\r
+ * Copyright (c) 2007 Stanford University.\r
+ * All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * - Redistributions of source code must retain the above copyright\r
+ * notice, this list of conditions and the following disclaimer.\r
+ * - Redistributions in binary form must reproduce the above copyright\r
+ * notice, this list of conditions and the following disclaimer in the\r
+ * documentation and/or other materials provided with the\r
+ * distribution.\r
+ * - Neither the name of the Stanford University nor the names of\r
+ * its contributors may be used to endorse or promote products derived\r
+ * from this software without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\r
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD\r
+ * UNIVERSITY OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\r
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\r
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\r
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\r
+ * OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ */\r
+\r
+/**\r
+ * @author Kevin Klues <klueska@cs.stanford.edu>\r
+ * @date August 20th, 2007\r
+ */\r
+\r
+generic configuration SharedAnalogDeviceC(char resourceName[], uint32_t startup_delay) {\r
+ provides {\r
+ interface Resource[uint8_t];\r
+ interface Read<uint16_t>[uint8_t];\r
+ }\r
+ uses {\r
+ interface Atm128AdcConfig as AdcConfig;\r
+ interface GeneralIO as EnablePin;\r
+ } \r
+}\r
+implementation {\r
+ components new RoundRobinArbiterC(resourceName) as Arbiter;\r
+ components new SplitControlPowerManagerC() as PowerManager;\r
+ components new SharedAnalogDeviceP(startup_delay) as AnalogDevice;\r
+ components new AdcReadNowClientC() as Adc;\r
+ components new TimerMilliC();\r
+ Resource = Arbiter;\r
+ Read = AnalogDevice;\r
+\r
+ PowerManager.ArbiterInfo -> Arbiter;\r
+ PowerManager.SplitControl -> AnalogDevice;\r
+ PowerManager.ResourceDefaultOwner -> Arbiter;\r
+ AnalogDevice.ActualRead -> Adc;\r
+ AnalogDevice.Timer -> TimerMilliC;\r
+ AnalogDevice.AnalogDeviceResource -> Adc;\r
+\r
+ Adc.Atm128AdcConfig = AdcConfig;\r
+ AnalogDevice.EnablePin = EnablePin;\r
+}\r
--- /dev/null
+/*
+ * 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 <klueska@cs.stanford.edu>
+ * @date August 20th, 2007
+ */
+
+generic module SharedAnalogDeviceP(uint32_t startup_delay) {
+ provides {
+ interface SplitControl;
+ interface Read<uint16_t>[uint8_t];
+ }
+ uses {
+ interface Resource as AnalogDeviceResource;
+ interface Timer<TMilli>;
+ interface GeneralIO as EnablePin;
+ interface ReadNow<uint16_t> 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();
+ }
+}
--- /dev/null
+/* $Id$\r
+ * Copyright (c) 2006 Intel Corporation\r
+ * All rights reserved.\r
+ *\r
+ * This file is distributed under the terms in the attached INTEL-LICENSE \r
+ * file. If you do not find these files, copies can be found by writing to\r
+ * Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA, \r
+ * 94704. Attention: Intel License Inquiry.\r
+ */\r
+/**\r
+ * Photodiode of the mda100 sensor board.\r
+ * \r
+ * @author David Gay\r
+ */\r
+\r
+#include "mda100.h"\r
+\r
+generic configuration TempC() {\r
+ provides interface Read<uint16_t>;\r
+}\r
+implementation {\r
+ components ArbitratedTempDeviceP;\r
+\r
+ Read = ArbitratedTempDeviceP.Read[unique(UQ_MDA100_TEMP_RESOURCE)];\r
+}\r
--- /dev/null
+/*
+ * 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 <klueska@cs.stanford.edu>
+ * @date August 20th, 2007
+ */
+
+#include "mda100.h"
+
+configuration TempImplP {
+ provides {
+ interface Resource[uint8_t];
+ interface Read<uint16_t>[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;
+}
--- /dev/null
+/*
+ * 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 <klueska@cs.stanford.edu>
+ * @date August 20th, 2007
+ */
+
+#include "mda100.h"
+
+configuration TempImplP {
+ provides {
+ interface Resource[uint8_t];
+ interface Read<uint16_t>[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;
+}
--- /dev/null
+/*
+ * 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 <klueska@cs.stanford.edu>
+ * @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 */
+