Updated for more display types. Fixed memoryaddress confusion in address() method. Added new getAddress() method. Added support for UDCs, Backlight control and other features such as control through I2C and SPI port expanders and controllers with native I2C and SPI interfaces. Refactored to fix issue with pins that are default declared as NC.

Dependents:   GPSDevice TestTextLCD SD to Flash Data Transfer DrumMachine ... more

Fork of TextLCD by Simon Ford

Example

Hello World! for the TextLCD

#include "mbed.h"
#include "TextLCD.h"
 
// Host PC Communication channels
Serial pc(USBTX, USBRX); // tx, rx
 
// I2C Communication
I2C i2c_lcd(p28,p27); // SDA, SCL
 
// SPI Communication
SPI spi_lcd(p5, NC, p7); // MOSI, MISO, SCLK

//TextLCD lcd(p15, p16, p17, p18, p19, p20);                // RS, E, D4-D7, LCDType=LCD16x2, BL=NC, E2=NC, LCDTCtrl=HD44780
//TextLCD_SPI lcd(&spi_lcd, p8, TextLCD::LCD40x4);   // SPI bus, 74595 expander, CS pin, LCD Type  
TextLCD_I2C lcd(&i2c_lcd, 0x42, TextLCD::LCD20x4);  // I2C bus, PCF8574 Slaveaddress, LCD Type
//TextLCD_I2C lcd(&i2c_lcd, 0x42, TextLCD::LCD16x2, TextLCD::WS0010); // I2C bus, PCF8574 Slaveaddress, LCD Type, Device Type
//TextLCD_SPI_N lcd(&spi_lcd, p8, p9);               // SPI bus, CS pin, RS pin, LCDType=LCD16x2, BL=NC, LCDTCtrl=ST7032_3V3   
//TextLCD_I2C_N lcd(&i2c_lcd, ST7032_SA, TextLCD::LCD16x2, NC, TextLCD::ST7032_3V3); // I2C bus, Slaveaddress, LCD Type, BL=NC, LCDTCtrl=ST7032_3V3  

int main() {
    pc.printf("LCD Test. Columns=%d, Rows=%d\n\r", lcd.columns(), lcd.rows());
    
    for (int row=0; row<lcd.rows(); row++) {
      int col=0;
      
      pc.printf("MemAddr(Col=%d, Row=%d)=0x%02X\n\r", col, row, lcd.getAddress(col, row));      
//      lcd.putc('-');
      lcd.putc('0' + row);      
      
      for (col=1; col<lcd.columns()-1; col++) {    
        lcd.putc('*');
      }
 
      pc.printf("MemAddr(Col=%d, Row=%d)=0x%02X\n\r", col, row, lcd.getAddress(col, row));      
      lcd.putc('+');
        
    }    
    
// Show cursor as blinking character
    lcd.setCursor(TextLCD::CurOff_BlkOn);
 
// Set and show user defined characters. A maximum of 8 UDCs are supported by the HD44780.
// They are defined by a 5x7 bitpattern. 
    lcd.setUDC(0, (char *) udc_0);  // Show |>
    lcd.putc(0);    
    lcd.setUDC(1, (char *) udc_1);  // Show <|
    lcd.putc(1);    

}

Handbook page

More info is here

Files at this revision

API Documentation at this revision

Comitter:
wim
Date:
Tue May 19 18:13:00 2015 +0000
Parent:
38:cbe275b0b647
Child:
40:d3496c3ea301
Commit message:
Working version PCF2119

Changed in this revision

TextLCD.cpp Show annotated file Show diff for this revision Revisions of this file
TextLCD.h Show annotated file Show diff for this revision Revisions of this file
TextLCD_Config.h Show annotated file Show diff for this revision Revisions of this file
TextLCD_UDC.h Show annotated file Show diff for this revision Revisions of this file
TextLCD_UDC.inc Show annotated file Show diff for this revision Revisions of this file
--- a/TextLCD.cpp	Sat Apr 18 11:33:02 2015 +0000
+++ b/TextLCD.cpp	Tue May 19 18:13:00 2015 +0000
@@ -20,6 +20,8 @@
  *               2015, v17: WH, Clean up low-level _writeCommand() and _writeData(), Added support for alternative fonttables (eg PCF21XX), Added ST7066_ACM controller for ACM1602 module 
  *               2015, v18: WH, Performance improvement I2C portexpander
  *               2015, v19: WH, Fixed Adafruit I2C/SPI portexpander pinmappings, fixed SYDZ Backlight 
+ *               2015, v20: WH, Fixed occasional Init fail caused by insufficient wait time after ReturnHome command (0x02), Added defines to reduce memory footprint (eg LCD_ICON),
+ *                              Fixed and Added more fonttable support for PCF2119K, Added HD66712 controller.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -62,7 +64,7 @@
   _addr_mode = _type & LCD_T_ADR_MSK;
   
   // Font table, encoded in LCDCtrl  
