Fork of https://os.mbed.com/users/okini3939/code/WeatherMeters/

Committer:
okini3939
Date:
Thu Jan 06 13:23:24 2011 +0000
Revision:
1:fa262295fa7e
Parent:
0:dc42aeff64e6
Child:
2:6a62f29b1bb5

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
okini3939 0:dc42aeff64e6 1 /*
okini3939 0:dc42aeff64e6 2 * mbed library to use a Sparkfun Weather Meters
okini3939 0:dc42aeff64e6 3 * Copyright (c) 2010 Hiroshi Suga
okini3939 0:dc42aeff64e6 4 * Released under the MIT License: http://mbed.org/license/mit
okini3939 0:dc42aeff64e6 5 */
okini3939 0:dc42aeff64e6 6
okini3939 1:fa262295fa7e 7 /** @file WeatherMeters.h
okini3939 1:fa262295fa7e 8 * @brief mbed library to use a Sparkfun Weather Meters
okini3939 1:fa262295fa7e 9 * Anemometer, Wind vane, Rain gauge
okini3939 1:fa262295fa7e 10 * interface: digital, analog
okini3939 1:fa262295fa7e 11 */
okini3939 1:fa262295fa7e 12
okini3939 0:dc42aeff64e6 13 #ifndef WeatherMeters_H
okini3939 0:dc42aeff64e6 14 #define WeatherMeters_H
okini3939 0:dc42aeff64e6 15
okini3939 0:dc42aeff64e6 16 #include "mbed.h"
okini3939 0:dc42aeff64e6 17
okini3939 1:fa262295fa7e 18 /**
okini3939 1:fa262295fa7e 19 * @brief parameter of Anemometer
okini3939 1:fa262295fa7e 20 */
okini3939 0:dc42aeff64e6 21 enum Weather_mode {
okini3939 0:dc42aeff64e6 22 Weather_manual = 0,
okini3939 0:dc42aeff64e6 23 Weather_auto = 1
okini3939 0:dc42aeff64e6 24 };
okini3939 0:dc42aeff64e6 25
okini3939 1:fa262295fa7e 26 /**
okini3939 1:fa262295fa7e 27 * @brief WeatherMeters class
okini3939 1:fa262295fa7e 28 */
okini3939 0:dc42aeff64e6 29 class WeatherMeters : public Base {
okini3939 0:dc42aeff64e6 30 public:
okini3939 0:dc42aeff64e6 31 WeatherMeters(PinName p_anemometer, PinName p_windvane, PinName p_raingauge, Weather_mode w_mode = Weather_auto);
okini3939 0:dc42aeff64e6 32
okini3939 0:dc42aeff64e6 33 float get_windspeed();
okini3939 0:dc42aeff64e6 34 float get_windvane();
okini3939 0:dc42aeff64e6 35 float get_raingauge();
okini3939 0:dc42aeff64e6 36 void update();
okini3939 0:dc42aeff64e6 37
okini3939 0:dc42aeff64e6 38 protected:
okini3939 0:dc42aeff64e6 39 void int_anemometer ();
okini3939 0:dc42aeff64e6 40 void int_raingauge ();
okini3939 0:dc42aeff64e6 41 void int_timer ();
okini3939 0:dc42aeff64e6 42
okini3939 0:dc42aeff64e6 43 InterruptIn int01, int02;
okini3939 0:dc42aeff64e6 44 AnalogIn ain01;
okini3939 0:dc42aeff64e6 45 Ticker ticker01;
okini3939 0:dc42aeff64e6 46 int windspeed, raingauge;
okini3939 0:dc42aeff64e6 47 float windvane;
okini3939 0:dc42aeff64e6 48 int mode;
okini3939 0:dc42aeff64e6 49
okini3939 0:dc42aeff64e6 50 private:
okini3939 0:dc42aeff64e6 51
okini3939 0:dc42aeff64e6 52 int count_anemo, count_rain, time_anemo, time_rain;
okini3939 0:dc42aeff64e6 53 int buf_anemo[12], buf_rain[12];
okini3939 0:dc42aeff64e6 54 };
okini3939 0:dc42aeff64e6 55
okini3939 0:dc42aeff64e6 56 #endif