]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/platforms/tmirws/sensors/WindVaneAdcC.nc
Work in process to support Davis instruments aerovane (wind vane).
[tinyos-2.x.git] / tos / platforms / tmirws / sensors / WindVaneAdcC.nc
index 472f9ec7b2e50e519fd752e33a64c44128668b96..a659995b7672bab3389d16d7a44ed9799084df24 100644 (file)
  */
  
 /**
- * Reads the ADC pin connected to the LiPoly battery.  The connection is made
- * via a resistor divider where the battery voltage is 3x that read by the ADC.
- * Therefore, BattV = ADC / 4096 * 1.5 * 3.
+ * Reads the ADC pin connected to the Davis Instruments anemometer.  The
+ * connection is made via a resistor divider.  The voltage seen by the ADC
+ * is related to VREF, the maximum voltage presented to the ADC.
+ * 0V or VREF means North
+ * VREF*1/4 means East
+ * VREF*2/4 means South
+ * VREF*3/4 means West
+ *
+ * We assume a 12-bit ADC, so VREF reads as 4095 and 0V reads as 0.
  * 
  * @author R. Steve McKown <rsmckown@gmail.com>
  */
  
-generic configuration BatteryAdcC() {
+generic configuration WindVaneAdcC() {
   provides interface Read<uint16_t>;
   provides interface ReadStream<uint16_t>;
 
@@ -49,13 +55,13 @@ implementation {
   components new AdcReadStreamClientC();
   ReadStream = AdcReadStreamClientC;
 
-  components BatteryAdcP;
-  AdcReadClientC.AdcConfigure -> BatteryAdcP;
-  AdcReadStreamClientC.AdcConfigure -> BatteryAdcP;
+  components WindVaneAdcP;
+  AdcReadClientC.AdcConfigure -> WindVaneAdcP;
+  AdcReadStreamClientC.AdcConfigure -> WindVaneAdcP;
 
   components new AdcReadNowClientC();
   Resource = AdcReadNowClientC;
   ReadNow = AdcReadNowClientC;
   
-  AdcReadNowClientC.AdcConfigure -> BatteryAdcP;
+  AdcReadNowClientC.AdcConfigure -> WindVaneAdcP;
 }