Fork of https://os.mbed.com/users/okini3939/code/WeatherMeters/
WeatherMeters.h@0:dc42aeff64e6, 2010-10-14 (annotated)
- Committer:
- okini3939
- Date:
- Thu Oct 14 11:58:22 2010 +0000
- Revision:
- 0:dc42aeff64e6
- Child:
- 1:fa262295fa7e
Who changed what in which revision?
User | Revision | Line number | New 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 | 0:dc42aeff64e6 | 7 | #ifndef WeatherMeters_H |
okini3939 | 0:dc42aeff64e6 | 8 | #define WeatherMeters_H |
okini3939 | 0:dc42aeff64e6 | 9 | |
okini3939 | 0:dc42aeff64e6 | 10 | #include "mbed.h" |
okini3939 | 0:dc42aeff64e6 | 11 | |
okini3939 | 0:dc42aeff64e6 | 12 | enum Weather_mode { |
okini3939 | 0:dc42aeff64e6 | 13 | Weather_manual = 0, |
okini3939 | 0:dc42aeff64e6 | 14 | Weather_auto = 1 |
okini3939 | 0:dc42aeff64e6 | 15 | }; |
okini3939 | 0:dc42aeff64e6 | 16 | |
okini3939 | 0:dc42aeff64e6 | 17 | class WeatherMeters : public Base { |
okini3939 | 0:dc42aeff64e6 | 18 | public: |
okini3939 | 0:dc42aeff64e6 | 19 | WeatherMeters(PinName p_anemometer, PinName p_windvane, PinName p_raingauge, Weather_mode w_mode = Weather_auto); |
okini3939 | 0:dc42aeff64e6 | 20 | |
okini3939 | 0:dc42aeff64e6 | 21 | float get_windspeed(); |
okini3939 | 0:dc42aeff64e6 | 22 | float get_windvane(); |
okini3939 | 0:dc42aeff64e6 | 23 | float get_raingauge(); |
okini3939 | 0:dc42aeff64e6 | 24 | void update(); |
okini3939 | 0:dc42aeff64e6 | 25 | |
okini3939 | 0:dc42aeff64e6 | 26 | protected: |
okini3939 | 0:dc42aeff64e6 | 27 | void int_anemometer (); |
okini3939 | 0:dc42aeff64e6 | 28 | void int_raingauge (); |
okini3939 | 0:dc42aeff64e6 | 29 | void int_timer (); |
okini3939 | 0:dc42aeff64e6 | 30 | |
okini3939 | 0:dc42aeff64e6 | 31 | InterruptIn int01, int02; |
okini3939 | 0:dc42aeff64e6 | 32 | AnalogIn ain01; |
okini3939 | 0:dc42aeff64e6 | 33 | Ticker ticker01; |
okini3939 | 0:dc42aeff64e6 | 34 | int windspeed, raingauge; |
okini3939 | 0:dc42aeff64e6 | 35 | float windvane; |
okini3939 | 0:dc42aeff64e6 | 36 | int mode; |
okini3939 | 0:dc42aeff64e6 | 37 | |
okini3939 | 0:dc42aeff64e6 | 38 | private: |
okini3939 | 0:dc42aeff64e6 | 39 | |
okini3939 | 0:dc42aeff64e6 | 40 | int count_anemo, count_rain, time_anemo, time_rain; |
okini3939 | 0:dc42aeff64e6 | 41 | int buf_anemo[12], buf_rain[12]; |
okini3939 | 0:dc42aeff64e6 | 42 | }; |
okini3939 | 0:dc42aeff64e6 | 43 | |
okini3939 | 0:dc42aeff64e6 | 44 | #endif |