LCD library files

Dependents:   ELEC350_Project2

Committer:
Swabey89
Date:
Wed Jan 02 19:45:21 2019 +0000
Revision:
6:a0b47f581db9
Parent:
5:f5cba66935ec
Updated to use queues more

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Swabey89 1:645488381317 1 #include "LCDdisplay.hpp"
Swabey89 1:645488381317 2
Swabey89 6:a0b47f581db9 3 /*
Swabey89 2:e9f3e49d41e0 4 void LCD_display(double temp, double pressure, float light)
Swabey89 1:645488381317 5 {
Swabey89 1:645488381317 6 //Write new data to LCD (not fast!)
Swabey89 6:a0b47f581db9 7 //LCDlock.lock();
Swabey89 6:a0b47f581db9 8 LCD_tout.attach(LCD_toutISR,TOUT_TIME_DEF*10);
Swabey89 1:645488381317 9 lcd.cls();
Swabey89 2:e9f3e49d41e0 10 lcd.printf("T:%4.1f L:%5.1f\n",temp, light*100);
Swabey89 2:e9f3e49d41e0 11 lcd.printf("P:%.2f", pressure);
Swabey89 6:a0b47f581db9 12 //LCDlock.unlock();
Swabey89 6:a0b47f581db9 13 LCD_tout.detach();
Swabey89 6:a0b47f581db9 14 }
Swabey89 6:a0b47f581db9 15 */
Swabey89 6:a0b47f581db9 16 void LCD_display()
Swabey89 6:a0b47f581db9 17 {
Swabey89 6:a0b47f581db9 18 //Write new data to LCD (not fast!)
Swabey89 6:a0b47f581db9 19 bufferLock.lock();
Swabey89 6:a0b47f581db9 20 LCD_tout.attach(LCD_toutISR,TOUT_TIME_DEF*10);
Swabey89 6:a0b47f581db9 21 lcd.cls();
Swabey89 6:a0b47f581db9 22 lcd.printf("T:%4.1f L:%5.1f\n",buffer[newestIndex].gettemp(), buffer[newestIndex].getlight()*100);
Swabey89 6:a0b47f581db9 23 lcd.printf("P:%.2f", buffer[newestIndex].getpress());
Swabey89 6:a0b47f581db9 24 bufferLock.unlock();
Swabey89 6:a0b47f581db9 25 LCD_tout.detach();
Swabey89 6:a0b47f581db9 26
Swabey89 6:a0b47f581db9 27 }
Swabey89 6:a0b47f581db9 28
Swabey89 6:a0b47f581db9 29
Swabey89 6:a0b47f581db9 30 /*
Swabey89 6:a0b47f581db9 31 void LCD_display(sensorData* buffer_p)
Swabey89 6:a0b47f581db9 32 {
Swabey89 6:a0b47f581db9 33 //Write new data to LCD (not fast!)
Swabey89 6:a0b47f581db9 34 //LCDlock.lock();
Swabey89 6:a0b47f581db9 35 LCD_tout.attach(LCD_toutISR,TOUT_TIME_DEF*10);
Swabey89 6:a0b47f581db9 36 lcd.cls();
Swabey89 6:a0b47f581db9 37 lcd.printf("T:%4.1f L:%5.1f\n",buffer_p->gettemp(), buffer_p->getlight()*100);
Swabey89 6:a0b47f581db9 38 lcd.printf("P:%.2f", buffer_p->getpress());
Swabey89 6:a0b47f581db9 39 //LCDlock.unlock();
Swabey89 4:b51c2a72c348 40 LCD_tout.detach();
Swabey89 6:a0b47f581db9 41 }
Swabey89 6:a0b47f581db9 42 */
Swabey89 6:a0b47f581db9 43
Swabey89 6:a0b47f581db9 44 void LCD_text(string text)
Swabey89 6:a0b47f581db9 45 {
Swabey89 6:a0b47f581db9 46 //LCDlock.lock();
Swabey89 6:a0b47f581db9 47 LCD_tout.attach(LCD_toutISR,TOUT_TIME_DEF*10);
Swabey89 6:a0b47f581db9 48 lcd.cls();
Swabey89 6:a0b47f581db9 49 lcd.printf("%s",text);
Swabey89 6:a0b47f581db9 50 //LCDlock.unlock();
Swabey89 6:a0b47f581db9 51 LCD_tout.detach();
Swabey89 6:a0b47f581db9 52 }
Swabey89 6:a0b47f581db9 53
Swabey89 6:a0b47f581db9 54 void LCD_sdcardmount(string text, float waittime)
Swabey89 6:a0b47f581db9 55 {
Swabey89 6:a0b47f581db9 56 //LCDlock.lock();
Swabey89 6:a0b47f581db9 57 LCD_tout.attach(LCD_toutISR,25);
Swabey89 6:a0b47f581db9 58 lcd.cls();
Swabey89 6:a0b47f581db9 59 lcd.printf("%s",text);
Swabey89 6:a0b47f581db9 60 //LCDlock.unlock();
Swabey89 6:a0b47f581db9 61
Swabey89 6:a0b47f581db9 62 for(int i=0;i<20;i++)
Swabey89 6:a0b47f581db9 63 {
Swabey89 6:a0b47f581db9 64 greenLED = 1;
Swabey89 6:a0b47f581db9 65 wait(waittime);
Swabey89 6:a0b47f581db9 66 greenLED = 0;
Swabey89 6:a0b47f581db9 67 wait(waittime);
Swabey89 6:a0b47f581db9 68 }
Swabey89 6:a0b47f581db9 69
Swabey89 6:a0b47f581db9 70 LCD_tout.detach();
Swabey89 1:645488381317 71 }