fuck this

Dependencies:   BMP280

Committer:
mwthewsey
Date:
Tue Jan 09 08:57:57 2018 +0000
Revision:
12:03589f1d5c30
Parent:
11:b538e73841ae
Child:
20:25939e03b803
Sampling,LCD,Serial, SD working. Stability problem exists with RXISR!

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Swaggie 2:5a38ae8459d5 1 #ifndef __LCD__
Swaggie 2:5a38ae8459d5 2 #define __LCD__
Swaggie 2:5a38ae8459d5 3
mwthewsey 11:b538e73841ae 4 #include "mbed.h"
mwthewsey 11:b538e73841ae 5 #include "TextLCD.h"
mwthewsey 11:b538e73841ae 6 #include "rtos.h"
mwthewsey 11:b538e73841ae 7 #include "TimeInterface.h"
mwthewsey 11:b538e73841ae 8 #include <string>
mwthewsey 11:b538e73841ae 9 /*
mwthewsey 11:b538e73841ae 10 *The ENVDISPLAY class enhances the abilities of the TextLCD class to be
mwthewsey 11:b538e73841ae 11 *relevant for an ENVIRONMENTAL sensor.
mwthewsey 11:b538e73841ae 12 *Temperature, pressure, LDR and time readings are passed into the object using
mwthewsey 11:b538e73841ae 13 *the UpdateData function. A custom message can also be displayed using
mwthewsey 11:b538e73841ae 14 *SendMessage, with the option of returning to enviromental data.
mwthewsey 11:b538e73841ae 15 *
mwthewsey 11:b538e73841ae 16 *Two buttons are required for time setting functions. Pressing button 1 enters
mwthewsey 11:b538e73841ae 17 *the lcd into a set_time state.
mwthewsey 11:b538e73841ae 18 *
mwthewsey 11:b538e73841ae 19 *Device initialised with: ENVDISPLAY lcd(D9, D8, D7, D6, D4, D2,PE_12, PE_14);
mwthewsey 11:b538e73841ae 20 *lcd.Start() must be run to begin operation.
mwthewsey 11:b538e73841ae 21 */
mwthewsey 11:b538e73841ae 22
mwthewsey 12:03589f1d5c30 23 #define SCREENDELAY_MS 2707
mwthewsey 11:b538e73841ae 24
mwthewsey 11:b538e73841ae 25 class ENVDISPLAY : TextLCD
mwthewsey 11:b538e73841ae 26 {
mwthewsey 11:b538e73841ae 27 private:
mwthewsey 11:b538e73841ae 28 char _message[32]; //32 characters on display
mwthewsey 11:b538e73841ae 29 bool _AutoQuit; //After a message, should the LCD return to enviromental?
mwthewsey 11:b538e73841ae 30 float _latestTemp;
mwthewsey 11:b538e73841ae 31 float _latestPres;
mwthewsey 11:b538e73841ae 32 float _latestLDR;
mwthewsey 11:b538e73841ae 33 time_t _latestTime;
mwthewsey 11:b538e73841ae 34
mwthewsey 11:b538e73841ae 35 enum ThreadState{MESSAGE,SCROLLREADINGS,ADJUSTTIME};
mwthewsey 11:b538e73841ae 36
mwthewsey 11:b538e73841ae 37 ThreadState _currentState;
mwthewsey 11:b538e73841ae 38
mwthewsey 11:b538e73841ae 39 InterruptIn Button1;
mwthewsey 11:b538e73841ae 40 DigitalIn Button2;
mwthewsey 11:b538e73841ae 41 Thread LCDThread;
mwthewsey 11:b538e73841ae 42
mwthewsey 11:b538e73841ae 43 void Button1ISR(void);
mwthewsey 11:b538e73841ae 44 //Called when button 1 is pressed.
mwthewsey 11:b538e73841ae 45 void StateMachine(void);
mwthewsey 11:b538e73841ae 46 //Gets attached to LCDThread
mwthewsey 11:b538e73841ae 47
mwthewsey 11:b538e73841ae 48 public:
mwthewsey 11:b538e73841ae 49 ENVDISPLAY(PinName rsPin, PinName rePin, PinName d4Pin, PinName d5Pin, PinName d6Pin, PinName d7Pin, PinName Button1Pin, PinName Button2Pin);
mwthewsey 11:b538e73841ae 50 //constructor
mwthewsey 11:b538e73841ae 51 void SendMessage(char sentText[], bool returnToReadings);
mwthewsey 11:b538e73841ae 52 //Display a custom message on the display with option to resume displaying readings
mwthewsey 11:b538e73841ae 53 void Start(void);
mwthewsey 11:b538e73841ae 54 //Inititates LCD activity
mwthewsey 11:b538e73841ae 55 void UpdateData(float temp, float pres, float LDR, time_t sampleTime);
mwthewsey 11:b538e73841ae 56 //Pass in new enviromental data
mwthewsey 11:b538e73841ae 57
mwthewsey 11:b538e73841ae 58 };
mwthewsey 12:03589f1d5c30 59 extern ENVDISPLAY lcd;
Swaggie 2:5a38ae8459d5 60
Swaggie 2:5a38ae8459d5 61 #endif