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
Diff: Barometer.h
- Revision:
- 27:06fbad36c15e
- Parent:
- 26:c0d8d2f68406
--- a/Barometer.h Mon May 11 10:12:22 2015 +0000 +++ b/Barometer.h Mon May 11 22:10:42 2015 +0000 @@ -217,16 +217,23 @@ - - +/** +A structure, contains the output, titles and nextstate data +@param output - integer value holds the output value of the members +@param title - char array contains titles of the members +@param nextState - int array contains the values for the next and previous states +*/ struct State { int output; char title[14]; int nextState[2]; }; + +/** +Initialises a typedef struct, contains the output, titles and nextstate data for the start menu +*/ typedef struct State STyp1; // for the start menu - STyp1 fsmA[4] = { {0,"Live Data",{1,3}}, {1,"Saved Data",{2,0}}, @@ -234,8 +241,11 @@ {3,"Settings",{0,2}}, }; + +/** +Initialises a typedef struct, contains the output, titles and nextstate data for the settings menu +*/ typedef struct State STyp2; // for the settings menu - STyp2 fsmB[4] = { {0,"Date/Time",{1,3}}, {1,"Units",{2,0}}, @@ -243,8 +253,10 @@ {3,"Data Logger",{0,2}}, }; +/** +Initialises a typedef struct, contains the output, titles and nextstate data for the time/date settings also the alarmclock function +*/ typedef struct State STyp3; // for the time/date settings - STyp3 fsmC[5] = { {12,"Hour:",{1,4}}, {0,"Min:",{2,0}}, @@ -254,8 +266,10 @@ }; +/** +Initialises a typedef struct, contains the output, titles and nextstate data for the unitsettings function +*/ typedef struct State STyp4; // for the units settings - STyp3 fsmD[4] = { {1,"C/mb",{1,3}}, {2,"C/atm",{2,0}}, @@ -263,31 +277,37 @@ {4,"F/atm",{0,2}}, }; - +/** +Initialises a typedef struct, contains the output, titles and nextstate data for the powerSaverSetting +*/ typedef struct State STyp5; // for the Power saver settings - STyp5 fsmE[2] = { {0,"Off",{1,1}}, {60,"On",{0,0}}, }; - +/** +Initialises a typedef struct, contains the output, titles and nextstate data for the alarms menu +*/ typedef struct State Stype6; // for the alarms menu - Stype6 fsmF[2] = { {0,"Thresholds",{1,1}}, {1,"Alarm Clock", {0,0}}, }; +/** +Initialises a typedef struct, contains the output, titles and nextstate data for the threshold and alarmclock functions +*/ typedef struct State Stype7; // yes or no - Stype7 fsmG[2] = { {1,"Yes",{1,1}}, {0,"No", {0,0}}, }; +/** +Initialises a typedef struct, contains the output, titles and nextstate data for the threshold menu +*/ typedef struct State Stype8; // for the thresholds - Stype8 fsmH[4] = { {20,"Min T:",{1,3}}, {30,"Max T:",{2,0}}, @@ -297,198 +317,174 @@ /** -Adds up two integer variables -@param a - integer to add -@param b - integer to add -@returns the sum of a and b +ISR attached to the fisrt button interrupt +@param button1Flag - integer to indicate if the interrupt has occured */ void button1Pressed(); /** -Adds up two integer variables -@param a - integer to add -@param b - integer to add -@returns the sum of a and b +ISR attached to the second button interrupt +@param button2Flag - integer to indicate if the interrupt has occured */ void button2Pressed(); /** -Adds up two integer variables -@param a - integer to add -@param b - integer to add -@returns the sum of a and b +ISR attached to the third button interrupt +@param button3Flag - integer to indicate if the interrupt has occured */ void button3Pressed(); - /** -Adds up two integer variables -@param a - integer to add -@param b - integer to add -@returns the sum of a and b +ISR attached to the fourth button interrupt +@param button4Flag - integer to indicate if the interrupt has occured */ void button4Pressed(); -void sliderPulled(); - - - - -void sliderRisen(); - - /** -Adds up two integer variables -@param a - integer to add -@param b - integer to add -@returns the sum of a and b +ISR attached to the ticker timer +@param timerFlag - integer to indicate the timer is expired */ void timerExpired(); /** -Adds up two integer variables -@param a - integer to add -@param b - integer to add -@returns the sum of a and b +ISR attached to the ticker dataLoggerTimer +@param dataLoggerFlag - integer to indicate the data logger timer is expired */ void dataLoggerTimerExpired (); -/** -Adds up two integer variables -@param a - integer to add -@param b - integer to add -@returns the sum of a and b -*/ -void tickerExpired (); /** -Adds up two integer variables -@param a - integer to add -@param b - integer to add -@returns the sum of a and b +Opens the local folder, creates a csv file and stores the arrays. +@param data - char array inserted in the local file +@param data1 - char array inserted in the local file +@param data2 - char array inserted in the local file +@param data3 - char array inserted in the local file */ void saveToFile(char *data,char *data1,char *data2,char *data3); + + + /** -Adds up two integer variables -@param a - integer to add -@param b - integer to add -@returns the sum of a and b +Gets the local time from the RTC and stores them into two arrays +@param currentTime - integer to store the current data epoch unix time stamp +@param bufferTime - char array to store the time stamp +@param bufferTime - char array to store the date stamp */ void updateTime(); + + /** -Adds up two integer variables -@param a - integer to add -@param b - integer to add -@returns the sum of a and b +Displays the char arrays on the LCD +@param buffer 0 - char array printed on (0,0) +@param buffer 1 - char array printed on (0,1) +@param buffer 2 - char array printed on (0,2) +@param buffer 3 - char array printed on (0,3) +@param buffer 4 - char array printed on (0,4) +@param buffer 5 - char array printed on (0,5) */ void display(); /** -Adds up two integer variables -@param a - integer to add -@param b - integer to add -@returns the sum of a and b +Reads the data from the sensor and stores them into arrays +@param bufferT - char array to store temperature +@param bufferP - char array to store pressure +@param temperature - float to store the value of the temperature +@param pressure - float to store the value of the pressure */ void readData(); /** -Adds up two integer variables -@param a - integer to add -@param b - integer to add -@returns the sum of a and b +ISR attached to power saver timeout to set the flag to 1 +@param powerSaverFlag - integer to indicate if the state of the power saver */ void powerSaverExpired(); + /** -Adds up two integer variables -@param a - integer to add -@param b - integer to add -@returns the sum of a and b +Checks if the power saver option is set by the user, if yes puts the device in sleep mode and turns off the lcd. +Also if the buttons are pressed it wakes up the device and attached the timeout */ void powerSaverCheck(); + + /** -Adds up two integer variables -@param a - integer to add -@param b - integer to add -@returns the sum of a and b +Indicates the live data on the screen and updates the data once a second +@param timerFlag - integer set when the timer ends */ void liveData(); /** -Adds up two integer variables -@param a - integer to add -@param b - integer to add -@returns the sum of a and b +Recieves the data, puts them in arrays and saves them to the file. Saved arrays are restored and used to calculate the minimun maximum average values +@param sumTemperature - integer to store the total value of temperature values +@param sumPressure - integer to store the total value of pressure values + +@param temperatureSent - char with the temperature values saved to the file +@param pressureSent- char with the pressure values saved to the file +@param timeSent- char with the time stamps saved to the file +@param dateSent- char with the data stamps saved to the file + +@param temperatureRecieved - char with the temperature values restored from the file +@param pressureRecieved- char with the pressure values restored from the file +@param timeRecieved- char with the time stamps restored from the file +@param dateRecieved- char with the data stamps restored from the file + +@param minTemperature - int to store the minimum value of temperature +@param minPressure - int to store the minimum value of pressure +@param maxTemperature - int to store the maximum value of temperature +@param maxPressure - int to store the maximum value of pressure +@param avgTemperature - int to store the average value of temperature +@param avgPressure - int to store the average value of pressure */ void loggerData(); + /** -Adds up two integer variables -@param a - integer to add -@param b - integer to add -@returns the sum of a and b +Uses the data from the loggerData function to indicate the calculated values and plot the graphs */ void dataLogger(); -/** -Adds up two integer variables -@param a - integer to add -@param b - integer to add -@returns the sum of a and b -*/ -void forecast(); + /** -Adds up two integer variables -@param a - integer to add -@param b - integer to add -@returns the sum of a and b +Checks the current values of temperature and pressure and compares to the threshold values, triggers the alarm if match */ void thresholdCheck(); + /** -Adds up two integer variables -@param a - integer to add -@param b - integer to add -@returns the sum of a and b +Alloes the user to set the values for the thresholds and also turn the alarm on or off */ void threshold(); /** -Adds up two integer variables -@param a - integer to add -@param b - integer to add -@returns the sum of a and b +Compares the set time in the alarm clock section with the current time, triggers the alarm when they match */ void alarmClockCheck(); + + /** -Adds up two integer variables -@param a - integer to add -@param b - integer to add -@returns the sum of a and b +Allows the user to set the min , hour, day, month and year values to set the alarm clock */ void alarmClock (); /** -Adds up two integer variables -@param a - integer to add -@param b - integer to add -@returns the sum of a and b +Alarm menu, includes two submenus : alarmclock and thresholds */ void alarmsMenu (); /** -Adds up two integer variables -@param a - integer to add -@param b - integer to add -@returns the sum of a and b +*Fourth option in the settings menu./n +*Allows the user to turn on the data logger and set the value of time out /n +*Attaches a timeout to set the dataloggerFlag /n +@param dataLoggerFlag - integer used as a flag to indicate if the datalogger option is switched on or off +@param state - integer used to navigate through fsm states */ void dataLoggerSetting();