*/
/**
- * WindVane sensor
+ * WindVane sensor. The compass is a number of sectors, 0...(sectors - 1).
+ * sectors must be a power of 2. Sector zero is North, and sectors/2 is South.
+ * Like any compass, the heading increases as one traverses the compass
+ * clockwise. The number of sectors are contrained by the uint8_t data members
+ * of wind_vane_t to 128.
*
* @author R. Steve McKown <rsmckown@gmail.com>
*/
#include "WindVane.h"
-configuration WindVaneC {
- provides interface ReadRef<wind_vane_t>;
+generic configuration WindVaneC(uint8_t sectors) {
+ provides {
+ interface Get<uint8_t> as Sectors;
+ interface ReadRef<wind_vane_t>;
+ }
}
implementation {
- components WindVaneP;
+ components new WindVaneP(sectors);
+ Sectors = WindVaneP;
ReadRef = WindVaneP;
components SoftwareRtcC as RtcC;
WindVaneP.Second -> RtcC;
- components new WindVaneAdcC();
- WindVaneP.Vane -> WindVaneAdcC.Read;
-
- components HalWindVaneC;
- WindVaneP.WPower -> HalWindVaneC;
+ components WindVaneReadC;
+ WindVaneP.Vane -> WindVaneReadC.Read;
}