]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
Work on wind sensor move to Davis Instruments.
authorsmckown <smckown@4bc1554a-c7f2-4f65-a403-e0be01f0239c>
Mon, 2 Nov 2009 20:43:23 +0000 (20:43 +0000)
committerR. Steve McKown <rsmckown@gmail.com>
Tue, 1 Dec 2009 03:01:44 +0000 (20:01 -0700)
tos/platforms/tmirws/MotePlatformC.nc
tos/platforms/tmirws/sensors/HalWindVaneC.nc
tos/platforms/tmirws/sensors/HalWindVaneP.nc [deleted file]
tos/platforms/tmirws/sensors/WindVaneAdcP.nc
tos/platforms/tmirws/sensors/WindVaneC.nc
tos/platforms/tmirws/sensors/WindVaneP.nc

index 9f7504883ac87ea320ae97f805ea2bf4f0457971..6aebc096f9e22786360686feee920a2c62bb361c 100644 (file)
@@ -80,15 +80,16 @@ implementation {
        P4REN = 0x83;   /* 1 0 0 0 0 0 1 1 */
 
        /* Port 5:
-        * 7:W315, 6:W270, 5:W225, 4:W180, 3:W135, 2:W090, 1:W045, 0:W000
+        * 7:WPOWER, 6:W270, 5:W225, 4:W180, 3:W135, 2:W090, 1:W045, 0:W000
         */
        P5SEL = 0;      /* 0 0 0 0 0 0 0 0 */
        P5OUT = 0;      /* 0 0 0 0 0 0 0 0 */
-       P5DIR = 0;      /* 0 0 0 0 0 0 0 0 */
+       P5DIR = 0x80;   /* 1 0 0 0 0 0 0 0 */
        P5REN = 0;      /* 0 0 0 0 0 0 0 0 */
 
        /* Port 6:
-        * 7:TEMP_PWR, 6:TEMP3, 5:TEMP2, 4:TEMP1, 3:PHOTO, 2:-, 1:-, 0:ADC_VBATT
+        * 7:TEMP_PWR, 6:TEMP3, 5:TEMP2, 4:TEMP1, 3:PHOTO, 2:ADC_WIND, 1:-,
+        * 0:ADC_VBATT
         */
        P6SEL = 0x79;   /* 0 1 1 1 1 0 0 1 */
        P6OUT = 0;      /* 0 0 0 0 0 0 0 0 */
index 21322ae11e9f2b4e59515f7afa586fb60ccef6d7..2125a28e3e796c6428e962e21fbbb1ae23d39d18 100644 (file)
  */
  
 /**
- * HAL layer for the wind vane sensor.
+ * HAL layer for the wind vane sensor provides a power control.
  * 
  * @author R. Steve McKown <rsmckown@gmail.com>
  */
  
-#include "WindVane.h"
-
 configuration HalWindVaneC {
-  provides interface AsyncGet<uint8_t>;
+  provides interface GeneralIO as WPower;
 }
 implementation {
-  components HalWindVaneP;
-  AsyncGet = HalWindVaneP;
+  components new Msp430GpioC() as WPowerM;
+  WPower = WPowerM;
 
-  components MainC;
-  MainC.SoftwareInit -> HalWindVaneP.Init;
+  components HplMsp430GeneralIOC;
+  WPowerM -> HplMsp430GeneralIOC.Port57;
 }
diff --git a/tos/platforms/tmirws/sensors/HalWindVaneP.nc b/tos/platforms/tmirws/sensors/HalWindVaneP.nc
deleted file mode 100644 (file)
index 92bd42a..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2008, Titanium Mirror, Inc.
- * 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 Titanium Mirror, Inc. 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 THE COPYRIGHT
- * OWNER OR 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.
- */
-/**
- * HAL/HPL layers for the WindVane sensor.
- * 
- * @author R. Steve McKown <rsmckown@gmail.com>
- */
-#include "WindVane.h"
-
-module HalWindVaneP {
-  provides {
-    interface Init;
-    interface AsyncGet<uint8_t> as Vane;
-  }
-}
-implementation {
-#define WIND_IN (*TCAST(volatile uint8_t* ONE, P5IN_))
-#define WIND_DIR (*TCAST(volatile uint8_t* ONE, P5DIR_))
-#define WIND_SEL (*TCAST(volatile uint8_t* ONE, P5SEL_))
-#define WIND_REN (*TCAST(volatile uint8_t* ONE, P5REN_))
-
-  command error_t Init.init()
-  {
-    /* Initialize the port providing wind direction information */
-    WIND_DIR = 0;
-    WIND_SEL = 0;
-    WIND_REN = 0;
-    return SUCCESS;
-  }
-
-  async command uint8_t Vane.get()
-  {
-    atomic return ~WIND_IN;
-  }
-}
index b4e920548f8fad9033361f9b099ee767a18b46eb..e898db0fa41bc0eb8133ff30eb0f022a9b36b085 100644 (file)
@@ -51,13 +51,13 @@ implementation {
    * jumping around.  The external reference of 2.50V seems stable.
    */
   const msp430adc12_channel_config_t config = {
-      inch: INPUT_CHANNEL_A0, // A2
-#if 0 /* internal references unstable */
+      inch: INPUT_CHANNEL_A2,
+#if 1 /* internal references unstable (no, I don't think so) */
       sref: REFERENCE_VREFplus_AVss,
-      ref2_5v: REFVOLT_LEVEL_1_5, /* REFVOLT_LEVEL_2_5, */
-#else /* external reference is stable */
+      ref2_5v: /*REFVOLT_LEVEL_1_5, */ REFVOLT_LEVEL_2_5,
+#else /* external reference is stable, and is 2.5V */
       sref: REFERENCE_VeREFplus_AVss,
-      ref2_5v: REFVOLT_LEVEL_1_5,
+      ref2_5v: REFVOLT_LEVEL_1_5, 
 #endif
 #if 0 /* clock source doesn't seem to affect stability */
       adc12ssel: SHT_SOURCE_ADC12OSC,
index 2c317596ee7d2e63a9779adbd8b9226294d06af6..883021f72e61977ebc0df79f1428b649c91d5a3e 100644 (file)
@@ -47,4 +47,7 @@ implementation {
 
   components new WindVaneAdcC();
   WindVaneP.Vane -> WindVaneAdcC.Read;
+
+  components HalWindVaneC;
+  WindVaneP.WPower -> HalWindVaneC;
 }
index 4042470e241704a7d22fbc33c91024bbd508bf6c..f9907c8eee4b9a20c5f22c88744b1885d1b9cd56 100644 (file)
@@ -40,6 +40,7 @@ module WindVaneP {
   uses {
     interface Tick as Second;
     interface Read<uint16_t> as Vane;
+    interface GeneralIO as WPower;
   }
 }
 implementation {
@@ -164,6 +165,7 @@ implementation {
 
   task void startRead()
   {
+    call WPower.set();
     call Vane.read();
   }
 
@@ -174,6 +176,7 @@ implementation {
 
   event void Vane.readDone(error_t error, uint16_t value)
   {
+    //call WPower.clr();
     if (error == SUCCESS) {
       /* Convert the adc value (0...4095) to a compass heading
        * (0...COMPASS_COUNT - 1).