-  _font = _type & LCD_C_FNT_MSK;
+  _font = _ctrl & LCD_C_FNT_MSK;
 }
 
 /**  Init the LCD Controller(s)
@@ -138,6 +140,7 @@
     else {
       // Reset in 8 bit mode, final Function set will follow 
       _writeCommand(0x30); // Function set 0 0 1 DL=1 N F x x       
+      wait_ms(1);          // most instructions take 40us      
     }      
    
     // Device specific initialisations: DC/DC converter to generate VLCD or VLED, number of lines etc
@@ -601,6 +604,8 @@
                                     //    NW=1 3-Line LCD (N=0)
               break;  
 
+//            case LCD10x2D:          // Special mode for SSD1803, 4-line mode but switch to double height font
+            case LCD10x4D:          // Special mode for SSD1803
             case LCD20x4D:          // Special mode for SSD1803
               _function = 0x08;     //  Set function 0 0 1 DL N DH RE(0) IS 
                                     //  Saved to allow switch between Instruction sets at later time
@@ -874,6 +879,7 @@
           break; // case PCF2116_5V Controller
 
       case PCF2119_3V3:
+      case PCF2119R_3V3:
           // PCF2119 controller: Initialise Voltage booster for VLCD. VDD=3V3. VA and VB control contrast.
           // Note1: See datasheet, the PCF2119 supports icons and provides separate constrast control for Icons and characters.
           // Note2: Vgen is switched off when the contrast voltage VA or VB is set to 0x00.
@@ -912,7 +918,11 @@
           // Init special features 
           _writeCommand(0x20 | _function | 0x01);           // Set function, Select Instruction Set = 1              
 
-          _writeCommand(0x04);    // DISP CONF SET (Instr. Set 1)   0000, 0, 1, P=0, Q=0 
+//          _writeCommand(0x04);    // DISP CONF SET (Instr. Set 1)   0000, 0, 1, P=0, Q=0 (IC at Bottom)
+//          _writeCommand(0x05);    // Display Conf Set               0000, 0, 1, P=0, Q=1
+//          _writeCommand(0x06);    // Display Conf Set               0000, 0, 1, P=1, Q=0
+          _writeCommand(0x07);    // Display Conf Set               0000, 0, 1, P=1, Q=1    (IC at Top)
+
           _writeCommand(0x10);    // TEMP CTRL SET (Instr. Set 1)   0001, 0, 0, TC1=0, TC2=0
 //          _writeCommand(0x42);    // HV GEN (Instr. Set 1)          0100, 0, 0, S1=1, S2=0 (2x multiplier)
           _writeCommand(0x40 | (LCD_PCF2_S12 & 0x03));      // HV GEN (Instr. Set 1)          0100, 0, 0, S1=1, S2=0 (2x multiplier)
@@ -1204,6 +1214,115 @@
           _contrast = LCD_PT63_CONTRAST;
           _writeCommand(0x20 | _function | ((~_contrast) >> 4));        // Invert and shift to use 2 MSBs     
           break; // case PT6314 Controller (VFD)
+
+
+      case HD66712:
+          // Initialise Display configuration
+          switch (_type) {
+            case LCD8x1:         //8x1 is a regular 1 line display
+            case LCD12x1:                                
+            case LCD16x1:                                            
+            case LCD20x1:
+            case LCD24x1:
+//            case LCD32x1:        // EXT pin is High, extension driver needed
+              _function  = 0x02;    // Function set 001 DL N RE(0) DH REV (Std Regs)
+                                    //   DL=0  (4 bits bus)             
+                                    //    N=0  (1-line mode, N=1 2-line mode)
+                                    //   RE=0  (Dis. Extended Regs, special mode for KS0073)
+                                    //   DH=1  (Disp shift enable, special mode for KS0073)                                
+                                    //   REV=0 (Reverse normal, special mode for KS0073)
+                                    
+              _function_1 = 0x04;   // Function set 001 DL N RE(1) BE LP (Ext Regs)
+                                    //   DL=0  (4 bits bus)             
+                                    //    N=0  (1-line mode, N=1 2-line mode)
+                                    //   RE=1  (Ena Extended Regs, special mode for KS0073)
+                                    //   BE=0  (Blink Enable, CG/SEG RAM, special mode for KS0073)                                
+                                    //   LP=0  (LP=1 Low power mode, LP=0 Normal)
+
+              _function_x = 0x00;   // Ext Function set 0000 1 FW BW NW (Ext Regs)
+                                    //    NW=0  (1,2 line), NW=1 (4 Line, special mode for KS0073)                                
+              break;                                
+
+//            case LCD12x3D:         // Special mode for KS0073, KS0078 and PCF21XX            
+//            case LCD12x3D1:        // Special mode for KS0073, KS0078 and PCF21XX            
+            case LCD12x4D:         // Special mode for KS0073, KS0078, PCF21XX and HD66712
+//            case LCD16x3D:         // Special mode for KS0073, KS0078             
+//            case LCD16x4D:         // Special mode for KS0073, KS0078            
+            case LCD20x4D:         // Special mode for KS0073, KS0078 and HD66712            
+              _function  = 0x02;    // Function set 001 DL N RE(0) DH REV (Std Regs)
+                                    //   DL=0  (4 bits bus)             
+                                    //    N=0  (dont care for 4 line mode)              
+                                    //   RE=0  (Dis. Extended Regs, special mode for KS0073)
+                                    //   DH=1  (Disp shift enable, special mode for KS0073)                                
+                                    //   REV=0 (Reverse normal, special mode for KS0073)
+                                    
+              _function_1 = 0x04;   // Function set 001 DL N RE(1) BE LP (Ext Regs)
+                                    //   DL=0  (4 bits bus)             
+                                    //    N=0  (1-line mode), N=1 (2-line mode)
+                                    //   RE=1  (Ena Extended Regs, special mode for KS0073)
+                                    //   BE=0  (Blink Enable, CG/SEG RAM, special mode for KS0073)                                
+                                    //   LP=0  (LP=1 Low power mode, LP=0 Normal)                                    
+
+              _function_x = 0x01;   // Ext Function set 0000 1 FW BW NW (Ext Regs)
+                                    //    NW=0  (1,2 line), NW=1 (4 Line, special mode for KS0073)                                
+              break;                                
+
+
+            case LCD16x3G:            // Special mode for ST7036                        
+//            case LCD24x3D:         // Special mode for KS0078
+//            case LCD24x3D1:        // Special mode for KS0078
+            case LCD24x4D:         // Special mode for KS0078
+              error("Error: LCD Controller type does not support this Display type\n\r"); 
+              break;  
+
+            default:
+              // All other LCD types are initialised as 2 Line displays (including LCD16x1C and LCD40x4)            
+              _function  = 0x0A;    // Function set 001 DL N RE(0) DH REV (Std Regs)
+                                    //   DL=0  (4 bits bus)             
+                                    //    N=1  (2-line mode), N=0 (1-line mode)
+                                    //   RE=0  (Dis. Extended Regs, special mode for KS0073)
+                                    //   DH=1  (Disp shift enable, special mode for KS0073)                                
+                                    //   REV=0 (Reverse normal, special mode for KS0073)
+                                    
+              _function_1 = 0x0C;   // Function set 001 DL N RE(1) BE LP (Ext Regs)
+                                    //   DL=0  (4 bits bus)             
+                                    //    N=1  (2 line mode), N=0 (1-line mode)
+                                    //   RE=1  (Ena Extended Regs, special mode for KS0073)
+                                    //   BE=0  (Blink Enable, CG/SEG RAM, special mode for KS0073)                   
+                                    //   LP=0  (LP=1 Low power mode, LP=0 Normal)                                                                                     
+
+              _function_x = 0x00;   // Ext Function set 0000 1 FW BW NW (Ext Regs)
+                                    //   NW=0  (1,2 line), NW=1 (4 Line, special mode for KS0073)                                
+              break;
+          } // switch type
+
+          // init special features
+          _writeCommand(0x20 | _function_1);// Function set 001 DL N RE(1) BE LP (Ext Regs)
+                                           //   DL=0 (4 bits bus), DL=1 (8 bits mode)            
+                                           //    N=0 (1 line mode), N=1 (2 line mode)
+                                           //   RE=1 (Ena Extended Regs, special mode for KS0073)
+                                           //   BE=0 (Blink Enable/Disable, CG/SEG RAM, special mode for KS0073)                                
+                                           //   LP=0  (LP=1 Low power mode, LP=0 Normal)                                                                                                                                
+
+          _writeCommand(0x08 | _function_x); // Ext Function set 0000 1 FW BW NW (Ext Regs)
+                                           //   FW=0  (5-dot font, special mode for KS0073)
+                                           //   BW=0  (Cur BW invert disable, special mode for KS0073)
+                                           //   NW=0  (1,2 Line), NW=1 (4 line, special mode for KS0073)                                
+
+          _writeCommand(0x10);             // Scroll/Shift set 0001 DS/HS4 DS/HS3 DS/HS2 DS/HS1 (Ext Regs)
+                                           //   Dotscroll/Display shift enable (Special mode for KS0073)
+
+          _writeCommand(0x80);             // Scroll Quantity set 1 0 SQ5 SQ4 SQ3 SQ2 SQ1 SQ0 (Ext Regs)
+                                           //   Scroll quantity (Special mode for KS0073)
+
+          _writeCommand(0x20 | _function); // Function set 001 DL N RE(0) DH REV (Std Regs)
+                                           //   DL=0  (4 bits bus), DL=1 (8 bits mode)             
+                                           //    N=0  (1 line mode), N=1 (2 line mode)
+                                           //   RE=0  (Dis. Extended Regs, special mode for KS0073)
+                                           //   DH=1  (Disp shift enable/disable, special mode for KS0073)                                
+                                           //   REV=0 (Reverse/Normal, special mode for KS0073)
+          break; // case HD66712 Controller
+
            
         case ST7066_ACM:                                                // ST7066 4/8 bit, I2C on ACM1602 using a PIC        
         default:
@@ -1252,12 +1371,13 @@
     } // switch Controller specific initialisations    
 
     // Controller general initialisations                                          
-//    _writeCommand(0x01); // cls, and set cursor to 0
+//    _writeCommand(0x01); // Clear Display and set cursor to 0
 //    wait_ms(10);         // The CLS command takes 1.64 ms.
 //                         // Since we are not using the Busy flag, Lets be safe and take 10 ms  
 
-    _writeCommand(0x02); // Return Home 
-                         //   Cursor Home, DDRAM Address to Origin
+    _writeCommand(0x02); // Cursor Home, DDRAM Address to Origin
+    wait_ms(10);         // The Return Home command takes 1.64 ms.
+                         // Since we are not using the Busy flag, Lets be safe and take 10 ms      
 
     _writeCommand(0x06); // Entry Mode 0000 0 1 I/D S 
                          //   Cursor Direction and Display Shift
@@ -1272,12 +1392,15 @@
 //    _writeCommand(0x0C); // Display Ctrl 0000 1 D C B
 //                         //   Display On, Cursor Off, Blink Off   
 
-    setCursor(CurOff_BlkOff);     
+//    setCursor(CurOff_BlkOff);     
+    setCursor(CurOn_BlkOff);        
     setMode(DispOn);     
 }
 
 
 /** Clear the screen, Cursor home. 
+  * Note: The whole display is initialised to charcode 0x20, which may not be a 'space' on some controllers with a
+  *       different fontset such as the PCF2116C or PCF2119R. In this case you should fill the display with 'spaces'.
   */
 void TextLCD_Base::cls() {
 
@@ -1290,7 +1413,7 @@
 
     // Second LCD controller Clearscreen
     _writeCommand(0x01);  // cls, and set cursor to 0    
-    wait_ms(10);          // The CLS command takes 1.64 ms.
+    wait_ms(20);          // The CLS command takes 1.64 ms.
                           // Since we are not using the Busy flag, Lets be safe and take 10 ms
   
     _ctrl_idx=_LCDCtrl_0; // Select primary controller
@@ -1298,7 +1421,7 @@
   
   // Primary LCD controller Clearscreen
   _writeCommand(0x01);    // cls, and set cursor to 0
-  wait_ms(10);            // The CLS command takes 1.64 ms.
+  wait_ms(20);            // The CLS command takes 1.64 ms.
                           // Since we are not using the Busy flag, Lets be safe and take 10 ms
 
   // Restore cursormode on primary LCD controller when needed
@@ -1383,10 +1506,11 @@
     if (_font == LCD_C_FT0) return c;
 
 //LCD_C_FT1 for PCF21XXC series    
-//Used code from Suga koubou library for PCF2119
+//LCD_C_FT2 for PCF21XXR series    
+//Used code from Suga koubou library for PCF2119K and PCF2119R
     if (((c >= ' ') && (c <= '?')) || ((c >= 'A') && (c <= 'Z')) || ((c >= 'a') && (c <= 'z'))) {
         c |= 0x80;
-    } else if (c >= 0xf0 && c <= 0xff) {
+    } else if (c >= 0xF0 && c <= 0xFF) {
         c &= 0x0f;
     }
     return c;
@@ -1510,8 +1634,8 @@
             case 3:
               return 0x40 + _nr_cols + column;
             // Should never get here.
-            default:            
-              return 0x00;                    
+//            default:            
+//              return 0x00;                    
             }
           
         case LCD_T_B:
