fuck this
Dependencies: BMP280
LCD.h
00001 #ifndef __LCD__ 00002 #define __LCD__ 00003 00004 #include "mbed.h" 00005 #include "DriverLCD.h" 00006 #include "rtos.h" 00007 #include "TimeInterface.h" 00008 #include "Logging.h" 00009 #include <string> 00010 /* 00011 *The ENVDISPLAY class enhances the abilities of the TextLCD class to be 00012 *relevant for an ENVIRONMENTAL sensor. 00013 *Temperature, pressure, LDR and time readings are passed into the object using 00014 *the UpdateData function. A custom message can also be displayed using 00015 *SendMessage, with the option of returning to enviromental data. 00016 * 00017 *Two buttons are required for time setting functions. Pressing button 1 enters 00018 *the lcd into a set_time state. 00019 * 00020 *Device initialised with: ENVDISPLAY lcd(D9, D8, D7, D6, D4, D2,PE_12, PE_14); 00021 *lcd.Start() must be run to begin operation. 00022 */ 00023 00024 #define SCREENDELAY_MS 2707 //Delay for screen update 00025 00026 class ENVDISPLAY : DriverLCD //Class inherits TextLCD 00027 { 00028 private: 00029 char _message[32]; //32 characters on display 00030 bool _AutoQuit; //After a message, should the LCD return to enviromental? 00031 float _latestTemp; //Latest sample data 00032 float _latestPres; 00033 float _latestLDR; 00034 time_t _latestTime; 00035 00036 enum ThreadState {MESSAGE,SCROLLREADINGS,ADJUSTTIME}; 00037 00038 ThreadState _currentState; //State machine state 00039 00040 //Hardware 00041 InterruptIn Button1; //Buttons used for setting time 00042 InterruptIn Button2; 00043 Timeout But1Debouncer;//Button debouncers 00044 Timeout But2Debouncer; 00045 Thread LCDThread; //Thread which LCD runs in 00046 00047 void Button1ISR(void); 00048 //Called when button 1 is pressed. 00049 void But1DebouncerISR(void); 00050 //insures that only 1 button press signal is sent to thread 00051 void Button2ISR(void); 00052 //Called when button 2 is pressed. Sets _but2Pressed and thread flag 00053 void But2DebouncerISR(void); 00054 //insures that only 1 button press signal is sent to thread 00055 void StateMachine(void); 00056 //Gets attached to LCDThread 00057 int TimeEditor(int changingVal, int upperLimit, int lowerLimit); 00058 //Handles the cycle and user input to modify changingVal and return the updated number 00059 00060 //Used for time editing 00061 bool _but1Pressed; //Signals that button 1 has been pressed 00062 bool _but2Pressed; //Signals that button 2 has been pressed 00063 tm _EditTime; //used to hold time structure whilst editing 00064 char _editingInTime[10];//hold the string of what variable is to be edited 00065 00066 00067 public: 00068 ENVDISPLAY(PinName rsPin, PinName rePin, PinName d4Pin, PinName d5Pin, PinName d6Pin, PinName d7Pin, PinName Button1Pin, PinName Button2Pin); 00069 //constructor 00070 void SendMessage(char sentText[], bool returnToReadings); 00071 //Display a custom message on the display with option to resume displaying readings 00072 void Start(void); 00073 //Inititates LCD activity 00074 void POST(void); 00075 //Self Test 00076 void UpdateData(float temp, float pres, float LDR, time_t sampleTime); 00077 //Pass in new enviromental data 00078 00079 }; 00080 extern ENVDISPLAY lcd; 00081 00082 #endif
Generated on Tue Jul 26 2022 07:29:23 by 1.7.2