A Weather station designed to read the values of temperature and pressure from the sensor (BMP180), data displayed via a nokia N5110 display.

Dependencies:   BMP180 N5110 PowerControl mbed

Committer:
amiraseman
Date:
Sat May 09 01:08:16 2015 +0000
Revision:
23:a0ce9fa869c2
Child:
26:c0d8d2f68406
Final version. All the major parts are done ;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
amiraseman 23:a0ce9fa869c2 1 /**
amiraseman 23:a0ce9fa869c2 2
amiraseman 23:a0ce9fa869c2 3 @file Barometer.h
amiraseman 23:a0ce9fa869c2 4 @brief Header file containing member functions and variables
amiraseman 23:a0ce9fa869c2 5 @author Amir M. Asemanpayeh
amiraseman 23:a0ce9fa869c2 6 @date May 2015
amiraseman 23:a0ce9fa869c2 7
amiraseman 23:a0ce9fa869c2 8 @brief Header file - Contains Global Variables, GPIO and Pins and Function prototypes
amiraseman 23:a0ce9fa869c2 9
amiraseman 23:a0ce9fa869c2 10 */
amiraseman 23:a0ce9fa869c2 11
amiraseman 23:a0ce9fa869c2 12
amiraseman 23:a0ce9fa869c2 13 #include "mbed.h"
amiraseman 23:a0ce9fa869c2 14 #include "N5110.h"
amiraseman 23:a0ce9fa869c2 15 #include "BMP180.h"
amiraseman 23:a0ce9fa869c2 16 #include "PowerControl/PowerControl.h"
amiraseman 23:a0ce9fa869c2 17 #include "PowerControl/EthernetPowerControl.h"
amiraseman 23:a0ce9fa869c2 18
amiraseman 23:a0ce9fa869c2 19 /**
amiraseman 23:a0ce9fa869c2 20 @namespace bmp180
amiraseman 23:a0ce9fa869c2 21 @brief A I2C instance to interact with the BMP sensor \n SDA, SCL
amiraseman 23:a0ce9fa869c2 22 */
amiraseman 23:a0ce9fa869c2 23 BMP180 bmp180(p28,p27);
amiraseman 23:a0ce9fa869c2 24
amiraseman 23:a0ce9fa869c2 25
amiraseman 23:a0ce9fa869c2 26 /**
amiraseman 23:a0ce9fa869c2 27 @namespace lcd
amiraseman 23:a0ce9fa869c2 28 @brief A serial data protocol to operate with a master/slave relationship to interact with the lcd \n VCC,SCE,RST,D/C,MOSI,SCLK,LED
amiraseman 23:a0ce9fa869c2 29 */
amiraseman 23:a0ce9fa869c2 30 N5110 lcd(p7,p8,p9,p10,p11,p13,p26);
amiraseman 23:a0ce9fa869c2 31
amiraseman 23:a0ce9fa869c2 32
amiraseman 23:a0ce9fa869c2 33 /**
amiraseman 23:a0ce9fa869c2 34 @namespace leds
amiraseman 23:a0ce9fa869c2 35 @brief GPIO bus output for status LEDs
amiraseman 23:a0ce9fa869c2 36 */
amiraseman 23:a0ce9fa869c2 37 BusOut leds(LED4,LED3,LED2,LED1);
amiraseman 23:a0ce9fa869c2 38
amiraseman 23:a0ce9fa869c2 39
amiraseman 23:a0ce9fa869c2 40 /**
amiraseman 23:a0ce9fa869c2 41 @namespace serial
amiraseman 23:a0ce9fa869c2 42 @brief A USB Virtual Serial Port to print out messages to a host PC terminal
amiraseman 23:a0ce9fa869c2 43 */
amiraseman 23:a0ce9fa869c2 44 Serial serial(USBTX,USBRX);
amiraseman 23:a0ce9fa869c2 45
amiraseman 23:a0ce9fa869c2 46
amiraseman 23:a0ce9fa869c2 47 /**
amiraseman 23:a0ce9fa869c2 48 @namespace local
amiraseman 23:a0ce9fa869c2 49 @brief A local file system declared to store data files
amiraseman 23:a0ce9fa869c2 50 */
amiraseman 23:a0ce9fa869c2 51 LocalFileSystem local("local");
amiraseman 23:a0ce9fa869c2 52
amiraseman 23:a0ce9fa869c2 53
amiraseman 23:a0ce9fa869c2 54 /**
amiraseman 23:a0ce9fa869c2 55 @namespace button1
amiraseman 23:a0ce9fa869c2 56 @brief An Interrupt on digital pushbutton1 input p16
amiraseman 23:a0ce9fa869c2 57 */
amiraseman 23:a0ce9fa869c2 58 InterruptIn button1(p16);
amiraseman 23:a0ce9fa869c2 59
amiraseman 23:a0ce9fa869c2 60
amiraseman 23:a0ce9fa869c2 61 /**
amiraseman 23:a0ce9fa869c2 62 @namespace button2
amiraseman 23:a0ce9fa869c2 63 @brief An Interrupt on digital pushbutton2 input p17
amiraseman 23:a0ce9fa869c2 64 */
amiraseman 23:a0ce9fa869c2 65 InterruptIn button2(p17);
amiraseman 23:a0ce9fa869c2 66
amiraseman 23:a0ce9fa869c2 67
amiraseman 23:a0ce9fa869c2 68 /**
amiraseman 23:a0ce9fa869c2 69 @namespace button3
amiraseman 23:a0ce9fa869c2 70 @brief An Interrupt on digital pushbutton3 input p15
amiraseman 23:a0ce9fa869c2 71 */
amiraseman 23:a0ce9fa869c2 72 InterruptIn button3 (p15);
amiraseman 23:a0ce9fa869c2 73
amiraseman 23:a0ce9fa869c2 74
amiraseman 23:a0ce9fa869c2 75 /**
amiraseman 23:a0ce9fa869c2 76 @namespace button4
amiraseman 23:a0ce9fa869c2 77 @brief An Interrupt on digital pushbutton4 input p18
amiraseman 23:a0ce9fa869c2 78 */
amiraseman 23:a0ce9fa869c2 79 InterruptIn button4 (p18);
amiraseman 23:a0ce9fa869c2 80
amiraseman 23:a0ce9fa869c2 81
amiraseman 23:a0ce9fa869c2 82 /**
amiraseman 23:a0ce9fa869c2 83 @namespace redLED
amiraseman 23:a0ce9fa869c2 84 @brief A PwmOut interface is used to control the frequency and mark-space ratio of a led (The red LED)
amiraseman 23:a0ce9fa869c2 85 */
amiraseman 23:a0ce9fa869c2 86 PwmOut redLED(p24);//red
amiraseman 23:a0ce9fa869c2 87
amiraseman 23:a0ce9fa869c2 88
amiraseman 23:a0ce9fa869c2 89 /**
amiraseman 23:a0ce9fa869c2 90 @namespace yellowLED
amiraseman 23:a0ce9fa869c2 91 @brief A PwmOut interface is used to control the frequency and mark-space ratio of a led (The yellow LED)
amiraseman 23:a0ce9fa869c2 92 */
amiraseman 23:a0ce9fa869c2 93 PwmOut yellowLED(p23);//yellow
amiraseman 23:a0ce9fa869c2 94
amiraseman 23:a0ce9fa869c2 95
amiraseman 23:a0ce9fa869c2 96 /**
amiraseman 23:a0ce9fa869c2 97 @namespace greenLED
amiraseman 23:a0ce9fa869c2 98 @brief A PwmOut interface is used to control the frequency and mark-space ratio of a led (The green LED)
amiraseman 23:a0ce9fa869c2 99 */
amiraseman 23:a0ce9fa869c2 100 PwmOut greenLED(p22);
amiraseman 23:a0ce9fa869c2 101
amiraseman 23:a0ce9fa869c2 102
amiraseman 23:a0ce9fa869c2 103 /**
amiraseman 23:a0ce9fa869c2 104 @namespace buzzer
amiraseman 23:a0ce9fa869c2 105 @brief A PwmOut interface is used to control the frequency and mark-space ratio of a buzzer
amiraseman 23:a0ce9fa869c2 106 pulse train
amiraseman 23:a0ce9fa869c2 107 */
amiraseman 23:a0ce9fa869c2 108 PwmOut buzzer(p21);
amiraseman 23:a0ce9fa869c2 109
amiraseman 23:a0ce9fa869c2 110
amiraseman 23:a0ce9fa869c2 111 /**
amiraseman 23:a0ce9fa869c2 112 @namespace timer
amiraseman 23:a0ce9fa869c2 113 @brief Create ticker object for temperature and pressure readings
amiraseman 23:a0ce9fa869c2 114 */
amiraseman 23:a0ce9fa869c2 115 Ticker timer;
amiraseman 23:a0ce9fa869c2 116
amiraseman 23:a0ce9fa869c2 117
amiraseman 23:a0ce9fa869c2 118 /**
amiraseman 23:a0ce9fa869c2 119 @namespace dataLoggerTimer
amiraseman 23:a0ce9fa869c2 120 @brief a ticker object for the data logger functions
amiraseman 23:a0ce9fa869c2 121 */
amiraseman 23:a0ce9fa869c2 122 Ticker dataLoggerTimer ;
amiraseman 23:a0ce9fa869c2 123
amiraseman 23:a0ce9fa869c2 124
amiraseman 23:a0ce9fa869c2 125 /**
amiraseman 23:a0ce9fa869c2 126 @namespace powerSaverTimeout
amiraseman 23:a0ce9fa869c2 127 @brief create a timeout object for the poweerSaver function
amiraseman 23:a0ce9fa869c2 128 */
amiraseman 23:a0ce9fa869c2 129 Timeout powerSaverTimeout;
amiraseman 23:a0ce9fa869c2 130
amiraseman 23:a0ce9fa869c2 131 /**
amiraseman 23:a0ce9fa869c2 132 @namespace debounce
amiraseman 23:a0ce9fa869c2 133 @brief create a debounce timer object to implement a debounce counter to avoid multiple interrupts.
amiraseman 23:a0ce9fa869c2 134 */
amiraseman 23:a0ce9fa869c2 135 Timer debounce;
amiraseman 23:a0ce9fa869c2 136
amiraseman 23:a0ce9fa869c2 137
amiraseman 23:a0ce9fa869c2 138 int timerFlag = 1; /*!< Flag for tempesrature pressure reading ISR */
amiraseman 23:a0ce9fa869c2 139 int tickerFlag = 0 ; /*!<Flag to show the minutes passed */
amiraseman 23:a0ce9fa869c2 140 int button1Flag = 0; /*!< Flag set in button1Pressed ISR */
amiraseman 23:a0ce9fa869c2 141 int button2Flag = 0 ; /*!<Flag set in button2Pressed ISR */
amiraseman 23:a0ce9fa869c2 142 int button3Flag = 0 ; /*!< Flag set in button3Pressed ISR */
amiraseman 23:a0ce9fa869c2 143 int button4Flag = 0 ; /*!< Flag set in button4Pressed ISR */
amiraseman 23:a0ce9fa869c2 144 int unitFlag = 1 ; /*!< Flag set in the unitSettings function, indicates the units picked by user */
amiraseman 23:a0ce9fa869c2 145 int powerSaverFlag = 0 ; /*!<Flag set in the powerSettings function when the powerSaver is switched on */
amiraseman 23:a0ce9fa869c2 146 int lcdPowerFlag = 1 ; /*!< Flag set in the savePower function to indicate the status of the LCD (ON or OFF) */
amiraseman 23:a0ce9fa869c2 147 int dataLoggerFlag = 0 ; /*!< Flag set by user in the dataLoggerSetting function to turn on the logger */
amiraseman 23:a0ce9fa869c2 148 int runLoggerFlag = 0 ; /*!< Fag set when the logger is switched on, allows user to navigate to this option in the main menu */
amiraseman 23:a0ce9fa869c2 149 int alarmClockFlag = 0 ; /*!< Flag set in the AlarmClock function, indicates if the alarm clock has been turned on */
amiraseman 23:a0ce9fa869c2 150 int thresholdAlarmFlag = 0 ; /*!<Flag set in the thresholdAlarmmenu function,indicates if the thresholds are set */
amiraseman 23:a0ce9fa869c2 151
amiraseman 23:a0ce9fa869c2 152 int UNIXdate=0; /*!<An integer to store the value of UNIX time calculated by mktime function */
amiraseman 23:a0ce9fa869c2 153 int currentTime ;/*!<An integer to store the UNIX value of the current time */
amiraseman 23:a0ce9fa869c2 154 int powerSaverTime = 60; /*!<An integer to set the initial value of the power saver ticker */
amiraseman 23:a0ce9fa869c2 155 int dataLoggerTime = 60; /*!<An integer used to set the initial value of the data logger ticker */
amiraseman 23:a0ce9fa869c2 156
amiraseman 23:a0ce9fa869c2 157 float temperature; /*!<A float value to store the value of the temperature recieved from the sensor */
amiraseman 23:a0ce9fa869c2 158 float pressure; /*!<A float value to store the value of the pressure recieved from the sensor */
amiraseman 23:a0ce9fa869c2 159 float averageTemperature ; /*!<A float value to store the average value of temperature readingsn taken over a period of time */
amiraseman 23:a0ce9fa869c2 160 float averagePressure ; /*!<A float value to store the average value of pressure readings over a period of time */
amiraseman 23:a0ce9fa869c2 161 float minTemperature ; /*!<A float value to save the minimum value of temperature readings */
amiraseman 23:a0ce9fa869c2 162 float maxTemperature ; /*!<A float value to store the maximum value of temperature readings */
amiraseman 23:a0ce9fa869c2 163 float minPressure; /*!<A float value to store the minimum value of pressure readings */
amiraseman 23:a0ce9fa869c2 164 float maxPressure; /*!<A float value to store the maximum value of pressure readings */
amiraseman 23:a0ce9fa869c2 165
amiraseman 23:a0ce9fa869c2 166
amiraseman 23:a0ce9fa869c2 167
amiraseman 23:a0ce9fa869c2 168
amiraseman 23:a0ce9fa869c2 169 float arrayT[83] ; /*!<A A float array to store the values of temperature to calculate the average,minimum and maximum values*/
amiraseman 23:a0ce9fa869c2 170 float arrayP[83] ; /*!<A A float array to store the values of pressure to calculate the average,minimum and maximum values*/
amiraseman 23:a0ce9fa869c2 171 float arrayTG[83] ; /*!<A A float array to store the values of temperature to plot the related graph */
amiraseman 23:a0ce9fa869c2 172 float arrayPG[83] ;/*!<A A float array to store the values of pressure to plot the related graph */
amiraseman 23:a0ce9fa869c2 173
amiraseman 23:a0ce9fa869c2 174
amiraseman 23:a0ce9fa869c2 175 char bufferTime[14]; /*!<A A char array (buffer) to store time*/
amiraseman 23:a0ce9fa869c2 176 char bufferDate[14]; /*!<A A char array (buffer) to store date*/
amiraseman 23:a0ce9fa869c2 177 char bufferT[14];/*!<A A char array (buffer) to store the value of temperature in char*/
amiraseman 23:a0ce9fa869c2 178 char bufferP[14]; /*!<A A char array (buffer) to store the value of pressure in char */
amiraseman 23:a0ce9fa869c2 179 // each character is 6 pixels wide, screen is 84 pixels (84/6 = 14)
amiraseman 23:a0ce9fa869c2 180 // so can display a string of a maximum 14 characters in length
amiraseman 23:a0ce9fa869c2 181 // or create formatted strings - ensure they aren't more than 14 characters long
amiraseman 23:a0ce9fa869c2 182
amiraseman 23:a0ce9fa869c2 183
amiraseman 23:a0ce9fa869c2 184
amiraseman 23:a0ce9fa869c2 185 char buffer0[14]; /*!<A A char array (buffer) used to display data on the LCD at (0,0)*/
amiraseman 23:a0ce9fa869c2 186 char buffer1[14]; /*!<A A char array (buffer) used to display data on the LCD at (0,1)*/
amiraseman 23:a0ce9fa869c2 187 char buffer2[14]; /*!<A A char array (buffer) used to display data on the LCD at (0,2)*/
amiraseman 23:a0ce9fa869c2 188 char buffer3[14]; /*!<A A char array (buffer) used to display data on the LCD at (0,3)*/
amiraseman 23:a0ce9fa869c2 189 char buffer4[14]; /*!<A A char array (buffer) used to display data on the LCD at (0,4)*/
amiraseman 23:a0ce9fa869c2 190 char buffer5[14]; /*!<A A char array (buffer) used to display data on the LCD at (0,5)*/
amiraseman 23:a0ce9fa869c2 191
amiraseman 23:a0ce9fa869c2 192
amiraseman 23:a0ce9fa869c2 193
amiraseman 23:a0ce9fa869c2 194 //arrays used to store data to the local file
amiraseman 23:a0ce9fa869c2 195 char timeSent[1000]; /*!<A A char array used to save time staps to the local file */
amiraseman 23:a0ce9fa869c2 196 char dateSent[1000]; /*!<A A char array used to save date stamps the local file */
amiraseman 23:a0ce9fa869c2 197 char temperatureSent[1000]; /*!<A A char array used to save the temperature readings to the local file */
amiraseman 23:a0ce9fa869c2 198 char pressureSent[1000]; /*!<A A char array used to save the pressure readings to the local file */
amiraseman 23:a0ce9fa869c2 199 char temperatureRecieved[1000]; /*!<A A char array used to retrive the saved temperature readings from the local file */
amiraseman 23:a0ce9fa869c2 200 char pressureRecieved[1000]; /*!<A A char array used to retrive the saved pressure readings from the local file */
amiraseman 23:a0ce9fa869c2 201 char timeRecieved[1000]; /*!<A A char array used to retrive the saved time stamps from the local file */
amiraseman 23:a0ce9fa869c2 202 char dateRecieved[1000]; /*!<A A char array used to retrive the saved date stamps from the local file */
amiraseman 23:a0ce9fa869c2 203
amiraseman 23:a0ce9fa869c2 204
amiraseman 23:a0ce9fa869c2 205
amiraseman 23:a0ce9fa869c2 206 char * pch; /*!<A A char array used to split the char arrays of temperature values retrived from the local file to the individual temperature strings */
amiraseman 23:a0ce9fa869c2 207 char * pch1; /*!<A A char array used to split the char arrays of pressure values retrived from the local file to the individual pressure strings*/
amiraseman 23:a0ce9fa869c2 208 char * pch2; /*!<A A char array used to split the char arrays of times retrived from the local file to the individual time strings*/
amiraseman 23:a0ce9fa869c2 209 char * pch3; /*!<A A char array used to split the char arrays of dates retrived from the local file to the individual date strings*/
amiraseman 23:a0ce9fa869c2 210
amiraseman 23:a0ce9fa869c2 211
amiraseman 23:a0ce9fa869c2 212 int state=0; /*!<A An integer used to navigate through the finite machines (indexes)*/
amiraseman 23:a0ce9fa869c2 213
amiraseman 23:a0ce9fa869c2 214 float frequency[]= {659,554,659,554,659,554,659,554,659,554,659,554}; /*!<A An array of floats with different frequencies for the buzzer*/
amiraseman 23:a0ce9fa869c2 215
amiraseman 23:a0ce9fa869c2 216
amiraseman 23:a0ce9fa869c2 217
amiraseman 23:a0ce9fa869c2 218
amiraseman 23:a0ce9fa869c2 219
amiraseman 23:a0ce9fa869c2 220 struct State {
amiraseman 23:a0ce9fa869c2 221 int output;
amiraseman 23:a0ce9fa869c2 222 char title[14];
amiraseman 23:a0ce9fa869c2 223 int nextState[2];
amiraseman 23:a0ce9fa869c2 224 };
amiraseman 23:a0ce9fa869c2 225
amiraseman 23:a0ce9fa869c2 226 typedef struct State STyp1; // for the start menu
amiraseman 23:a0ce9fa869c2 227
amiraseman 23:a0ce9fa869c2 228 STyp1 fsmA[4] = {
amiraseman 23:a0ce9fa869c2 229 {0,"Live Data",{1,3}},
amiraseman 23:a0ce9fa869c2 230 {1,"Saved Data",{2,0}},
amiraseman 23:a0ce9fa869c2 231 {2,"Alarms",{3,1}},
amiraseman 23:a0ce9fa869c2 232 {3,"Settings",{0,2}},
amiraseman 23:a0ce9fa869c2 233 };
amiraseman 23:a0ce9fa869c2 234
amiraseman 23:a0ce9fa869c2 235 typedef struct State STyp2; // for the settings menu
amiraseman 23:a0ce9fa869c2 236
amiraseman 23:a0ce9fa869c2 237 STyp2 fsmB[4] = {
amiraseman 23:a0ce9fa869c2 238 {0,"Date/Time",{1,3}},
amiraseman 23:a0ce9fa869c2 239 {1,"Units",{2,0}},
amiraseman 23:a0ce9fa869c2 240 {2,"Power Saver",{3,1}},
amiraseman 23:a0ce9fa869c2 241 {3,"Data Logger",{0,2}},
amiraseman 23:a0ce9fa869c2 242 };
amiraseman 23:a0ce9fa869c2 243
amiraseman 23:a0ce9fa869c2 244 typedef struct State STyp3; // for the time/date settings
amiraseman 23:a0ce9fa869c2 245
amiraseman 23:a0ce9fa869c2 246 STyp3 fsmC[5] = {
amiraseman 23:a0ce9fa869c2 247 {12,"Hour:",{1,4}},
amiraseman 23:a0ce9fa869c2 248 {0,"Min:",{2,0}},
amiraseman 23:a0ce9fa869c2 249 {21,"Day:",{3,1}},
amiraseman 23:a0ce9fa869c2 250 {4,"Month:",{4,2}},
amiraseman 23:a0ce9fa869c2 251 {2015,"Year:",{0,3}},
amiraseman 23:a0ce9fa869c2 252 };
amiraseman 23:a0ce9fa869c2 253
amiraseman 23:a0ce9fa869c2 254
amiraseman 23:a0ce9fa869c2 255 typedef struct State STyp4; // for the units settings
amiraseman 23:a0ce9fa869c2 256
amiraseman 23:a0ce9fa869c2 257 STyp3 fsmD[4] = {
amiraseman 23:a0ce9fa869c2 258 {1,"C/mb",{1,3}},
amiraseman 23:a0ce9fa869c2 259 {2,"C/atm",{2,0}},
amiraseman 23:a0ce9fa869c2 260 {3,"F/mb",{3,1}},
amiraseman 23:a0ce9fa869c2 261 {4,"F/atm",{0,2}},
amiraseman 23:a0ce9fa869c2 262 };
amiraseman 23:a0ce9fa869c2 263
amiraseman 23:a0ce9fa869c2 264
amiraseman 23:a0ce9fa869c2 265 typedef struct State STyp5; // for the Power saver settings
amiraseman 23:a0ce9fa869c2 266
amiraseman 23:a0ce9fa869c2 267 STyp5 fsmE[2] = {
amiraseman 23:a0ce9fa869c2 268 {0,"Off",{1,1}},
amiraseman 23:a0ce9fa869c2 269 {60,"On",{0,0}},
amiraseman 23:a0ce9fa869c2 270 };
amiraseman 23:a0ce9fa869c2 271
amiraseman 23:a0ce9fa869c2 272
amiraseman 23:a0ce9fa869c2 273 typedef struct State Stype6; // for the alarms menu
amiraseman 23:a0ce9fa869c2 274
amiraseman 23:a0ce9fa869c2 275 Stype6 fsmF[2] = {
amiraseman 23:a0ce9fa869c2 276 {0,"Thresholds",{1,1}},
amiraseman 23:a0ce9fa869c2 277 {1,"Alarm Clock", {0,0}},
amiraseman 23:a0ce9fa869c2 278 };
amiraseman 23:a0ce9fa869c2 279
amiraseman 23:a0ce9fa869c2 280 typedef struct State Stype7; // yes or no
amiraseman 23:a0ce9fa869c2 281
amiraseman 23:a0ce9fa869c2 282 Stype7 fsmG[2] = {
amiraseman 23:a0ce9fa869c2 283 {1,"Yes",{1,1}},
amiraseman 23:a0ce9fa869c2 284 {0,"No", {0,0}},
amiraseman 23:a0ce9fa869c2 285 };
amiraseman 23:a0ce9fa869c2 286
amiraseman 23:a0ce9fa869c2 287 typedef struct State Stype8; // for the thresholds
amiraseman 23:a0ce9fa869c2 288
amiraseman 23:a0ce9fa869c2 289 Stype8 fsmH[4] = {
amiraseman 23:a0ce9fa869c2 290 {20,"Min T:",{1,3}},
amiraseman 23:a0ce9fa869c2 291 {30,"Max T:",{2,0}},
amiraseman 23:a0ce9fa869c2 292 {1000,"Min P:",{3,1}},
amiraseman 23:a0ce9fa869c2 293 {1100,"Max P:",{0,2}},
amiraseman 23:a0ce9fa869c2 294 };
amiraseman 23:a0ce9fa869c2 295
amiraseman 23:a0ce9fa869c2 296
amiraseman 23:a0ce9fa869c2 297 /**
amiraseman 23:a0ce9fa869c2 298 Adds up two integer variables
amiraseman 23:a0ce9fa869c2 299 @param a - integer to add
amiraseman 23:a0ce9fa869c2 300 @param b - integer to add
amiraseman 23:a0ce9fa869c2 301 @returns the sum of a and b
amiraseman 23:a0ce9fa869c2 302 */
amiraseman 23:a0ce9fa869c2 303 void button1Pressed();
amiraseman 23:a0ce9fa869c2 304
amiraseman 23:a0ce9fa869c2 305 /**
amiraseman 23:a0ce9fa869c2 306 Adds up two integer variables
amiraseman 23:a0ce9fa869c2 307 @param a - integer to add
amiraseman 23:a0ce9fa869c2 308 @param b - integer to add
amiraseman 23:a0ce9fa869c2 309 @returns the sum of a and b
amiraseman 23:a0ce9fa869c2 310 */
amiraseman 23:a0ce9fa869c2 311 void button2Pressed();
amiraseman 23:a0ce9fa869c2 312
amiraseman 23:a0ce9fa869c2 313 /**
amiraseman 23:a0ce9fa869c2 314 Adds up two integer variables
amiraseman 23:a0ce9fa869c2 315 @param a - integer to add
amiraseman 23:a0ce9fa869c2 316 @param b - integer to add
amiraseman 23:a0ce9fa869c2 317 @returns the sum of a and b
amiraseman 23:a0ce9fa869c2 318 */
amiraseman 23:a0ce9fa869c2 319 void button3Pressed();
amiraseman 23:a0ce9fa869c2 320
amiraseman 23:a0ce9fa869c2 321 /**
amiraseman 23:a0ce9fa869c2 322 Adds up two integer variables
amiraseman 23:a0ce9fa869c2 323 @param a - integer to add
amiraseman 23:a0ce9fa869c2 324 @param b - integer to add
amiraseman 23:a0ce9fa869c2 325 @returns the sum of a and b
amiraseman 23:a0ce9fa869c2 326 */
amiraseman 23:a0ce9fa869c2 327 void button4Pressed();
amiraseman 23:a0ce9fa869c2 328
amiraseman 23:a0ce9fa869c2 329 /**
amiraseman 23:a0ce9fa869c2 330 Adds up two integer variables
amiraseman 23:a0ce9fa869c2 331 @param a - integer to add
amiraseman 23:a0ce9fa869c2 332 @param b - integer to add
amiraseman 23:a0ce9fa869c2 333 @returns the sum of a and b
amiraseman 23:a0ce9fa869c2 334 */
amiraseman 23:a0ce9fa869c2 335 void timerExpired();
amiraseman 23:a0ce9fa869c2 336
amiraseman 23:a0ce9fa869c2 337 /**
amiraseman 23:a0ce9fa869c2 338 Adds up two integer variables
amiraseman 23:a0ce9fa869c2 339 @param a - integer to add
amiraseman 23:a0ce9fa869c2 340 @param b - integer to add
amiraseman 23:a0ce9fa869c2 341 @returns the sum of a and b
amiraseman 23:a0ce9fa869c2 342 */
amiraseman 23:a0ce9fa869c2 343 void dataLoggerTimerExpired ();
amiraseman 23:a0ce9fa869c2 344
amiraseman 23:a0ce9fa869c2 345 /**
amiraseman 23:a0ce9fa869c2 346 Adds up two integer variables
amiraseman 23:a0ce9fa869c2 347 @param a - integer to add
amiraseman 23:a0ce9fa869c2 348 @param b - integer to add
amiraseman 23:a0ce9fa869c2 349 @returns the sum of a and b
amiraseman 23:a0ce9fa869c2 350 */
amiraseman 23:a0ce9fa869c2 351 void tickerExpired ();
amiraseman 23:a0ce9fa869c2 352
amiraseman 23:a0ce9fa869c2 353 /**
amiraseman 23:a0ce9fa869c2 354 Adds up two integer variables
amiraseman 23:a0ce9fa869c2 355 @param a - integer to add
amiraseman 23:a0ce9fa869c2 356 @param b - integer to add
amiraseman 23:a0ce9fa869c2 357 @returns the sum of a and b
amiraseman 23:a0ce9fa869c2 358 */
amiraseman 23:a0ce9fa869c2 359 void saveToFile(char *data,char *data1,char *data2,char *data3);
amiraseman 23:a0ce9fa869c2 360
amiraseman 23:a0ce9fa869c2 361 /**
amiraseman 23:a0ce9fa869c2 362 Adds up two integer variables
amiraseman 23:a0ce9fa869c2 363 @param a - integer to add
amiraseman 23:a0ce9fa869c2 364 @param b - integer to add
amiraseman 23:a0ce9fa869c2 365 @returns the sum of a and b
amiraseman 23:a0ce9fa869c2 366 */
amiraseman 23:a0ce9fa869c2 367 void updateTime();
amiraseman 23:a0ce9fa869c2 368
amiraseman 23:a0ce9fa869c2 369 /**
amiraseman 23:a0ce9fa869c2 370 Adds up two integer variables
amiraseman 23:a0ce9fa869c2 371 @param a - integer to add
amiraseman 23:a0ce9fa869c2 372 @param b - integer to add
amiraseman 23:a0ce9fa869c2 373 @returns the sum of a and b
amiraseman 23:a0ce9fa869c2 374 */
amiraseman 23:a0ce9fa869c2 375 void display();
amiraseman 23:a0ce9fa869c2 376
amiraseman 23:a0ce9fa869c2 377 /**
amiraseman 23:a0ce9fa869c2 378 Adds up two integer variables
amiraseman 23:a0ce9fa869c2 379 @param a - integer to add
amiraseman 23:a0ce9fa869c2 380 @param b - integer to add
amiraseman 23:a0ce9fa869c2 381 @returns the sum of a and b
amiraseman 23:a0ce9fa869c2 382 */
amiraseman 23:a0ce9fa869c2 383 void readData();
amiraseman 23:a0ce9fa869c2 384
amiraseman 23:a0ce9fa869c2 385
amiraseman 23:a0ce9fa869c2 386 /**
amiraseman 23:a0ce9fa869c2 387 Adds up two integer variables
amiraseman 23:a0ce9fa869c2 388 @param a - integer to add
amiraseman 23:a0ce9fa869c2 389 @param b - integer to add
amiraseman 23:a0ce9fa869c2 390 @returns the sum of a and b
amiraseman 23:a0ce9fa869c2 391 */
amiraseman 23:a0ce9fa869c2 392 void powerSaverExpired();
amiraseman 23:a0ce9fa869c2 393
amiraseman 23:a0ce9fa869c2 394 /**
amiraseman 23:a0ce9fa869c2 395 Adds up two integer variables
amiraseman 23:a0ce9fa869c2 396 @param a - integer to add
amiraseman 23:a0ce9fa869c2 397 @param b - integer to add
amiraseman 23:a0ce9fa869c2 398 @returns the sum of a and b
amiraseman 23:a0ce9fa869c2 399 */
amiraseman 23:a0ce9fa869c2 400 void powerSaverCheck();
amiraseman 23:a0ce9fa869c2 401
amiraseman 23:a0ce9fa869c2 402 /**
amiraseman 23:a0ce9fa869c2 403 Adds up two integer variables
amiraseman 23:a0ce9fa869c2 404 @param a - integer to add
amiraseman 23:a0ce9fa869c2 405 @param b - integer to add
amiraseman 23:a0ce9fa869c2 406 @returns the sum of a and b
amiraseman 23:a0ce9fa869c2 407 */
amiraseman 23:a0ce9fa869c2 408 void liveData();
amiraseman 23:a0ce9fa869c2 409
amiraseman 23:a0ce9fa869c2 410 /**
amiraseman 23:a0ce9fa869c2 411 Adds up two integer variables
amiraseman 23:a0ce9fa869c2 412 @param a - integer to add
amiraseman 23:a0ce9fa869c2 413 @param b - integer to add
amiraseman 23:a0ce9fa869c2 414 @returns the sum of a and b
amiraseman 23:a0ce9fa869c2 415 */
amiraseman 23:a0ce9fa869c2 416 void loggerData();
amiraseman 23:a0ce9fa869c2 417
amiraseman 23:a0ce9fa869c2 418 /**
amiraseman 23:a0ce9fa869c2 419 Adds up two integer variables
amiraseman 23:a0ce9fa869c2 420 @param a - integer to add
amiraseman 23:a0ce9fa869c2 421 @param b - integer to add
amiraseman 23:a0ce9fa869c2 422 @returns the sum of a and b
amiraseman 23:a0ce9fa869c2 423 */
amiraseman 23:a0ce9fa869c2 424 void dataLogger();
amiraseman 23:a0ce9fa869c2 425
amiraseman 23:a0ce9fa869c2 426 /**
amiraseman 23:a0ce9fa869c2 427 Adds up two integer variables
amiraseman 23:a0ce9fa869c2 428 @param a - integer to add
amiraseman 23:a0ce9fa869c2 429 @param b - integer to add
amiraseman 23:a0ce9fa869c2 430 @returns the sum of a and b
amiraseman 23:a0ce9fa869c2 431 */
amiraseman 23:a0ce9fa869c2 432 void forecast();
amiraseman 23:a0ce9fa869c2 433
amiraseman 23:a0ce9fa869c2 434 /**
amiraseman 23:a0ce9fa869c2 435 Adds up two integer variables
amiraseman 23:a0ce9fa869c2 436 @param a - integer to add
amiraseman 23:a0ce9fa869c2 437 @param b - integer to add
amiraseman 23:a0ce9fa869c2 438 @returns the sum of a and b
amiraseman 23:a0ce9fa869c2 439 */
amiraseman 23:a0ce9fa869c2 440 void thresholdCheck();
amiraseman 23:a0ce9fa869c2 441
amiraseman 23:a0ce9fa869c2 442 /**
amiraseman 23:a0ce9fa869c2 443 Adds up two integer variables
amiraseman 23:a0ce9fa869c2 444 @param a - integer to add
amiraseman 23:a0ce9fa869c2 445 @param b - integer to add
amiraseman 23:a0ce9fa869c2 446 @returns the sum of a and b
amiraseman 23:a0ce9fa869c2 447 */
amiraseman 23:a0ce9fa869c2 448 void threshold();
amiraseman 23:a0ce9fa869c2 449
amiraseman 23:a0ce9fa869c2 450 /**
amiraseman 23:a0ce9fa869c2 451 Adds up two integer variables
amiraseman 23:a0ce9fa869c2 452 @param a - integer to add
amiraseman 23:a0ce9fa869c2 453 @param b - integer to add
amiraseman 23:a0ce9fa869c2 454 @returns the sum of a and b
amiraseman 23:a0ce9fa869c2 455 */
amiraseman 23:a0ce9fa869c2 456 void alarmClockCheck();
amiraseman 23:a0ce9fa869c2 457
amiraseman 23:a0ce9fa869c2 458 /**
amiraseman 23:a0ce9fa869c2 459 Adds up two integer variables
amiraseman 23:a0ce9fa869c2 460 @param a - integer to add
amiraseman 23:a0ce9fa869c2 461 @param b - integer to add
amiraseman 23:a0ce9fa869c2 462 @returns the sum of a and b
amiraseman 23:a0ce9fa869c2 463 */
amiraseman 23:a0ce9fa869c2 464 void alarmClock ();
amiraseman 23:a0ce9fa869c2 465
amiraseman 23:a0ce9fa869c2 466 /**
amiraseman 23:a0ce9fa869c2 467 Adds up two integer variables
amiraseman 23:a0ce9fa869c2 468 @param a - integer to add
amiraseman 23:a0ce9fa869c2 469 @param b - integer to add
amiraseman 23:a0ce9fa869c2 470 @returns the sum of a and b
amiraseman 23:a0ce9fa869c2 471 */
amiraseman 23:a0ce9fa869c2 472 void alarmsMenu ();
amiraseman 23:a0ce9fa869c2 473
amiraseman 23:a0ce9fa869c2 474 /**
amiraseman 23:a0ce9fa869c2 475 Adds up two integer variables
amiraseman 23:a0ce9fa869c2 476 @param a - integer to add
amiraseman 23:a0ce9fa869c2 477 @param b - integer to add
amiraseman 23:a0ce9fa869c2 478 @returns the sum of a and b
amiraseman 23:a0ce9fa869c2 479 */
amiraseman 23:a0ce9fa869c2 480 void dataLoggerSetting();
amiraseman 23:a0ce9fa869c2 481
amiraseman 23:a0ce9fa869c2 482 /**
amiraseman 23:a0ce9fa869c2 483 *Third option in the settings menu./n
amiraseman 23:a0ce9fa869c2 484 *Allows the user to turn on the power saving option and set the value of time out /n
amiraseman 23:a0ce9fa869c2 485 *Attaches a timeout to set the powerSaverFlag /n
amiraseman 23:a0ce9fa869c2 486 @param powerSaverFlag - integer used as a flag to indicate if the power saver option is switched on or off
amiraseman 23:a0ce9fa869c2 487 @param state - integer used to navigate through fsm states
amiraseman 23:a0ce9fa869c2 488 */
amiraseman 23:a0ce9fa869c2 489 void powerSaverSetting();
amiraseman 23:a0ce9fa869c2 490
amiraseman 23:a0ce9fa869c2 491 /**
amiraseman 23:a0ce9fa869c2 492 *Calculates the UNIX time value./n
amiraseman 23:a0ce9fa869c2 493 *Sets the integer values entered by user to the tm structure mebers /n
amiraseman 23:a0ce9fa869c2 494 *Converts the tm structure to time_t /n
amiraseman 23:a0ce9fa869c2 495 @param timeinfo - tm struct sent to mktime function
amiraseman 23:a0ce9fa869c2 496 @param rawtime - fundamental arithmetic type to represent the current time informations
amiraseman 23:a0ce9fa869c2 497 */
amiraseman 23:a0ce9fa869c2 498 void calculateUNIXTime();
amiraseman 23:a0ce9fa869c2 499
amiraseman 23:a0ce9fa869c2 500 /**
amiraseman 23:a0ce9fa869c2 501 *The second option in the settings menu./n
amiraseman 23:a0ce9fa869c2 502 *Allows the user to change the units /n
amiraseman 23:a0ce9fa869c2 503 @param unitFlag - integer used as a flag to indicate the units set
amiraseman 23:a0ce9fa869c2 504 @param state - integer used to navigate through fsm states
amiraseman 23:a0ce9fa869c2 505 */
amiraseman 23:a0ce9fa869c2 506 void unitsSetting();
amiraseman 23:a0ce9fa869c2 507
amiraseman 23:a0ce9fa869c2 508
amiraseman 23:a0ce9fa869c2 509 /**
amiraseman 23:a0ce9fa869c2 510 *The first option in the settings menu./n
amiraseman 23:a0ce9fa869c2 511 *Allows the user to enter time and date /n
amiraseman 23:a0ce9fa869c2 512 *Sends the recieved int arrays to the calculateUNIXtime function to calculate the unix time /n
amiraseman 23:a0ce9fa869c2 513 *sets the current time to the calculated unix time.
amiraseman 23:a0ce9fa869c2 514 @param state - integer used to navigate through fsm states
amiraseman 23:a0ce9fa869c2 515 */
amiraseman 23:a0ce9fa869c2 516 void timeDateSetting();
amiraseman 23:a0ce9fa869c2 517
amiraseman 23:a0ce9fa869c2 518
amiraseman 23:a0ce9fa869c2 519 /**
amiraseman 23:a0ce9fa869c2 520 *The setting menu displayed when the fourth state of fsmA is picked from the main menu /n
amiraseman 23:a0ce9fa869c2 521 *Depends on the state of the finite state machine used for this function, put the related title in the screen buffers /n
amiraseman 23:a0ce9fa869c2 522 *Also copy the bufferTime (buffer used to store time) on the first screen buffer (at the top) /n
amiraseman 23:a0ce9fa869c2 523 *Displays the screen buffers on the LCD/n
amiraseman 23:a0ce9fa869c2 524 *switch statement checks the current state of the fsm (fsmB),
amiraseman 23:a0ce9fa869c2 525 *The related function to each fsm state is executed as when a rising edge from the 4th button interrupts (button 4 is pressed)
amiraseman 23:a0ce9fa869c2 526
amiraseman 23:a0ce9fa869c2 527 */
amiraseman 23:a0ce9fa869c2 528 void settingsMenu();
amiraseman 23:a0ce9fa869c2 529
amiraseman 23:a0ce9fa869c2 530 /**
amiraseman 23:a0ce9fa869c2 531 *The main menu displayed at the start /n
amiraseman 23:a0ce9fa869c2 532 *Depends on the state of the finite state machine (fsmA) used for this function, put the related title in the screen buffers /n
amiraseman 23:a0ce9fa869c2 533 *Also copy the bufferTime (buffer used to store time) on the first screen buffer (at the top) /n
amiraseman 23:a0ce9fa869c2 534 *Displays the screen buffers on the LCD/n
amiraseman 23:a0ce9fa869c2 535 *switch statement checks the current state of the fsm (fsmA),
amiraseman 23:a0ce9fa869c2 536 *The related function to each fsm state is executed as when a rising edge from the 4th button interrupts (button 4 is pressed)
amiraseman 23:a0ce9fa869c2 537
amiraseman 23:a0ce9fa869c2 538 */
amiraseman 23:a0ce9fa869c2 539 void startMenu();
amiraseman 23:a0ce9fa869c2 540
amiraseman 23:a0ce9fa869c2 541
amiraseman 23:a0ce9fa869c2 542
amiraseman 23:a0ce9fa869c2 543
amiraseman 23:a0ce9fa869c2 544