@@ -1557,8 +1681,8 @@
             case 3:
               return 0x60 + column;
             // Should never get here.
-            default:            
-              return 0x00;                    
+//            default:            
+//              return 0x00;                    
             }
 
         case LCD_T_D1:
@@ -1573,8 +1697,8 @@
             case 2:
               return 0x60 + column;
             // Should never get here.
-            default:            
-              return 0x00;                    
+//            default:            
+//              return 0x00;                    
             }
         
         case LCD_T_E:                
@@ -1627,8 +1751,8 @@
               else   
                 return (0x40 + _nr_cols + (column - (_nr_cols >> 1)));                        
             // Should never get here.
-            default:            
-              return 0x00;                    
+//            default:            
+//              return 0x00;                    
           }
 
         case LCD_T_G:
@@ -1641,8 +1765,8 @@
             case 2:
               return 0x20 + column;
             // Should never get here.
-            default:            
-              return 0x00;                    
+//            default:            
+//              return 0x00;                    
             }
 
         // Should never get here.
@@ -1880,6 +2004,7 @@
   _writeCommand(0x80 | addr);  
 }
 
+#if(LCD_BLINK == 1)
 /** Set UDC Blink and Icon blink
   * setUDCBlink method is supported by some compatible devices (eg SSD1803) 
   *
@@ -1932,6 +2057,7 @@
         case PCF2103_3V3 :  
         case PCF2113_3V3 :  
         case PCF2119_3V3 :                  
+        case PCF2119R_3V3 :                          
           // Enable Icon Blink
           _writeCommand(0x20 | _function | 0x01);   // Set function, Select Instr Set = 1              
           _writeCommand(0x08 | 0x02);               // ICON Conf 0000 1, IM=0 (Char mode), IB=1 (Icon blink), 0 (Instr. Set 1) 
@@ -1968,8 +2094,9 @@
           break; // case SSD1803, US2066          
  
         case PCF2103_3V3 :
-        case PCF2113_3V3 :  
-        case PCF2119_3V3 :       
+        case PCF2113_3V3 : 
+        case PCF2119_3V3 :
+        case PCF2119R_3V3 :        
           // Disable Icon Blink
           _writeCommand(0x20 | _function | 0x01);   // Set function, Select Instr Set = 1              
           _writeCommand(0x08);                      // ICON Conf 0000 1, IM=0 (Char mode), IB=1 (Icon blink), 0 (Instr. Set 1) 
@@ -1989,7 +2116,7 @@
   } // blinkMode
   
 } // setUDCBlink()
-
+#endif
 
 /** Set Contrast
   * setContrast method is supported by some compatible devices (eg ST7032i) that have onboard LCD voltage generation
@@ -2008,7 +2135,8 @@
   
   switch (_ctrl) {   
     case PCF2113_3V3 :  
-    case PCF2119_3V3 :  
+    case PCF2119_3V3 :
+    case PCF2119R_3V3 :    
        if (_contrast <  5) _contrast = 0;  // See datasheet. Sanity check for PCF2113/PCF2119
        if (_contrast > 55) _contrast = 55;
       
@@ -2060,7 +2188,7 @@
   } // end switch     
 } // end setContrast()
 
-
+#if(LCD_POWER == 1)
 /** Set Power
   * setPower method is supported by some compatible devices (eg SSD1803) that have power down modes
   *
@@ -2078,7 +2206,8 @@
     switch (_ctrl) {
     
 //    case PCF2113_3V3 :  
-//    case PCF2119_3V3 :  
+//    case PCF2119_3V3 : 
+//    case PCF2119R_3V3 :     
 //    case ST7032_3V3 :  
 //@todo
 //    enable Booster Bon
@@ -2110,7 +2239,8 @@
     switch (_ctrl) {
     
 //    case PCF2113_3V3 :  
-//    case PCF2119_3V3 :  
+//    case PCF2119_3V3 : 
+//    case PCF2119R_3V3 :     
 //    case ST7032_3V3 :  
 //@todo
 //    disable Booster Bon
@@ -2134,8 +2264,9 @@
     } // end switch  
   }
 } // end setPower()
-
-
+#endif
+
+#if(LCD_ORIENT == 1)
 /** Set Orient
   * setOrient method is supported by some compatible devices (eg SSD1803, US2066) that have top/bottom view modes
   *
@@ -2151,11 +2282,17 @@
         case PCF2103_3V3:              
         case PCF2116_3V3:        
         case PCF2116_5V:                
-        case PCF2119_3V3:                
           _writeCommand(0x20 | _function | 0x01);          // Set function, Select Instr Set = 1              
           _writeCommand(0x05);                             // Display Conf Set         0000 0, 1, P=0, Q=1               (Instr. Set 1)
           _writeCommand(0x20 | _function);                 // Set function, Select Instr Set = 0             
           break;
+
+        case PCF2119_3V3:   
+        case PCF2119R_3V3:                         
+          _writeCommand(0x20 | _function | 0x01);          // Set function, Select Instr Set = 1              
+          _writeCommand(0x07);                             // Display Conf Set         0000 0, 1, P=1, Q=1               (Instr. Set 1)
+          _writeCommand(0x20 | _function);                 // Set function, Select Instr Set = 0             
+          break;
                                
         case SSD1803_3V3 :      
 //      case SSD1803_5V :
@@ -2193,11 +2330,17 @@
         case PCF2103_3V3:              
         case PCF2116_3V3:        
         case PCF2116_5V:                
-        case PCF2119_3V3:                       
           _writeCommand(0x20 | _function | 0x01);          // Set function, Select Instr Set = 1              
           _writeCommand(0x06);                             // Display Conf Set         0000 0, 1, P=1, Q=0               (Instr. Set 1)
           _writeCommand(0x20 | _function);                 // Set function, Select Instr Set = 0             
           break;
+
+        case PCF2119_3V3:
+        case PCF2119R_3V3 :                                 
+          _writeCommand(0x20 | _function | 0x01);          // Set function, Select Instr Set = 1              
+          _writeCommand(0x04);                             // Display Conf Set         0000 0, 1, P=0, Q=0               (Instr. Set 1)
+          _writeCommand(0x20 | _function);                 // Set function, Select Instr Set = 0             
+          break;
         
         case SSD1803_3V3 :      
 //      case SSD1803_5V :
@@ -2237,7 +2380,9 @@
       break; // end Bottom
   } // end switch orient
 } // end setOrient()
-
+#endif
+
+#if(LCD_BIGFONT == 1)
 /** Set Big Font
   * setBigFont method is supported by some compatible devices (eg SSD1803, US2066) 
   *
@@ -2353,8 +2498,9 @@
   } // end switch lines
 
 } // end setBigFont()
-
-
+#endif
+
+#if(LCD_ICON==1)
 /** Set Icons
   *
   * @param unsigned char idx   The Index of the icon pattern (0..15) for KS0073 and similar controllers
@@ -2433,7 +2579,8 @@
 
     case PCF2103_3V3:
     case PCF2113_3V3:    
-    case PCF2119_3V3:        
+    case PCF2119_3V3:
+    case PCF2119R_3V3:                
        // Store UDC/Icon pattern for PCF2103 and PCF2113: 
        //   3 x 8 rows x 5 bits = 120 bits for Normal pattern (UDC 0..2) and
        //   3 x 8 rows x 5 bits = 120 bits for Blink pattern (UDC 4..6) 
@@ -2554,7 +2701,8 @@
        }
        break; // case PCF2103_3V3 Controller
 
-     case PCF2119_3V3:              
+     case PCF2119_3V3:  
+     case PCF2119R_3V3:
        // PCF2119 uses part of the UDC RAM to control Icons   
        // Select CG RAM
 
@@ -2582,8 +2730,9 @@
   int addr = getAddress(_column, _row);
   _writeCommand(0x80 | addr);
 } //end clrIcon()
-
-
+#endif
+
+#if(LCD_INVERT == 1)
 /** Set Invert
   * setInvert method is supported by some compatible devices (eg KS0073) to swap between black and white 
   *
@@ -2641,6 +2790,7 @@
     } // end switch  
   }
 } // end setInvert()
+#endif
 
 //--------- End TextLCD_Base -----------
 
@@ -2936,8 +3086,9 @@
   // Set bit by bit to support any mapping of expander portpins to LCD pins 
   _lcd_bus |= _LCD_DATA_BITS[value & 0x0F];
 }    
-
-#else
+#endif
+
+#if(0)
 //orig v017
 // Test faster _writeByte 0.11s vs 0.27s for a 20x4 fillscreen (PCF8574)
 // Place the 4bit data in the databus shadowvalue
@@ -2975,6 +3126,34 @@
 }    
 #endif
 
+#if(1)
+//orig v017, with optimised codesize
+// Test faster _writeByte 0.11s vs 0.27s for a 20x4 fillscreen (PCF8574)
+// Place the 4bit data in the databus shadowvalue
+// Used for mbed I2C bus expander
+void TextLCD_I2C::_setDataBits(int value) {
+
+  //Clear all databits
+  _lcd_bus &= ~LCD_BUS_I2C_MSK;
+
+  // Set bit by bit to support any mapping of expander portpins to LCD pins 
+  if (value & 0x01){
+    _lcd_bus |= LCD_BUS_I2C_D4;   // Set Databit 
+  }  
+
+  if (value & 0x02){
+    _lcd_bus |= LCD_BUS_I2C_D5;   // Set Databit 
+  }  
+
+  if (value & 0x04) {
+    _lcd_bus |= LCD_BUS_I2C_D6;   // Set Databit 
+  }  
+
+  if (value & 0x08) {
+    _lcd_bus |= LCD_BUS_I2C_D7;   // Set Databit 
+  }  
+}    
+#endif
 
 // Place the 4bit data on the databus
 // Used for mbed pins, I2C bus expander or SPI shifregister
--- a/TextLCD.h	Sat Apr 18 11:33:02 2015 +0000
+++ b/TextLCD.h	Tue May 19 18:13:00 2015 +0000
@@ -19,6 +19,9 @@
  *               2014, v16: WH, Added ST7070 and KS0073 support, added setIcon(), clrIcon() and setInvert() method for supported devices  
  *               2015, v17: WH, Clean up low-level _writeCommand() and _writeData(), Added support for alternative fonttables (eg PCF21XX), Added ST7066_ACM controller for ACM1602 module
  *               2015, v18: WH, Performance improvement I2C portexpander
+ *               2015, v19: WH, Added 10x2D and 10x4D type for SSD1803 
+ *               2015, v20: WH, Fixed occasional Init fail caused by insufficient wait time after ReturnHome command (0x02), Added defines to reduce memory footprint (eg LCD_ICON),
+ *                              Fixed and Added more fonttable support for PCF2119K, Added HD66712 controller.
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -102,6 +105,7 @@
 #define LCD_T_R2       0x00000200
 #define LCD_T_R3       0x00000300
 #define LCD_T_R4       0x00000400
+#define LCD_T_R6       0x00000600
   
 // Addressing mode encoded in b19..b16
 #define LCD_T_ADR_MSK  0x000F0000
@@ -135,8 +139,8 @@
 // Fonttable encoded in b15..b12
 #define LCD_C_FNT_MSK  0x0000F000 
 #define LCD_C_FT0      0x00000000  /*Default             */
