Justin Howard / Mbed 2 deprecated AdaFruit_RGBLCD

Dependencies:   AdaFruit_RGBLCDShield MCP23017 mbed RTclock

Dependents:   SX1276_GPS

Fork of MCP_test by Wim Huiskamp

Files at this revision

API Documentation at this revision

Comitter:
vtraveller
Date:
Fri Oct 10 11:10:56 2014 +0000
Parent:
27:b6c3dd9a1d8c
Commit message:
Reduced write delay - faster LCD response

Changed in this revision

LCD2004/lcd2004.cpp Show annotated file Show diff for this revision Revisions of this file
Modules/TimeModule.cpp Show annotated file Show diff for this revision Revisions of this file
RTclock.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
diff -r b6c3dd9a1d8c -r fbcd3bac0cd7 LCD2004/lcd2004.cpp
--- a/LCD2004/lcd2004.cpp	Thu Oct 09 10:21:03 2014 +0000
+++ b/LCD2004/lcd2004.cpp	Fri Oct 10 11:10:56 2014 +0000
@@ -38,6 +38,8 @@
 #define PIN_D7   1<<7
 #define PIN_BL   1<<3
 
+Serial cPC(SERIAL_TX, SERIAL_RX);
+
 const uint8_t k_aMapper[] =
 {
     PIN_D4,
@@ -107,17 +109,21 @@
 {
     char nData = PIN_RW | PIN_BL;
     m_cI2C.write(ADDR,&nData,1);
-
+    
     nData = PIN_RW | PIN_BL | PIN_E;
     m_cI2C.write(ADDR,&nData,1);
 
+    ::wait_ms(0.05);
+
     char nValue = 0;    
     m_cI2C.read(ADDR,&nValue,1);
 
     nData = PIN_RW | PIN_BL;
     m_cI2C.write(ADDR,&nData,1);
     
-    return nValue;
+    ::wait_ms(0.05);
+    
+    return nValue & (PIN_D7 | PIN_D6 | PIN_D5 | PIN_D4);
 }
 
 uint8_t LCD2004::remap(uint8_t in_nValue)
@@ -189,9 +195,8 @@
 {
     char nData = PIN_E | PIN_BL | in_nValue;
     m_cI2C.write(ADDR,&nData,1);
-    
-    ::wait_ms(2);
-    //while (read_reg() & PIN_D7) ::wait_ms(1);
+        
+    ::wait_us(1450);
     
     nData = PIN_BL | in_nValue;
     m_cI2C.write(ADDR,&nData,1);    
diff -r b6c3dd9a1d8c -r fbcd3bac0cd7 Modules/TimeModule.cpp
--- a/Modules/TimeModule.cpp	Thu Oct 09 10:21:03 2014 +0000
+++ b/Modules/TimeModule.cpp	Fri Oct 10 11:10:56 2014 +0000
@@ -86,7 +86,7 @@
     if (sTM.tm_hour < 0)    sTM.tm_hour = 0;
     if (sTM.tm_hour > 23)   sTM.tm_hour = 23;
     if (sTM.tm_min < 0)     sTM.tm_min = 0;
-    if (sTM.tm_hour > 59)   sTM.tm_min = 59;
+    if (sTM.tm_min > 59)    sTM.tm_min = 59;
     if (sTM.tm_sec < 0)     sTM.tm_sec = 0;
     if (sTM.tm_sec > 59)    sTM.tm_sec = 59;
 
diff -r b6c3dd9a1d8c -r fbcd3bac0cd7 RTclock.lib
--- a/RTclock.lib	Thu Oct 09 10:21:03 2014 +0000
+++ b/RTclock.lib	Fri Oct 10 11:10:56 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/vtraveller/code/RTclock/#1645f55bd0ee
+http://mbed.org/users/vtraveller/code/RTclock/#f7e4b4cbfb9e
diff -r b6c3dd9a1d8c -r fbcd3bac0cd7 main.cpp
--- a/main.cpp	Thu Oct 09 10:21:03 2014 +0000
+++ b/main.cpp	Fri Oct 10 11:10:56 2014 +0000
@@ -14,16 +14,14 @@
 
 #include "MenuManager.h"
 
-//Serial cPC(SERIAL_TX, SERIAL_RX);
-
 int main()
 {
     // Share the I2C across multiple devices
     I2C cI2C(I2C_SDA, I2C_SCL);    // D3, D6
     cI2C.frequency(400000);    // I2C can handle two different frequencies - switch to high speed if asked
         
-    LCDadafruit cLCD(cI2C);
-    //LCD2004 cLCD(cI2C);
+    //LCDadafruit cLCD(cI2C);
+    LCD2004 cLCD(cI2C);
     //KeyReaderNull cKeys(cI2C);
     KeyReaderAdafruit cKeys(cI2C);