--- /dev/null
+COMPONENT=TestSleepC
+include $(MAKERULES)
+
--- /dev/null
+/// $Id$
+
+/**
+ * "Copyright (c) 2005 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS 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 COPYRIGHT HOLDERS AND CONTRIBUTORS HAVE BEEN ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THE COPYRIGHT HOLDERS AND CONTRIBUTORS SPECIFICALLY DISCLAIM 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 COPYRIGHT HOLDERS AND CONTRIBUTORS HAVE NO OBLIGATION
+ * TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
+ */
+
+/// @author Martin Turon <mturon@xbow.com>
+
+/**
+ * TestSleep simple puts the processor into sleep mode and stays there.
+ * The instananeous and average current should be ~20 uA on the ATmega128.
+ */
+configuration TestSleepC
+{
+}
+implementation
+{
+ components MainC, TestSleepM,
+ HplSleepC; // Low-level control just for test purposes
+
+ TestSleepM -> MainC.Boot;
+
+ TestSleepM.PowerManager -> HplSleepC;
+}
+
--- /dev/null
+/// $Id$
+
+/**
+ * "Copyright (c) 2005 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS 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 COPYRIGHT HOLDERS AND CONTRIBUTORS HAVE BEEN ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * THE COPYRIGHT HOLDERS AND CONTRIBUTORS SPECIFICALLY DISCLAIM 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 COPYRIGHT HOLDERS AND CONTRIBUTORS HAVE NO OBLIGATION
+ * TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
+ */
+
+/// @author Martin Turon <mturon@xbow.com>
+
+module TestSleepM
+{
+ uses interface Boot;
+
+ uses interface McuSleep as PowerManager;
+}
+implementation
+{
+ event void Boot.booted()
+ {
+ call PowerManager.enable();
+ }
+}
+
--- /dev/null
+COMPONENT=TestADCC\r
+CFLAGS += -I%T/lib/adc -I%T/oski/services -I%T/oski/interfaces -I%T/oski/types -I%T/oski/impls\r
+include $(MAKERULES)\r
+\r
--- /dev/null
+// $Id$\r
+\r
+/* tab:4\r
+ * "Copyright (c) 2000-2005 The Regents of the University of California. \r
+ * All rights reserved.\r
+ *\r
+ * Permission to use, copy, modify, and distribute this software and its\r
+ * documentation for any purpose, without fee, and without written agreement is\r
+ * hereby granted, provided that the above copyright notice, the following\r
+ * two paragraphs and the author appear in all copies of this software.\r
+ * \r
+ * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR\r
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT\r
+ * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF\r
+ * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ * \r
+ * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,\r
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY\r
+ * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS\r
+ * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO\r
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."\r
+ *\r
+ * Copyright (c) 2002-2005 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
+ * Copyright (c) 2004-2005 Crossbow Technology, Inc. All rights reserved. \r
+ *\r
+ * Permission to use, copy, modify, and distribute this software and its\r
+ * documentation for any purpose, without fee, and without written agreement is\r
+ * hereby granted, provided that the above copyright notice, the following\r
+ * two paragraphs and the author appear in all copies of this software. \r
+ * IN NO EVENT SHALL CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS BE LIABLE TO \r
+ * ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL \r
+ * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN\r
+ * IF CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH \r
+ * DAMAGE. \r
+ *\r
+ * CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL WARRANTIES,\r
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY \r
+ * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS \r
+ * ON AN "AS IS" BASIS, AND NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY \r
+ * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR \r
+ * MODIFICATIONS. \r
+ */\r
+\r
+/**\r
+ *\r
+ * @author tinyos-help@millennium.berkeley.edu\r
+ * @author Hu Siquan <husq@xbow.com>\r
+ **/\r
+\r
+configuration TestADCC\r
+{\r
+}\r
+implementation\r
+{\r
+ components Main, TestADCM, DemoSensorC, LedsC;\r
+\r
+ TestADCM -> Main.Boot;\r
+ Main.SoftwareInit -> LedsC;\r
+ TestADCM.Leds -> LedsC;\r
+ TestADCM.SensorControl -> DemoSensorC; \r
+ TestADCM.AcquireData -> DemoSensorC; \r
+}\r
+\r
--- /dev/null
+// $Id$\r
+\r
+/* tab:4\r
+ * "Copyright (c) 2000-2005 The Regents of the University of California. \r
+ * All rights reserved.\r
+ *\r
+ * Permission to use, copy, modify, and distribute this software and its\r
+ * documentation for any purpose, without fee, and without written agreement is\r
+ * hereby granted, provided that the above copyright notice, the following\r
+ * two paragraphs and the author appear in all copies of this software.\r
+ * \r
+ * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR\r
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT\r
+ * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF\r
+ * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+ * \r
+ * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,\r
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY\r
+ * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS\r
+ * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO\r
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."\r
+ *\r
+ * Copyright (c) 2002-2003 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
+ * Copyright (c) 2004-2005 Crossbow Technology, Inc. All rights reserved. \r
+ *\r
+ * Permission to use, copy, modify, and distribute this software and its\r
+ * documentation for any purpose, without fee, and without written agreement is\r
+ * hereby granted, provided that the above copyright notice, the following\r
+ * two paragraphs and the author appear in all copies of this software. \r
+ *\r
+ * IN NO EVENT SHALL CROSSBOW TECHNOLOGY OR ANY OF ITS LICENSORS BE LIABLE TO \r
+ * ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL \r
+ * DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN\r
+ * IF CROSSBOW OR ITS LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH \r
+ * DAMAGE. \r
+ *\r
+ * CROSSBOW TECHNOLOGY AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL WARRANTIES,\r
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY \r
+ * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS \r
+ * ON AN "AS IS" BASIS, AND NEITHER CROSSBOW NOR ANY LICENSOR HAS ANY \r
+ * OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR \r
+ * MODIFICATIONS. \r
+ */\r
+/**\r
+ *\r
+ * @author Hu Siquan <husq@xbow.com>\r
+ *\r
+ * Implementation for TestADC application. \r
+ * Toggle the green LED when a dataReady event fires.\r
+ **/\r
+\r
+\r
+module TestADCM\r
+{\r
+ uses interface StdControl as SensorControl;\r
+ uses interface AcquireData;\r
+ uses interface Leds;\r
+ uses interface Boot;\r
+}\r
+implementation\r
+{\r
+ event void Boot.booted()\r
+ {\r
+ call Leds.led0Toggle();\r
+ call SensorControl.start();\r
+ call AcquireData.getData();\r
+ }\r
+\r
+ event void AcquireData.dataReady(uint16_t data) {\r
+ call SensorControl.stop();\r
+ call Leds.led1Toggle();\r
+ if (data & 1)\r
+ call Leds.led2On();\r
+ else\r
+ call Leds.led2Off();\r
+ }\r
+\r
+ event void AcquireData.error(uint16_t info) {\r
+ call SensorControl.stop(); \r
+ }\r
+}\r
+\r
--- /dev/null
+COMPONENT=TestI2CC
+CFLAGS += -I%T/lib/oski
+include $(MAKERULES)
+
--- /dev/null
+// $Id$
+
+/**
+ * Copyright (c) 2004-2005 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 Martin Turon <mturon@xbow.com>
+
+/** This version of TestI2C is designed to test the ATmega128 I2C subsystem. */
+configuration TestI2CC
+{
+}
+implementation
+{
+ components
+ MainC, TestI2CM, LedsC,
+ new OskiTimerMilliC() as Timer0,
+ HplI2CBusC as I2C;
+ //new HalI2CMasterC(0x58) as I2CPot; // ad5242 for mag on MTS310
+
+ TestI2CM -> MainC.Boot;
+ MainC.SoftwareInit -> LedsC;
+
+ TestI2CM.Timer0 -> Timer0;
+ TestI2CM.Leds -> LedsC;
+ TestI2CM.I2C -> I2C;
+ I2C.Leds -> LedsC;
+}
+
--- /dev/null
+/**
+ * Copyright (c) 2004-2005 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@xbow.com>
+ *
+ * $Id$
+ */
+
+/**
+ * Implementation for TestI2C application:
+ * Yellow == Every timer, post task for I2C ping if not already running
+ * Red & GREEN == task started
+ * Red == Device ping FAIL
+ * Green == Device ping SUCCESS
+ *
+ * @version 2005/9/11 mturon Initial version
+ */
+
+#define I2C_DEVICE I2C_MTS300_MIC
+
+#define I2C_MTS310_MAG 0x58
+#define I2C_MTS300_MIC 0x5A
+#define I2C_MDA300_ADC 0x94
+#define I2C_MDA300_EE 0xAE
+
+includes Timer;
+
+module TestI2CM
+{
+ uses interface Timer<TMilli> as Timer0;
+ uses interface Leds;
+ uses interface Boot;
+ uses interface HplI2CBus as I2C;
+}
+implementation
+{
+ bool working;
+
+ task void i2c_test() {
+ call Leds.led1On();
+ call Leds.led0On();
+
+ if (call I2C.ping(I2C_DEVICE) == SUCCESS) {
+ call Leds.led0Off();
+ } else {
+ call Leds.led1Off();
+ }
+
+ working = FALSE;
+ }
+
+ void i2c_test_start() {
+ atomic {
+ if (!working) {
+ working = TRUE;
+ post i2c_test();
+ }
+ }
+ }
+
+ event void Boot.booted() {
+ working = FALSE;
+ call I2C.init();
+
+ call Timer0.startPeriodic( 10000 );
+
+ call Leds.led2On();
+ i2c_test_start();
+ }
+
+ event void Timer0.fired() {
+ call Leds.led2Toggle();
+ i2c_test_start();
+ }
+
+ async event void I2C.symbolSent() { }
+
+}
+
--- /dev/null
+COMPONENT=TestRadioC
+CFLAGS += -I%T/oski/services -I%T/oski/interfaces -I%T/oski/types -I%T/oski/impls
+include $(MAKERULES)
+
--- /dev/null
+// $Id$
+
+/* tab:4
+ * "Copyright (c) 2000-2005 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-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.
+ */
+
+/**
+ * Blink is a basic application that toggles the a mote LED periodically.
+ * It does so by starting a Timer that fires every second. It uses the
+ * OSKI TimerMilli service to achieve this goal.
+ *
+ * @author tinyos-help@millennium.berkeley.edu
+ **/
+
+configuration TestRadioC
+{
+}
+implementation
+{
+ components Main, TestRadioM, new TimerMilli() as Timer0, LedsC, CSMARadioC;
+
+ TestRadioM -> Main.Boot;
+ Main.SoftwareInit -> LedsC;
+ Main.SoftwareInit -> CSMARadioC;
+
+ TestRadioM.SplitControl -> CSMARadioC;
+ TestRadioM.Send -> CSMARadioC;
+ TestRadioM.Receive -> CSMARadioC;
+ TestRadioM.Timer0 -> Timer0;
+ TestRadioM.Leds -> LedsC;
+
+}
+
--- /dev/null
+// $Id$
+
+/* tab:4
+ * "Copyright (c) 2000-2005 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.
+ */
+
+/**
+ * Implementation for TestRadio application. Toggle the red LED when a
+ * Timer fires.
+ **/
+
+includes Timer;
+
+module TestRadioM
+{
+ uses interface Timer<TMilli> as Timer0;
+ uses interface SplitControl;
+ uses interface Send;
+ uses interface Receive;
+ uses interface Leds;
+ uses interface Boot;
+}
+implementation
+{
+ message_t msg;
+
+ event void Boot.booted()
+ {
+ call SplitControl.start();
+ }
+
+ event void SplitControl.startDone(error_t error) {
+ call Timer0.startPeriodic( 1000 );
+ }
+
+ event void SplitControl.stopDone(error_t error) {
+ }
+
+ event void Timer0.fired()
+ {
+ call Leds.led0Toggle();
+ msg.header.addr = 0xffff;
+ msg.header.group = 0x42;
+ msg.data[0] = 0xaa;
+ msg.data[1] = 0xbb;
+ msg.header.length = 2;
+ if (call Send.send(&msg, 2) == SUCCESS)
+ call Leds.led1Toggle();
+ }
+
+ event void Send.sendDone(message_t* mmsg, error_t error) {
+ call Leds.led2Toggle();
+ }
+
+ event message_t* Receive.receive(message_t* mmsg, void* payload, uint8_t len) {
+ return mmsg;
+ }
+}
+
--- /dev/null
+// $Id$
+
+/**
+ * Copyright (c) 2004-2005 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 Martin Turon <mturon@xbow.com>
+
+/** This version of Blink is designed to test ATmega128 AVR timers. */
+configuration BlinkC
+{
+}
+implementation
+{
+ components MainC, new BlinkM(uint8_t), LedsC, HplTimerC;
+
+ BlinkM.Boot -> MainC;
+ MainC.SoftwareInit -> LedsC;
+ BlinkM.Leds -> LedsC;
+
+ BlinkM.Timer -> HplTimerC.Timer0;
+ BlinkM.Compare -> HplTimerC.Compare0;
+
+ BlinkM.FastTimer -> HplTimerC.Timer1;
+ BlinkM.FastCompare -> HplTimerC.Compare1A;
+}
+
--- /dev/null
+// $Id$
+
+/**
+ * Copyright (c) 2004-2005 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 Martin Turon <mturon@xbow.com>
+
+#define SLOW_COMPARE 50
+#define SLOW_COMPARE_ON_CYCLE 320
+#define SLOW_OVERFLOW_CYCLES 500
+
+#define FAST_COMPARE 16000
+#define FAST_COMPARE_ON_CYCLE 4
+#define FAST_OVERFLOW_CYCLES 5
+
+#include <ATm128Timer.h>
+
+/**
+ * This version of Blink is designed to test ATmega128 AVR timers.
+ */
+generic module BlinkM(typedef timer_size @integer())
+{
+ uses interface HplTimer<timer_size> as Timer;
+ uses interface HplCompare<timer_size> as Compare;
+ uses interface HplTimer<uint16_t> as FastTimer;
+ uses interface HplCompare<uint16_t> as FastCompare;
+ uses interface Boot;
+ uses interface Leds;
+}
+implementation
+{
+ norace int scycle = SLOW_OVERFLOW_CYCLES;
+ norace int fcycle = FAST_OVERFLOW_CYCLES;
+
+ void slow_timer_init() {
+ atomic {
+ CLR_BIT(ASSR, AS0); // set Timer/Counter0 to use 32,768khz crystal
+
+ call Timer.setScale(ATM128_CLK8_DIVIDE_32);
+ call Compare.set(SLOW_COMPARE); // trigger compare in middle of range
+ call Compare.start();
+
+ call Timer.start();
+ call Timer.set(0); // overflow after 256-6 = 250 cycles
+ }
+ }
+
+ void fast_timer_init() {
+
+ atomic {
+ call FastTimer.setScale(AVR_CLOCK_DIVIDE_8);
+ call FastCompare.set(FAST_COMPARE); // trigger compare mid pulse
+ call FastCompare.start();
+
+ call FastTimer.start();
+ call FastTimer.set(0); // overflow after 256-6 = 250 cycles
+ }
+ }
+
+ event void Boot.booted() {
+ slow_timer_init();
+ fast_timer_init();
+
+ while(1) {}
+ }
+
+ async event void Compare.fired() {
+ call Leds.led0On();
+ call Compare.stop();
+ }
+
+ async event void Timer.overflow() {
+ call Timer.reset();
+
+ if (scycle == SLOW_COMPARE_ON_CYCLE) {
+ call Compare.reset();
+ call Compare.start();
+ }
+
+ if (scycle++ > SLOW_OVERFLOW_CYCLES) {
+ scycle = 0;
+ call Leds.led0Off();
+ }
+ }
+
+ async event void FastCompare.fired() {
+ if (fcycle == FAST_COMPARE_ON_CYCLE) {
+ call Leds.led2On();
+ call FastCompare.stop();
+ }
+ }
+
+ async event void FastTimer.overflow() {
+ call FastTimer.reset();
+
+ if (fcycle == FAST_COMPARE_ON_CYCLE) {
+ call FastCompare.reset();
+ call FastCompare.start();
+ }
+
+ if (fcycle++ > FAST_OVERFLOW_CYCLES) {
+ fcycle = 0;
+ call Leds.led1Toggle(); // toggle overflow led
+ call Leds.led2Off(); // clear compare led
+ }
+ }
+}
+
--- /dev/null
+COMPONENT=BlinkC
+include $(MAKERULES)
+
--- /dev/null
+COMPONENT=TestMts300C
+SENSORBOARD=mts300
+CFLAGS += -I%T/lib/oski
+#CFLAGS += -I%T/sensorboards/mts300
+include $(MAKERULES)
--- /dev/null
+/**
+ * Copyright (c) 2004-2005 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@xbow.com>
+ *
+ * $Id$
+ */
+
+/**
+ * This application tests the mts300 sensorboard.
+ * Specifically, this handles the thermistor and light sensors.
+ *
+ * @author Martin Turon
+ * @date October 19, 2005
+ */
+configuration TestMts300C {
+}
+implementation
+{
+ components MainC, TestMts300P, LedsC, new OskiTimerMilliC(),
+ SensorMts300C;
+
+ MainC.SoftwareInit -> LedsC;
+ MainC.SoftwareInit -> SensorMts300C;
+
+ TestMts300P -> MainC.Boot;
+ TestMts300P.Leds -> LedsC;
+ TestMts300P.AppTimer -> OskiTimerMilliC;
+
+ TestMts300P.SensorControl -> SensorMts300C;
+ TestMts300P.Temp -> SensorMts300C.Temp;
+ TestMts300P.Light -> SensorMts300C.Light;
+}
+
--- /dev/null
+/**
+ * Copyright (c) 2004-2005 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@xbow.com>
+ *
+ * $Id$
+ */
+
+includes Timer;
+
+/**
+ * This application tests the mts300 sensorboard.
+ * Specifically, this handles the thermistor and light sensors.
+ *
+ * @author Martin Turon
+ * @date October 19, 2005
+ */
+module TestMts300P
+{
+ uses {
+ interface Boot;
+ interface Leds;
+ interface Timer<TMilli> as AppTimer;
+
+ interface StdControl as SensorControl;
+ interface AcquireData as Temp;
+ interface AcquireData as Light;
+ }
+}
+implementation
+{
+ event void Boot.booted() {
+ call Leds.led0On();
+ call Leds.led1On(); // power led
+ call SensorControl.start();
+ }
+
+ event void AppTimer.fired() {
+ call Leds.led0Toggle(); // heartbeat indicator
+ call Light.getData();
+ call Temp.getData();
+ }
+
+ event void Light.dataReady(uint16_t data) {
+ call Leds.led1Toggle();
+ }
+
+ event void Temp.dataReady(uint16_t data) {
+ call Leds.led2Toggle();
+ }
+
+ event void Light.error(uint16_t info) {
+ }
+
+ event void Temp.error(uint16_t info) {
+ }
+}
+