-#define LCD_C_FT1      0x00001000  /*Font1               */
-#define LCD_C_FT2      0x00002000  /*Font2               */
+#define LCD_C_FT1      0x00001000  /*Font1, C            */
+#define LCD_C_FT2      0x00002000  /*Font2, R            */
 
 /** A TextLCD interface for driving 4-bit HD44780-based LCDs
  *
@@ -160,48 +164,51 @@
     /** LCD panel format */
     // The commented out types exist but have not yet been tested with the library
     enum LCDType {
-//        LCD6x1     = (LCD_T_A | LCD_T_C6 | LCD_T_R1),     /**<  6x1 LCD panel */          
-//        LCD6x2     = (LCD_T_A | LCD_T_C6 | LCD_T_R2),     /**<  6x2 LCD panel */          
-        LCD8x1     = (LCD_T_A | LCD_T_C8 | LCD_T_R1),     /**<  8x1 LCD panel */    
-        LCD8x2     = (LCD_T_A | LCD_T_C8 | LCD_T_R2),     /**<  8x2 LCD panel */          
-        LCD8x2B    = (LCD_T_D | LCD_T_C8 | LCD_T_R2),     /**<  8x2 LCD panel (actually 16x1) */                  
-        LCD12x1    = (LCD_T_A | LCD_T_C12 | LCD_T_R1),    /**< 12x1 LCD panel */                          
-        LCD12x2    = (LCD_T_A | LCD_T_C12 | LCD_T_R2),    /**< 12x2 LCD panel */                          
-        LCD12x3D   = (LCD_T_D | LCD_T_C12 | LCD_T_R3),    /**< 12x3 LCD panel, special mode PCF21XX, KS0073 */                                  
-        LCD12x3D1  = (LCD_T_D1 | LCD_T_C12 | LCD_T_R3),   /**< 12x3 LCD panel, special mode PCF21XX, KS0073 */                                          
-//        LCD12x3G   = (LCD_T_G | LCD_T_C12 | LCD_T_R3),    /**< 12x3 LCD panel, special mode ST7036 */                                      
-        LCD12x4    = (LCD_T_A | LCD_T_C12 | LCD_T_R4),    /**< 12x4 LCD panel */                  
-        LCD12x4D   = (LCD_T_B | LCD_T_C12 | LCD_T_R4),    /**< 12x4 LCD panel, special mode PCF21XX, KS0073 */                                          
-        LCD16x1    = (LCD_T_A | LCD_T_C16 | LCD_T_R1),    /**< 16x1 LCD panel */                  
-        LCD16x1C   = (LCD_T_C | LCD_T_C16 | LCD_T_R1),    /**< 16x1 LCD panel (actually 8x2) */          
+//        LCD6x1     = (LCD_T_A | LCD_T_C6 | LCD_T_R1),     /**<  6x1 LCD panel */
+//        LCD6x2     = (LCD_T_A | LCD_T_C6 | LCD_T_R2),     /**<  6x2 LCD panel */
+        LCD8x1     = (LCD_T_A | LCD_T_C8 | LCD_T_R1),     /**<  8x1 LCD panel */
+        LCD8x2     = (LCD_T_A | LCD_T_C8 | LCD_T_R2),     /**<  8x2 LCD panel */
+        LCD8x2B    = (LCD_T_D | LCD_T_C8 | LCD_T_R2),     /**<  8x2 LCD panel (actually 16x1) */
+//        LCD10x2D   = (LCD_T_D | LCD_T_C10 | LCD_T_R2),    /**< 10x2 LCD panel, special mode SSD1803, 4-line but double height */        
+        LCD10x4D   = (LCD_T_D | LCD_T_C10 | LCD_T_R4),    /**< 10x4 LCD panel, special mode SSD1803 */
+        LCD12x1    = (LCD_T_A | LCD_T_C12 | LCD_T_R1),    /**< 12x1 LCD panel */
+        LCD12x2    = (LCD_T_A | LCD_T_C12 | LCD_T_R2),    /**< 12x2 LCD panel */
+        LCD12x3D   = (LCD_T_D | LCD_T_C12 | LCD_T_R3),    /**< 12x3 LCD panel, special mode PCF21XX, KS0073 */
+        LCD12x3D1  = (LCD_T_D1 | LCD_T_C12 | LCD_T_R3),   /**< 12x3 LCD panel, special mode PCF21XX, KS0073 */
+//        LCD12x3G   = (LCD_T_G | LCD_T_C12 | LCD_T_R3),    /**< 12x3 LCD panel, special mode ST7036 */
+        LCD12x4    = (LCD_T_A | LCD_T_C12 | LCD_T_R4),    /**< 12x4 LCD panel */
+        LCD12x4D   = (LCD_T_B | LCD_T_C12 | LCD_T_R4),    /**< 12x4 LCD panel, special mode PCF21XX, KS0073 */
+        LCD16x1    = (LCD_T_A | LCD_T_C16 | LCD_T_R1),    /**< 16x1 LCD panel */
+        LCD16x1C   = (LCD_T_C | LCD_T_C16 | LCD_T_R1),    /**< 16x1 LCD panel (actually 8x2) */
         LCD16x2    = (LCD_T_A | LCD_T_C16 | LCD_T_R2),    /**< 16x2 LCD panel (default) */
 //        LCD16x2B   = (LCD_T_B | LCD_T_C16 | LCD_T_R2),    /**< 16x2 LCD panel, alternate addressing, wrong.. */
-        LCD16x3D   = (LCD_T_D | LCD_T_C16 | LCD_T_R3),    /**< 16x3 LCD panel, special mode SSD1803 */                      
-//        LCD16x3D1  = (LCD_T_D1 | LCD_T_C16 | LCD_T_R3),   /**< 16x3 LCD panel, special mode SSD1803 */                
-        LCD16x3F   = (LCD_T_F | LCD_T_C16 | LCD_T_R3),    /**< 16x3 LCD panel (actually 24x2) */                
-        LCD16x3G   = (LCD_T_G | LCD_T_C16 | LCD_T_R3),    /**< 16x3 LCD panel, special mode ST7036 */                              
-        LCD16x4    = (LCD_T_A | LCD_T_C16 | LCD_T_R4),    /**< 16x4 LCD panel */        
-//        LCD16x4D   = (LCD_T_D | LCD_T_C16 | LCD_T_R4),    /**< 16x4 LCD panel, special mode SSD1803 */                
+        LCD16x3D   = (LCD_T_D | LCD_T_C16 | LCD_T_R3),    /**< 16x3 LCD panel, special mode SSD1803 */           
+//        LCD16x3D1  = (LCD_T_D1 | LCD_T_C16 | LCD_T_R3),   /**< 16x3 LCD panel, special mode SSD1803 */
+        LCD16x3F   = (LCD_T_F | LCD_T_C16 | LCD_T_R3),    /**< 16x3 LCD panel (actually 24x2) */
+        LCD16x3G   = (LCD_T_G | LCD_T_C16 | LCD_T_R3),    /**< 16x3 LCD panel, special mode ST7036 */
+        LCD16x4    = (LCD_T_A | LCD_T_C16 | LCD_T_R4),    /**< 16x4 LCD panel */
+//        LCD16x4D   = (LCD_T_D | LCD_T_C16 | LCD_T_R4),    /**< 16x4 LCD panel, special mode SSD1803 */
         LCD20x1    = (LCD_T_A | LCD_T_C20 | LCD_T_R1),    /**< 20x1 LCD panel */
         LCD20x2    = (LCD_T_A | LCD_T_C20 | LCD_T_R2),    /**< 20x2 LCD panel */
-//        LCD20x3    = (LCD_T_A | LCD_T_C20 | LCD_T_R3),    /**< 20x3 LCD panel */                        
-//        LCD20x3D   = (LCD_T_D | LCD_T_C20 | LCD_T_R3),    /**< 20x3 LCD panel, special mode SSD1803 */                        
-//        LCD20x3D1  = (LCD_T_D1 | LCD_T_C20 | LCD_T_R3),   /**< 20x3 LCD panel, special mode SSD1803 */                        
+//        LCD20x3    = (LCD_T_A | LCD_T_C20 | LCD_T_R3),    /**< 20x3 LCD panel */
+//        LCD20x3D   = (LCD_T_D | LCD_T_C20 | LCD_T_R3),    /**< 20x3 LCD panel, special mode SSD1803 */
+//        LCD20x3D1  = (LCD_T_D1 | LCD_T_C20 | LCD_T_R3),   /**< 20x3 LCD panel, special mode SSD1803 */
         LCD20x4    = (LCD_T_A | LCD_T_C20 | LCD_T_R4),    /**< 20x4 LCD panel */
-        LCD20x4D   = (LCD_T_D | LCD_T_C20 | LCD_T_R4),    /**< 20x4 LCD panel, special mode SSD1803 */                        
-        LCD24x1    = (LCD_T_A | LCD_T_C24 | LCD_T_R1),    /**< 24x1 LCD panel */        
-        LCD24x2    = (LCD_T_A | LCD_T_C24 | LCD_T_R2),    /**< 24x2 LCD panel */        
-//        LCD24x3D   = (LCD_T_D | LCD_T_C24 | LCD_T_R3),    /**< 24x3 LCD panel */                
-//        LCD24x3D1  = (LCD_T_D | LCD_T_C24 | LCD_T_R3),    /**< 24x3 LCD panel */                        
-        LCD24x4D   = (LCD_T_D | LCD_T_C24 | LCD_T_R4),    /**< 24x4 LCD panel, special mode KS0078 */                                                          
+        LCD20x4D   = (LCD_T_D | LCD_T_C20 | LCD_T_R4),    /**< 20x4 LCD panel, special mode SSD1803 */
+//        LCD20x6    = (LCD_T_E | LCD_T_C20 | LCD_T_R6),    /**< 20x6 LCD panel, Two controller version */        
+        LCD24x1    = (LCD_T_A | LCD_T_C24 | LCD_T_R1),    /**< 24x1 LCD panel */
+        LCD24x2    = (LCD_T_A | LCD_T_C24 | LCD_T_R2),    /**< 24x2 LCD panel */
+//        LCD24x3D   = (LCD_T_D | LCD_T_C24 | LCD_T_R3),    /**< 24x3 LCD panel */
+//        LCD24x3D1  = (LCD_T_D | LCD_T_C24 | LCD_T_R3),    /**< 24x3 LCD panel */
+        LCD24x4D   = (LCD_T_D | LCD_T_C24 | LCD_T_R4),    /**< 24x4 LCD panel, special mode KS0078 */
 //        LCD32x1    = (LCD_T_A | LCD_T_C32 | LCD_T_R1),    /**< 32x1 LCD panel */
-//        LCD32x1C   = (LCD_T_C | LCD_T_C32 | LCD_T_R1),    /**< 32x1 LCD panel (actually 16x2) */                                        
-//        LCD32x2    = (LCD_T_A | LCD_T_C32 | LCD_T_R2),    /**< 32x2 LCD panel */                        
-//        LCD32x4    = (LCD_T_A | LCD_T_C32 | LCD_T_R4),    /**< 32x4 LCD panel */                        
-//        LCD40x1    = (LCD_T_A | LCD_T_C40 | LCD_T_R1),    /**< 40x1 LCD panel */                        
-//        LCD40x1C   = (LCD_T_C | LCD_T_C40 | LCD_T_R1),    /**< 40x1 LCD panel (actually 20x2) */                        
-        LCD40x2    = (LCD_T_A | LCD_T_C40 | LCD_T_R2),    /**< 40x2 LCD panel */                
-        LCD40x4    = (LCD_T_E | LCD_T_C40 | LCD_T_R4)     /**< 40x4 LCD panel, Two controller version */                        
+//        LCD32x1C   = (LCD_T_C | LCD_T_C32 | LCD_T_R1),    /**< 32x1 LCD panel (actually 16x2) */
+//        LCD32x2    = (LCD_T_A | LCD_T_C32 | LCD_T_R2),    /**< 32x2 LCD panel */
+//        LCD32x4    = (LCD_T_A | LCD_T_C32 | LCD_T_R4),    /**< 32x4 LCD panel */
+//        LCD40x1    = (LCD_T_A | LCD_T_C40 | LCD_T_R1),    /**< 40x1 LCD panel */
+//        LCD40x1C   = (LCD_T_C | LCD_T_C40 | LCD_T_R1),    /**< 40x1 LCD panel (actually 20x2) */
+        LCD40x2    = (LCD_T_A | LCD_T_C40 | LCD_T_R2),    /**< 40x2 LCD panel */
+        LCD40x4    = (LCD_T_E | LCD_T_C40 | LCD_T_R4)     /**< 40x4 LCD panel, Two controller version */
     };
 
 
