*/
/**
- * 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;
}
}