Year Two Project ELEC 2645: Embedded Systems Project Portable Weather Station

Dependencies:   BMP180 ConfigFile N5110 PowerControl beep mbed

Committer:
OHstin
Date:
Mon May 11 15:25:52 2015 +0000
Revision:
0:da2b8c7a1ec1
Completed Weather Station

Who changed what in which revision?

UserRevisionLine numberNew contents of line
OHstin 0:da2b8c7a1ec1 1 /**
OHstin 0:da2b8c7a1ec1 2 @file PressureViewLogScreen.h
OHstin 0:da2b8c7a1ec1 3
OHstin 0:da2b8c7a1ec1 4 */
OHstin 0:da2b8c7a1ec1 5
OHstin 0:da2b8c7a1ec1 6 #ifndef PRSVIEWLOGSCREEN_H
OHstin 0:da2b8c7a1ec1 7 #define PRSVIEWLOGSCREEN_H
OHstin 0:da2b8c7a1ec1 8
OHstin 0:da2b8c7a1ec1 9 #include "DataController.h"
OHstin 0:da2b8c7a1ec1 10 #include "Inputs.h"
OHstin 0:da2b8c7a1ec1 11
OHstin 0:da2b8c7a1ec1 12 /**
OHstin 0:da2b8c7a1ec1 13 @brief shows previously logged pressure data on the LCD screen\n
OHstin 0:da2b8c7a1ec1 14 @brief the pressure data is displayed in a convenient way by use of
OHstin 0:da2b8c7a1ec1 15 @brief a data controller
OHstin 0:da2b8c7a1ec1 16 @author Augustine K Kizito
OHstin 0:da2b8c7a1ec1 17 @date April 2015
OHstin 0:da2b8c7a1ec1 18 */
OHstin 0:da2b8c7a1ec1 19
OHstin 0:da2b8c7a1ec1 20 class PrsViewLogScreen : public DataController
OHstin 0:da2b8c7a1ec1 21 {
OHstin 0:da2b8c7a1ec1 22 private:
OHstin 0:da2b8c7a1ec1 23
OHstin 0:da2b8c7a1ec1 24 void onEnter(); // user pressed the enter button
OHstin 0:da2b8c7a1ec1 25 void onBack(); // user pressed the back button
OHstin 0:da2b8c7a1ec1 26
OHstin 0:da2b8c7a1ec1 27 public:
OHstin 0:da2b8c7a1ec1 28 /**
OHstin 0:da2b8c7a1ec1 29 Creates an instance of the Pressure View Log Screen
OHstin 0:da2b8c7a1ec1 30
OHstin 0:da2b8c7a1ec1 31 */
OHstin 0:da2b8c7a1ec1 32 PrsViewLogScreen()
OHstin 0:da2b8c7a1ec1 33 :DataController( "/local/prs.cfg", // File location
OHstin 0:da2b8c7a1ec1 34 0) // parameter, 1 for temperatue, 0 for pressure
OHstin 0:da2b8c7a1ec1 35 {};
OHstin 0:da2b8c7a1ec1 36 /**
OHstin 0:da2b8c7a1ec1 37 Manages the execution of the Pressure View Log Screen
OHstin 0:da2b8c7a1ec1 38
OHstin 0:da2b8c7a1ec1 39 @returns
OHstin 0:da2b8c7a1ec1 40
OHstin 0:da2b8c7a1ec1 41 -1 - Navigate to previous screen
OHstin 0:da2b8c7a1ec1 42 */
OHstin 0:da2b8c7a1ec1 43 int start();
OHstin 0:da2b8c7a1ec1 44
OHstin 0:da2b8c7a1ec1 45
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
OHstin 0:da2b8c7a1ec1 56
OHstin 0:da2b8c7a1ec1 57 int PrsViewLogScreen::start()
OHstin 0:da2b8c7a1ec1 58 {
OHstin 0:da2b8c7a1ec1 59 enterButton.mode(PullDown);
OHstin 0:da2b8c7a1ec1 60 backButton.mode(PullDown);
OHstin 0:da2b8c7a1ec1 61
OHstin 0:da2b8c7a1ec1 62 enterButton.rise(this,&PrsViewLogScreen::onEnter); // call onEnter when the enter button is pressed
OHstin 0:da2b8c7a1ec1 63 backButton.rise(this,&PrsViewLogScreen::onBack); // call onBack when the back button is pressed
OHstin 0:da2b8c7a1ec1 64
OHstin 0:da2b8c7a1ec1 65 debounce.start();
OHstin 0:da2b8c7a1ec1 66
OHstin 0:da2b8c7a1ec1 67 // launch the data controller
OHstin 0:da2b8c7a1ec1 68 DataController::begin();
OHstin 0:da2b8c7a1ec1 69
OHstin 0:da2b8c7a1ec1 70 enterButton.rise(NULL);
OHstin 0:da2b8c7a1ec1 71 backButton.rise(NULL);
OHstin 0:da2b8c7a1ec1 72 return -1;
OHstin 0:da2b8c7a1ec1 73 }
OHstin 0:da2b8c7a1ec1 74
OHstin 0:da2b8c7a1ec1 75 void PrsViewLogScreen::onEnter()
OHstin 0:da2b8c7a1ec1 76 {
OHstin 0:da2b8c7a1ec1 77 if (debounceSuccess()) { // check if debouncing succeeded
OHstin 0:da2b8c7a1ec1 78 // sound the buzzer
OHstin 0:da2b8c7a1ec1 79 playSound();
OHstin 0:da2b8c7a1ec1 80 DataController::nextPage();
OHstin 0:da2b8c7a1ec1 81 debounce.reset(); // reset the debounce timer
OHstin 0:da2b8c7a1ec1 82 }
OHstin 0:da2b8c7a1ec1 83
OHstin 0:da2b8c7a1ec1 84 }
OHstin 0:da2b8c7a1ec1 85
OHstin 0:da2b8c7a1ec1 86 void PrsViewLogScreen::onBack()
OHstin 0:da2b8c7a1ec1 87 {
OHstin 0:da2b8c7a1ec1 88 if (debounceSuccess()) { // check if debouncing succeeded
OHstin 0:da2b8c7a1ec1 89 // sound the buzzer
OHstin 0:da2b8c7a1ec1 90 playSound();
OHstin 0:da2b8c7a1ec1 91 DataController::previousPage();
OHstin 0:da2b8c7a1ec1 92 debounce.reset(); // reset the debounce timer
OHstin 0:da2b8c7a1ec1 93 }
OHstin 0:da2b8c7a1ec1 94 }
OHstin 0:da2b8c7a1ec1 95
OHstin 0:da2b8c7a1ec1 96 #endif