@@ -215,11 +222,14 @@
         PCF2103_3V3     =  5 | (LCD_C_PAR | LCD_C_I2C),                                                       /**<  PCF2103 3V3 no Booster, 4/8 bit, I2C         */                                   
         PCF2113_3V3     =  6 | (LCD_C_PAR | LCD_C_I2C     | LCD_C_BST | LCD_C_CTR),                           /**<  PCF2113 3V3 with Booster, 4/8 bit, I2C       */                           
         PCF2116_3V3     =  7 | (LCD_C_PAR | LCD_C_I2C     | LCD_C_BST),                                       /**<  PCF2116 3V3 with Booster, 4/8 bit, I2C       */                           
-        PCF2116_5V      =  8 | (LCD_C_PAR | LCD_C_I2C),                                                       /**<  PCF2116 5V no Booster, 4/8 bit, I2C          */        
-        PCF2116C_5V     =  9 | (LCD_C_PAR | LCD_C_I2C     | LCD_C_BST) | LCD_C_FT1,                           /**<  PCF2116C 3V3 with Booster, 4/8 bit, I2C       */                           
-        PCF2119_3V3     = 10 | (LCD_C_PAR | LCD_C_I2C     | LCD_C_BST | LCD_C_CTR),                           /**<  PCF2119 3V3 with Booster, 4/8 bit, I2C       */                           
-//        PCF2119C_3V3    = 11 | (LCD_C_PAR | LCD_C_I2C     | LCD_C_BST | LCD_C_CTR), LCD_C_FT1,                /**<  PCF2119K 3V3 with Booster, 4/8 bit, I2C       */                           
-//        PCF2119_5V      = 12 | (LCD_C_PAR | LCD_C_I2C),                                                       /**<  PCF2119 5V no Booster, 4/8 bit, I2C          */
+//        PCF2116C_3V3    =    | (LCD_C_PAR | LCD_C_I2C     | LCD_C_BST | LCD_C_FT1),                           /**<  PCF2116C 3V3 with Booster, 4/8 bit, I2C       */
+//        PCF2116K_3V3    =    | (LCD_C_PAR | LCD_C_I2C     | LCD_C_BST | LCD_C_FT2),                           /**<  PCF2116K 3V3 with Booster, 4/8 bit, I2C       */
+        PCF2116_5V      =  8 | (LCD_C_PAR | LCD_C_I2C),                                                       /**<  PCF2116 5V no Booster, 4/8 bit, I2C          */
+        PCF2116C_5V     =  9 | (LCD_C_PAR | LCD_C_I2C     | LCD_C_BST | LCD_C_FT1),                           /**<  PCF2116C 3V3 with Booster, 4/8 bit, I2C       */
+        PCF2119_3V3     = 10 | (LCD_C_PAR | LCD_C_I2C     | LCD_C_BST | LCD_C_CTR),                           /**<  PCF2119 3V3 with Booster, 4/8 bit, I2C       */
+//        PCF2119C_3V3    = 11 | (LCD_C_PAR | LCD_C_I2C     | LCD_C_BST | LCD_C_CTR | LCD_C_FT1),                /**<  PCF2119K 3V3 with Booster, 4/8 bit, I2C       */
+        PCF2119R_3V3    = 12 | (LCD_C_PAR | LCD_C_I2C     | LCD_C_BST | LCD_C_CTR | LCD_C_FT2),                /**<  PCF2119R 3V3 with Booster, 4/8 bit, I2C       */
+//        PCF2119_5V      =    | (LCD_C_PAR | LCD_C_I2C),                                                       /**<  PCF2119 5V no Booster, 4/8 bit, I2C          */
         PT6314          = 13 | (LCD_C_PAR | LCD_C_SPI3_16 | LCD_C_CTR),                                       /**<  PT6314  VFD, 4/8 bit, SPI3                   */
         SSD1803_3V3     = 14 | (LCD_C_PAR | LCD_C_SPI3_24 | LCD_C_I2C | LCD_C_BST | LCD_C_CTR | LCD_C_PDN),   /**<  SSD1803 3V3 with Booster, 4/8 bit, I2C, SPI3 */
 //        SSD1803_5V      = 15 | (LCD_C_PAR | LCD_C_SPI3_24 | LCD_C_I2C | LCD_C_BST | LCD_C_CTR | LCD_C_PDN),   /**<  SSD1803 3V3 with Booster, 4/8 bit, I2C, SPI3 */
