LCD library files

Dependents:   ELEC350_Project2

Files at this revision

API Documentation at this revision

Comitter:
Swabey89
Date:
Wed Jan 02 19:45:21 2019 +0000
Parent:
5:f5cba66935ec
Commit message:
Updated to use queues more

Changed in this revision

LCDdisplay.cpp Show annotated file Show diff for this revision Revisions of this file
LCDdisplay.hpp Show annotated file Show diff for this revision Revisions of this file
diff -r f5cba66935ec -r a0b47f581db9 LCDdisplay.cpp
--- a/LCDdisplay.cpp	Fri Dec 28 12:05:11 2018 +0000
+++ b/LCDdisplay.cpp	Wed Jan 02 19:45:21 2019 +0000
@@ -1,14 +1,71 @@
 #include "LCDdisplay.hpp"
 
-
+/*
 void LCD_display(double temp, double pressure, float light)
 {
     //Write new data to LCD (not fast!)
-    LCDlock.lock();
-    LCD_tout.attach(LCD_toutISR,TOUT_TIME_DEF);
+    //LCDlock.lock();
+    LCD_tout.attach(LCD_toutISR,TOUT_TIME_DEF*10);
     lcd.cls();
     lcd.printf("T:%4.1f  L:%5.1f\n",temp, light*100);
     lcd.printf("P:%.2f", pressure); 
-    LCDlock.unlock();
+    //LCDlock.unlock();    
+    LCD_tout.detach();
+}
+*/
+void LCD_display()
+{ 
+    //Write new data to LCD (not fast!)
+    bufferLock.lock();
+    LCD_tout.attach(LCD_toutISR,TOUT_TIME_DEF*10);
+    lcd.cls();
+    lcd.printf("T:%4.1f  L:%5.1f\n",buffer[newestIndex].gettemp(), buffer[newestIndex].getlight()*100);
+    lcd.printf("P:%.2f", buffer[newestIndex].getpress());  
+    bufferLock.unlock();   
+    LCD_tout.detach();      
+
+}
+
+
+/*
+void LCD_display(sensorData* buffer_p)
+{
+    //Write new data to LCD (not fast!)
+    //LCDlock.lock();
+    LCD_tout.attach(LCD_toutISR,TOUT_TIME_DEF*10);
+    lcd.cls();
+    lcd.printf("T:%4.1f  L:%5.1f\n",buffer_p->gettemp(), buffer_p->getlight()*100);
+    lcd.printf("P:%.2f", buffer_p->getpress()); 
+    //LCDlock.unlock();    
     LCD_tout.detach();
+}
+*/
+
+void LCD_text(string text)
+{
+    //LCDlock.lock();
+    LCD_tout.attach(LCD_toutISR,TOUT_TIME_DEF*10);
+    lcd.cls();
+    lcd.printf("%s",text);        
+    //LCDlock.unlock(); 
+    LCD_tout.detach();      
+}
+
+void LCD_sdcardmount(string text, float waittime)
+{
+    //LCDlock.lock();
+    LCD_tout.attach(LCD_toutISR,25);
+    lcd.cls();
+    lcd.printf("%s",text);        
+    //LCDlock.unlock(); 
+    
+     for(int i=0;i<20;i++)
+        {
+            greenLED = 1;
+            wait(waittime);
+            greenLED = 0;
+            wait(waittime);   
+        }
+    
+    LCD_tout.detach();      
 }
\ No newline at end of file
diff -r f5cba66935ec -r a0b47f581db9 LCDdisplay.hpp
--- a/LCDdisplay.hpp	Fri Dec 28 12:05:11 2018 +0000
+++ b/LCDdisplay.hpp	Wed Jan 02 19:45:21 2019 +0000
@@ -9,9 +9,17 @@
 
 //TEST
 extern Mutex LCDlock;
+extern Mutex bufferLock;
 extern Timeout LCD_tout;
 extern void LCD_toutISR(void);
+extern sensorData buffer[BUFFERSIZE];
+extern unsigned int newestIndex;
 
-void LCD_display(double temp, double pressure, float light);
+//void LCD_display(double temp, double pressure, float light);
+
+//void LCD_display(sensorData* buffer_p);
+void LCD_display(void);
+void LCD_text(string text);
+void LCD_sdcardmount(string text, float waittime);
 
 #endif