Fork of https://os.mbed.com/users/okini3939/code/WeatherMeters/
Diff: WeatherMeters.cpp
- Revision:
- 1:fa262295fa7e
- Parent:
- 0:dc42aeff64e6
- Child:
- 2:6a62f29b1bb5
--- a/WeatherMeters.cpp Thu Oct 14 11:58:22 2010 +0000 +++ b/WeatherMeters.cpp Thu Jan 06 13:23:24 2011 +0000 @@ -4,6 +4,12 @@ * Released under the MIT License: http://mbed.org/license/mit */ +/** @file WeatherMeters.cpp + * @brief mbed library to use a Sparkfun Weather Meters + * Anemometer, Wind vane, Rain gauge + * interface: digital, analog + */ + #include "mbed.h" #include "WeatherMeters.h" @@ -16,6 +22,13 @@ {270.0, 120000}, {292.5, 42120}, {315.0, 64900}, {337.5, 21880} }; +/** + * @brief Initializes interface + * @param p_anemometer port of Anemometer + * @param p_windvane port of Wind vane (analog) + * @param p_raingauge parameter of Rain gauge + * @param w_mode parameter of Anemometer + */ WeatherMeters::WeatherMeters (PinName p_anemometer, PinName p_windvane, PinName p_raingauge, Weather_mode w_mode) : int01(p_anemometer), int02(p_raingauge), ain01(p_windvane) { int i; @@ -32,6 +45,10 @@ ticker01.attach(this, &WeatherMeters::int_timer, 0.25); } +/** + * @brief Get wind speed + * @return wind speed (m/s) + */ float WeatherMeters::get_windspeed() { float s; @@ -46,6 +63,10 @@ return s; } +/** + * @brief Get wind vane + * @return wind vane (`) + */ float WeatherMeters::get_windvane() { int i; float v; @@ -61,6 +82,10 @@ return 0; } +/** + * @brief Get rain gauge + * @return wind speed (mm/h) + */ float WeatherMeters::get_raingauge() { return (float)raingauge * 0.2794; // 0.2794mm/Hz }