]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/platforms/tmirws/sensors/HalWindVaneP.nc
Update HalWindVaneC so that it adds dead zone check support and pin init.
[tinyos-2.x.git] / tos / platforms / tmirws / sensors / HalWindVaneP.nc
index 92bd42a12e2d82cd210c5d05b5d4fa82cd2a2d61..a0a604f0f8ab4e6509eefba92bcea9f51d98024e 100644 (file)
  */
  
 /**
- * HAL/HPL layers for the WindVane sensor.
+ * HAL layer for the wind vane sensor provides a power control.
  * 
  * @author R. Steve McKown <rsmckown@gmail.com>
  */
  
-#include "WindVane.h"
-
 module HalWindVaneP {
-  provides {
-    interface Init;
-    interface AsyncGet<uint8_t> as Vane;
+  provides interface Init;
+  uses {
+    interface HplMsp430GeneralIO as WPower;
+    interface HplMsp430GeneralIO as WDead;
   }
 }
 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;
-  }
+    call WPower.makeOutput();
+    call WPower.clr();
+    call WPower.disableRen();
 
-  async command uint8_t Vane.get()
-  {
-    atomic return ~WIND_IN;
+    call WDead.makeInput();
+    call WDead.set();
+    call WDead.disableRen();
+
+    return SUCCESS;
   }
 }