fuck this
Dependencies: BMP280
Diff: LCD.h
- Revision:
- 11:b538e73841ae
- Parent:
- 2:5a38ae8459d5
- Child:
- 12:03589f1d5c30
--- a/LCD.h Sun Jan 07 23:40:10 2018 +0000 +++ b/LCD.h Mon Jan 08 15:12:23 2018 +0000 @@ -1,6 +1,61 @@ #ifndef __LCD__ #define __LCD__ -//These functions manage writing to the LCD +#include "mbed.h" +#include "TextLCD.h" +#include "rtos.h" +#include "TimeInterface.h" +#include <string> +/* +*The ENVDISPLAY class enhances the abilities of the TextLCD class to be +*relevant for an ENVIRONMENTAL sensor. +*Temperature, pressure, LDR and time readings are passed into the object using +*the UpdateData function. A custom message can also be displayed using +*SendMessage, with the option of returning to enviromental data. +* +*Two buttons are required for time setting functions. Pressing button 1 enters +*the lcd into a set_time state. +* +*Device initialised with: ENVDISPLAY lcd(D9, D8, D7, D6, D4, D2,PE_12, PE_14); +*lcd.Start() must be run to begin operation. +*/ + +#define SCREENDELAY_MS 2000 + +class ENVDISPLAY : TextLCD +{ +private: + char _message[32]; //32 characters on display + bool _AutoQuit; //After a message, should the LCD return to enviromental? + float _latestTemp; + float _latestPres; + float _latestLDR; + time_t _latestTime; + + enum ThreadState{MESSAGE,SCROLLREADINGS,ADJUSTTIME}; + + ThreadState _currentState; + + InterruptIn Button1; + DigitalIn Button2; + Thread LCDThread; + + void Button1ISR(void); + //Called when button 1 is pressed. + void StateMachine(void); + //Gets attached to LCDThread + +public: + ENVDISPLAY(PinName rsPin, PinName rePin, PinName d4Pin, PinName d5Pin, PinName d6Pin, PinName d7Pin, PinName Button1Pin, PinName Button2Pin); + //constructor + void SendMessage(char sentText[], bool returnToReadings); + //Display a custom message on the display with option to resume displaying readings + void Start(void); + //Inititates LCD activity + void UpdateData(float temp, float pres, float LDR, time_t sampleTime); + //Pass in new enviromental data + +}; + #endif \ No newline at end of file