@@ -230,9 +240,9 @@
         ST7066_ACM      = 20 | (LCD_C_PAR | LCD_C_I2C),                                                       /**<  ST7066 4/8 bit, I2C on ACM1602 using a PIC   */        
         ST7070          = 21 | (LCD_C_PAR | LCD_C_SPI3_8 | LCD_C_SPI4),                                       /**<  ST7070 4/8 bit, SPI3                         */
         US2066_3V3      = 22 | (LCD_C_PAR | LCD_C_SPI3_24 | LCD_C_I2C | LCD_C_CTR | LCD_C_PDN),               /**<  US2066/SSD1311 3V3, 4/8 bit, I2C, SPI3 */
-        WS0010          = 23 | (LCD_C_PAR | LCD_C_SPI3_10 | LCD_C_PDN)                                        /**<  WS0010/RS0010 OLED Controller, 4/8 bit, SPI3 */    
+        WS0010          = 23 | (LCD_C_PAR | LCD_C_SPI3_10 | LCD_C_PDN),                                       /**<  WS0010/RS0010 OLED Controller, 4/8 bit, SPI3 */    
 //        WS0012          = 24 | (LCD_C_PAR | LCD_C_SPI3_10 | LCD_C_I2C | LCD_C_PDN),                           /**<  WS0012 4/8 bit, SPI, I2C                     */
