Year Two Project ELEC 2645: Embedded Systems Project Portable Weather Station
Dependencies: BMP180 ConfigFile N5110 PowerControl beep mbed
TempViewLogScreen.h@0:da2b8c7a1ec1, 2015-05-11 (annotated)
- Committer:
- OHstin
- Date:
- Mon May 11 15:25:52 2015 +0000
- Revision:
- 0:da2b8c7a1ec1
Completed Weather Station
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
OHstin | 0:da2b8c7a1ec1 | 1 | /** |
OHstin | 0:da2b8c7a1ec1 | 2 | @file TemperatureViewLogScreen.h |
OHstin | 0:da2b8c7a1ec1 | 3 | |
OHstin | 0:da2b8c7a1ec1 | 4 | */ |
OHstin | 0:da2b8c7a1ec1 | 5 | #ifndef TEMPVIEWLOGSCREEN_H |
OHstin | 0:da2b8c7a1ec1 | 6 | #define TEMPVIEWLOGSCREEN_H |
OHstin | 0:da2b8c7a1ec1 | 7 | |
OHstin | 0:da2b8c7a1ec1 | 8 | #include "DataController.h" |
OHstin | 0:da2b8c7a1ec1 | 9 | #include "Inputs.h" |
OHstin | 0:da2b8c7a1ec1 | 10 | |
OHstin | 0:da2b8c7a1ec1 | 11 | /** |
OHstin | 0:da2b8c7a1ec1 | 12 | @brief Displays the Temperature options |
OHstin | 0:da2b8c7a1ec1 | 13 | @brief It is a list with two selectable options :\n |
OHstin | 0:da2b8c7a1ec1 | 14 | @brief view temp and temp plot\n |
OHstin | 0:da2b8c7a1ec1 | 15 | @brief view temp shows the current temperature along with the sentiment\n |
OHstin | 0:da2b8c7a1ec1 | 16 | @brief temp plot plots the temperature against time on the LCD screen at various intervals\n |
OHstin | 0:da2b8c7a1ec1 | 17 | @author Augustine Kizito K |
OHstin | 0:da2b8c7a1ec1 | 18 | @date April 2015 |
OHstin | 0:da2b8c7a1ec1 | 19 | */ |
OHstin | 0:da2b8c7a1ec1 | 20 | |
OHstin | 0:da2b8c7a1ec1 | 21 | class TempViewLogScreen : public DataController |
OHstin | 0:da2b8c7a1ec1 | 22 | { |
OHstin | 0:da2b8c7a1ec1 | 23 | private: |
OHstin | 0:da2b8c7a1ec1 | 24 | |
OHstin | 0:da2b8c7a1ec1 | 25 | void onEnter(); // user pressed the enter button |
OHstin | 0:da2b8c7a1ec1 | 26 | void onBack(); // user pressed the back button |
OHstin | 0:da2b8c7a1ec1 | 27 | |
OHstin | 0:da2b8c7a1ec1 | 28 | public: |
OHstin | 0:da2b8c7a1ec1 | 29 | /** |
OHstin | 0:da2b8c7a1ec1 | 30 | Creates a Temperature View Log Screen instance |
OHstin | 0:da2b8c7a1ec1 | 31 | |
OHstin | 0:da2b8c7a1ec1 | 32 | */ |
OHstin | 0:da2b8c7a1ec1 | 33 | TempViewLogScreen() |
OHstin | 0:da2b8c7a1ec1 | 34 | :DataController( "/local/temp.cfg", // File location |
OHstin | 0:da2b8c7a1ec1 | 35 | 1) // parameter, 1 for temperatue, 0 for pressure |
OHstin | 0:da2b8c7a1ec1 | 36 | {}; |
OHstin | 0:da2b8c7a1ec1 | 37 | /** |
OHstin | 0:da2b8c7a1ec1 | 38 | Manages the execution of the Temperature View Log Screen |
OHstin | 0:da2b8c7a1ec1 | 39 | |
OHstin | 0:da2b8c7a1ec1 | 40 | @returns |
OHstin | 0:da2b8c7a1ec1 | 41 | |
OHstin | 0:da2b8c7a1ec1 | 42 | -1 - Navigate to previous screen |
OHstin | 0:da2b8c7a1ec1 | 43 | |
OHstin | 0:da2b8c7a1ec1 | 44 | */ |
OHstin | 0:da2b8c7a1ec1 | 45 | int start(); // Manages the execution of the Temperature Screen |
OHstin | 0:da2b8c7a1ec1 | 46 | |
OHstin | 0:da2b8c7a1ec1 | 47 | |
OHstin | 0:da2b8c7a1ec1 | 48 | }; |
OHstin | 0:da2b8c7a1ec1 | 49 | |
OHstin | 0:da2b8c7a1ec1 | 50 | |
OHstin | 0:da2b8c7a1ec1 | 51 | |
OHstin | 0:da2b8c7a1ec1 | 52 | |
OHstin | 0:da2b8c7a1ec1 | 53 | |
OHstin | 0:da2b8c7a1ec1 | 54 | |
OHstin | 0:da2b8c7a1ec1 | 55 | int TempViewLogScreen::start() |
OHstin | 0:da2b8c7a1ec1 | 56 | { |
OHstin | 0:da2b8c7a1ec1 | 57 | enterButton.mode(PullDown); |
OHstin | 0:da2b8c7a1ec1 | 58 | backButton.mode(PullDown); |
OHstin | 0:da2b8c7a1ec1 | 59 | |
OHstin | 0:da2b8c7a1ec1 | 60 | enterButton.rise(this,&TempViewLogScreen::onEnter); // call onEnter when the enter button is pressed |
OHstin | 0:da2b8c7a1ec1 | 61 | backButton.rise(this,&TempViewLogScreen::onBack); // call onBack when the back button is pressed |
OHstin | 0:da2b8c7a1ec1 | 62 | |
OHstin | 0:da2b8c7a1ec1 | 63 | debounce.start(); |
OHstin | 0:da2b8c7a1ec1 | 64 | |
OHstin | 0:da2b8c7a1ec1 | 65 | DataController::begin(); |
OHstin | 0:da2b8c7a1ec1 | 66 | |
OHstin | 0:da2b8c7a1ec1 | 67 | enterButton.rise(NULL); |
OHstin | 0:da2b8c7a1ec1 | 68 | backButton.rise(NULL); |
OHstin | 0:da2b8c7a1ec1 | 69 | return -1; |
OHstin | 0:da2b8c7a1ec1 | 70 | } |
OHstin | 0:da2b8c7a1ec1 | 71 | |
OHstin | 0:da2b8c7a1ec1 | 72 | void TempViewLogScreen::onEnter() |
OHstin | 0:da2b8c7a1ec1 | 73 | { |
OHstin | 0:da2b8c7a1ec1 | 74 | if (debounceSuccess()) { // check if debouncing succeeded |
OHstin | 0:da2b8c7a1ec1 | 75 | // sound the buzzer |
OHstin | 0:da2b8c7a1ec1 | 76 | playSound(); |
OHstin | 0:da2b8c7a1ec1 | 77 | DataController::nextPage(); |
OHstin | 0:da2b8c7a1ec1 | 78 | debounce.reset(); // reset the debounce timer |
OHstin | 0:da2b8c7a1ec1 | 79 | } |
OHstin | 0:da2b8c7a1ec1 | 80 | |
OHstin | 0:da2b8c7a1ec1 | 81 | } |
OHstin | 0:da2b8c7a1ec1 | 82 | |
OHstin | 0:da2b8c7a1ec1 | 83 | void TempViewLogScreen::onBack() |
OHstin | 0:da2b8c7a1ec1 | 84 | { |
OHstin | 0:da2b8c7a1ec1 | 85 | if (debounceSuccess()) { // check if debouncing succeeded |
OHstin | 0:da2b8c7a1ec1 | 86 | //sound the buzzer |
OHstin | 0:da2b8c7a1ec1 | 87 | playSound(); |
OHstin | 0:da2b8c7a1ec1 | 88 | DataController::previousPage(); |
OHstin | 0:da2b8c7a1ec1 | 89 | debounce.reset(); // reset the debounce timer |
OHstin | 0:da2b8c7a1ec1 | 90 | } |
OHstin | 0:da2b8c7a1ec1 | 91 | } |
OHstin | 0:da2b8c7a1ec1 | 92 | |
OHstin | 0:da2b8c7a1ec1 | 93 | #endif |