PROJ515 / Mbed OS ELEC-351-GROUP-E-CW

Dependencies:   BMP280

Files at this revision

API Documentation at this revision

Comitter:
Swaggie
Date:
Sat Jan 06 16:15:25 2018 +0000
Parent:
8:dbb57b4d5ba4
Child:
15:e61297f9bae9
Commit message:
Started on LCD.h

Changed in this revision

LCD.cpp Show annotated file Show diff for this revision Revisions of this file
LCD.h Show annotated file Show diff for this revision Revisions of this file
TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LCD.cpp	Sat Jan 06 16:15:25 2018 +0000
@@ -0,0 +1,27 @@
+#include "mbed.h"
+#include "LCD.h"
+#include "TextLCD.h"
+
+EnviromLCDDisplay::EnviromLCDDisplay(PinName rs,PinName e, PinName d4, PinName d5, PinName d6, PinName d7) : TextLCD(rs, e, d4, d5, d7, d7)
+{
+    this->_TState = MESSAGE;    //The enviromental frame is not on this display
+    this->_SState = PRESTEMP;
+}
+
+void EnviromLCDDisplay::LCD_Update(float temp, float pressure, float LDR, unsigned int TimeTaken)
+{
+    if (_State == MESSAGE)
+    {
+        //write enviromental frame to display
+        cls(); //Clear what's on the screen now
+        printf("Temp:xx.xC Pres: xxxx.xmBar\n");
+    } else {
+        //Frame already in place so only the values need replacing
+    }
+}
+
+void EnviromLCDDisplay::DisplayMessage(string Message)
+{
+    cls();
+    printf("%s",Message);
+}
\ No newline at end of file
--- a/LCD.h	Thu Jan 04 19:32:30 2018 +0000
+++ b/LCD.h	Sat Jan 06 16:15:25 2018 +0000
@@ -1,6 +1,37 @@
 #ifndef __LCD__
 #define __LCD__
-
+/*
+*This class inherits the TextLCD class to add functionality to display enviromental readings,
+*with a scrolling display, or to display a specific message, with the option of timing out back
+*to scrolling
+*/
+#include "mbed.h"
+#include "TextLCD.h"
+#include <string>
 //These functions manage writing to the LCD
 
+class EnviromLCDDisplay : public TextLCD
+{
+private:
+    //private variables
+    enum ThreadState{MESSAGE,SCROLLREADINGS,ADJUSTTIME};
+    enum ScrollState{PRESTEMP,LDRTIME};
+    
+    ThreadState _TState;    //This determines what function the LCD is doing
+    ScrollState _SState;    //This determines what screen on the LCD is shown
+    
+    float 
+    //private functions
+public:
+    //public functions
+    EnviromLCDDisplay(PinName rs,PinName e, PinName d4, PinName d5, PinName d6, PinName d7);    //Constructor
+    ~EnviromLCDDisplay(void);   //Destructor
+    
+    void LCDThread(void);   //This needs to be attached to a thread
+    void LCD_Update(float temp, float pressure, float LDR, unsigned int TimeTaken); //Write these values to screen
+    void DisplayMessage(string Message);    //Clear the screen and write a custom mesage
+    //void POST(void);    //Power on self test
+};
+
+
 #endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Sat Jan 06 16:15:25 2018 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/simon/code/TextLCD/#308d188a2d3a
--- a/main.cpp	Thu Jan 04 19:32:30 2018 +0000
+++ b/main.cpp	Sat Jan 06 16:15:25 2018 +0000
@@ -17,7 +17,7 @@
 {
     //Initialise devices
     WebUISetup();
-    
+    EnviromLCDDisplay lcd(D9, D8, D7, D6, D4, D2);
     
     //Hardware Self Test