-
+        HD66712         = 25 | (LCD_C_PAR | LCD_C_SPI3_24 | LCD_C_BST | LCD_C_PDN)                            /**<  HD66712 Controller, 4/8 bit, SPI3 */    
     };
 
 
@@ -330,7 +340,7 @@
      * @param row     The vertical position from the top, indexed from 0
      * @return        The memoryaddress of screen column and row location
      */
-    int  getAddress(int column, int row);     
+    int getAddress(int column, int row);     
     
     /** Set the memoryaddress of screen column and row location
      *
@@ -380,12 +390,14 @@
      */
     void setUDC(unsigned char c, char *udc_data);
 
+#if(LCD_BLINK == 1)
     /** Set UDC Blink and Icon blink
      * setUDCBlink method is supported by some compatible devices (eg SSD1803) 
      *
      * @param blinkMode The Blink mode (BlinkOff, BlinkOn)
      */
     void setUDCBlink(LCDBlink blinkMode);
+#endif
 
     /** Set Contrast
      * setContrast method is supported by some compatible devices (eg ST7032i) that have onboard LCD voltage generation
@@ -396,6 +408,7 @@
      */
     void setContrast(unsigned char c = LCD_DEF_CONTRAST);
 
+#if(LCD_POWER == 1)
     /** Set Power
      * setPower method is supported by some compatible devices (eg SSD1803) that have power down modes
      *
@@ -403,7 +416,9 @@
      * @return none
      */
     void setPower(bool powerOn = true);
+#endif
 
+#if(LCD_ORIENT == 1)
     /** Set Orient
      * setOrient method is supported by some compatible devices (eg SSD1803, US2066) that have top/bottom view modes
      *
@@ -411,7 +426,9 @@
      * @return none
      */
     void setOrient(LCDOrient orient = Top);
+#endif
 
+#if(LCD_BIGFONT == 1)
     /** Set Big Font
      * setBigFont method is supported by some compatible devices (eg SSD1803, US2066) 
      *
@@ -420,7 +437,9 @@
      *                                            Valid double height lines depend on the LCDs number of rows.
      */
     void setBigFont(LCDBigFont lines);
+#endif
 
+#if(LCD_ICON==1)
     /** Set Icons
     *
     * @param unsigned char idx   The Index of the icon pattern (0..15) for KS0073 and similar controllers
@@ -437,7 +456,9 @@
      */
     //@TODO Add support for 40x4 dual controller       
     void clrIcon();
+#endif
 
+#if(LCD_INVERT == 1)
    /** Set Invert
      * setInvert method is supported by some compatible devices (eg KS0073) to swap between black and white 
      *
@@ -446,6 +467,7 @@
      */
    //@TODO Add support for 40x4 dual controller  
    void setInvert(bool invertOn);
+#endif
 
 protected:
 
--- a/TextLCD_Config.h	Sat Apr 18 11:33:02 2015 +0000
+++ b/TextLCD_Config.h	Tue May 19 18:13:00 2015 +0000
@@ -7,6 +7,7 @@
  *               2015, v05: WH, Clean up low-level _writeCommand() and _writeData(), Added support for alt fonttables (eg PCF21XX), Added ST7066_ACM for ACM1602 module, fixed contrast for ST7032 
  *               2015, v06: WH, Performance improvement I2C portexpander
  *               2015, v07: WH, Fixed Adafruit I2C/SPI portexpander pinmappings, fixed SYDZ Backlight
+ *               2015, v08: WH, Added defines to reduce memory footprint (eg LCD_ICON), added some I2C portexpander defines 
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -41,23 +42,33 @@
 #define LCD_SPI_N_3_24 1           /* Native SPI bus     */
 
 //Select options to reduce memory footprint (multiple options allowed)
-#define LCD_UDC        1           /* Enable predefined UDC example*/                
-#define LCD_PRINTF     1           /* Enable Stream implementation */                
+#define LCD_UDC        1           /* Enable predefined UDC example*/
+#define LCD_PRINTF     1           /* Enable Stream implementation */
+#define LCD_ICON       1           /* Enable Icon implementation -2.0K codesize*/
+#define LCD_ORIENT     1           /* Enable Orientation switch implementation -0.9K codesize*/
+#define LCD_BIGFONT    0           /* Enable Big Font implementation -0.6K codesize */
+#define LCD_INVERT     0           /* Enable display Invert implementation -0.5K codesize*/
+#define LCD_POWER      0           /* Enable Power control implementation -0.1K codesize*/
+#define LCD_BLINK      1           /* Enable UDC and Icon Blink control implementation -0.8K codesize*/
 
-//Select option to activate default fonttable or alternatively use conversion for specific controller versions (eg PCF2119C)
-#define LCD_DEFAULT_FONT 1      
+//Select option to activate default fonttable or alternatively use conversion for specific controller versions (eg PCF2119C, PCF2119R)
+#define LCD_DEFAULT_FONT 0
 
 //Pin Defines for I2C PCF8574/PCF8574A or MCP23008 and SPI 74595 bus expander interfaces
 //Different commercially available LCD portexpanders use different wiring conventions.
 //LCD and serial portexpanders should be wired according to the tables below.
 //
 //Select Serial Port Expander Hardware module (one option only)
-#define DEFAULT        1
+#define DEFAULT        0
 #define ADAFRUIT       0
 #define DFROBOT        0
+#define LCM1602        0
 #define YWROBOT        0
 #define GYLCD          0
-#define SYDZ           0
+#define MJKDZ          0
+#define SYDZ           1
+#define WIDEHK         0
+#define LCDPLUG        0
 
 #if (DEFAULT==1)
 //Definitions for default (WH) mapping between serial port expander pins and LCD controller
@@ -194,15 +205,15 @@
 #define BACKLIGHT_INV  0
 #endif
 
-#if (YWROBOT==1)
+#if ((YWROBOT==1) || (LCM1602==1))
 //Definitions for YWROBOT LCM1602 V1 Module mapping between serial port expander pins and LCD controller. 
-//Very similar to DFROBOT. This hardware uses PCF8574.
+//Very similar to DFROBOT. Also marked as 'Funduino'. This hardware uses PCF8574.
 //Slaveaddress may be set by solderbridges (default 0x4E). SDA/SCL has no pullup Resistors onboard.
 //See http://arduino-info.wikispaces.com/LCD-Blue-I2C
 //
 //Note: LCD RW pin must be kept LOW
 //      E2 is not available on default hardware and so it does not support LCD40x4 (second controller)
-//      BL is used to control backlight, reverse logic: Low turns on Backlight. This is handled in setBacklight()
+//      BL is used to control backlight.
 
 //I2C bus expander PCF8574 interface
 #define LCD_BUS_I2C_RS (1 << 0)
@@ -236,8 +247,8 @@
 #define BACKLIGHT_INV  0
 #endif
 
-#if (GYLCD==1)
-//Definitions for Arduino-IIC-LCD GY-LCD-V1 Module mapping between serial port expander pins and LCD controller. 
+#if ((GYLCD==1) || (MJKDZ==1))
+//Definitions for Arduino-IIC-LCD GY-LCD-V1, for GY-IICLCD and for MJKDZ Module mapping between serial port expander pins and LCD controller. 
 //Very similar to DFROBOT. This hardware uses PCF8574.
 //Slaveaddress may be set by solderbridges (default 0x4E). SDA/SCL has pullup Resistors onboard.
 //See http://arduino-info.wikispaces.com/LCD-Blue-I2C
@@ -320,6 +331,93 @@
 #define BACKLIGHT_INV  0
 #endif
 
+#if (WIDEHK==1)
+//Definitions for WIDE.HK I2C backpack mapping between serial port expander pins and LCD controller
+//This hardware uses an MCP23008 I2C expander.
+//Slaveaddress is hardcoded at 0x4E. SDA/SCL has pullup Resistors onboard (3k3).
+//See http://www.wide.hk
+//
+//Note: LCD RW pin must be kept LOW
+//      E2 is not available on this hardware and so it does not support LCD40x4 (second controller)
+//      BL is used to control backlight
+//
+
+//I2C bus expander (MCP23008) interface
+#define LCD_BUS_I2C_D4 (1 << 0)
+#define LCD_BUS_I2C_D5 (1 << 1)
+#define LCD_BUS_I2C_D6 (1 << 2)
+#define LCD_BUS_I2C_D7 (1 << 3)
+#define LCD_BUS_I2C_RS (1 << 4)
+#define LCD_BUS_I2C_RW (1 << 5)
+#define LCD_BUS_I2C_BL (1 << 6)
+#define LCD_BUS_I2C_E  (1 << 7)
+
+#define LCD_BUS_I2C_E2 (1 << 5)
+
+//SPI bus expander (74595) interface, same as I2C
+#define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4
+#define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5
+#define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6
+#define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7
+#define LCD_BUS_SPI_RS LCD_BUS_I2C_RS
+#define LCD_BUS_SPI_RW LCD_BUS_I2C_RW
+#define LCD_BUS_SPI_BL LCD_BUS_I2C_BL
+#define LCD_BUS_SPI_E  LCD_BUS_I2C_E
+
+#define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2
+
+//Force I2C portexpander type
+#define PCF8574        0
+#define MCP23008       1
+
+//Inverted Backlight control
+#define BACKLIGHT_INV  0
+#endif
+
+#if (LCDPLUG==1)
+//Definitions for Jeelabs LCD_Plug I2C backpack mapping between serial port expander pins and LCD controller
+//This hardware uses an MCP23008 I2C expander.
+//Slaveaddress is hardcoded at 0x48. SDA/SCL has no pullup Resistors onboard.
+//See http://jeelabs.net/projects/hardware/wiki/lcd_plug
+//
+//Note: LCD RW pin must be kept LOW
+//      E2 is available on a plug and so it does support LCD40x4 (second controller)
+//      BL is used to control backlight
+//
+
+//I2C bus expander (MCP23008) interface
+#define LCD_BUS_I2C_D4 (1 << 0)
+#define LCD_BUS_I2C_D5 (1 << 1)
+#define LCD_BUS_I2C_D6 (1 << 2)
+#define LCD_BUS_I2C_D7 (1 << 3)
+#define LCD_BUS_I2C_RS (1 << 4)
+#define LCD_BUS_I2C_E2 (1 << 5)
+#define LCD_BUS_I2C_E  (1 << 6)
+#define LCD_BUS_I2C_BL (1 << 7)
+
+#define LCD_BUS_I2C_RW (1 << 5)
+
+//SPI bus expander (74595) interface, same as I2C
+#define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4
+#define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5
+#define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6
+#define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7
+#define LCD_BUS_SPI_RS LCD_BUS_I2C_RS
+#define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2
+#define LCD_BUS_SPI_E  LCD_BUS_I2C_E
+#define LCD_BUS_SPI_BL LCD_BUS_I2C_BL
+
+#define LCD_BUS_SPI_RW LCD_BUS_I2C_RW
+
+//Force I2C portexpander type
+#define PCF8574        0
+#define MCP23008       1
+
+//Inverted Backlight control
+#define BACKLIGHT_INV  0
+#endif
+
+
 //Bitpattern Defines for I2C PCF8574/PCF8574A, MCP23008 and SPI 74595 Bus expanders
 //Don't change!
 #define LCD_BUS_I2C_MSK (LCD_BUS_I2C_D4 | LCD_BUS_I2C_D5 | LCD_BUS_I2C_D6 | LCD_BUS_I2C_D7)
--- a/TextLCD_UDC.h	Sat Apr 18 11:33:02 2015 +0000
+++ b/TextLCD_UDC.h	Tue May 19 18:13:00 2015 +0000
@@ -92,8 +92,9 @@
 //extern const char udc_check[];
 //extern const char udc_cross[];
 //extern const char udc_retarrow[];
-//extern const char udc_OK[];
-//extern const char udc_1_2[];
+//extern const char udc_OK[];       // Ok
+//extern const char udc_1_2[];      // 1/2
+//extern const char udc_Euro[];     // Euro symbol
 
 //extern const char udc_None[]; 
 //extern const char udc_All[];
--- a/TextLCD_UDC.inc	Sat Apr 18 11:33:02 2015 +0000
+++ b/TextLCD_UDC.inc	Tue May 19 18:13:00 2015 +0000
@@ -109,6 +109,7 @@
 //const char udc_retarrow[] = {0x01, 0x01, 0x05, 0x09, 0x1f, 0x08, 0x04, 0x00};
 //const char udc_OK[]       = {0x08, 0x14, 0x14, 0x08, 0x05, 0x06, 0x05, 0x05};  // OK
 //const char udc_1_2[]      = {0x11, 0x12, 0x17, 0x09, 0x13, 0x04, 0x07, 0x00};  // 1/2
+//const char udc_Euro[]     = {0x06, 0x09, 0x08, 0x1E, 0x1E, 0x08, 0x09, 0x06};  // Euro symbol
 
 //const char udc_None[]       = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 
 //const char udc_All[]        = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};