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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TextLCD_Config.h Source File

TextLCD_Config.h

00001 /* mbed TextLCD Library, for LCDs based on HD44780 controllers
00002  * Copyright (c) 2014, WH
00003  *               2014, v01: WH, Extracted from TextLCD.h as of v14
00004  *               2014, v02: WH, Added AC780 support, added I2C expander modules, fixed setBacklight() for inverted logic modules. Fixed bug in LCD_SPI_N define
00005  *               2014, v03: WH, Added LCD_SPI_N_3_8 define for ST7070
00006  *               2015, v04: WH, Added support for alternative fonttables (eg PCF21XX)
00007  *               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 
00008  *               2015, v06: WH, Performance improvement I2C portexpander
00009  *               2015, v07: WH, Fixed Adafruit I2C/SPI portexpander pinmappings, fixed SYDZ Backlight
00010  *               2015, v08: WH, Added defines to reduce memory footprint (eg LCD_ICON), added some I2C portexpander defines 
00011  *               2015, v09: WH, Added defines to reduce memory footprint (LCD_TWO_CTRL, LCD_CONTRAST, LCD_UTF8_FONT),
00012  *                              Added UTF8_2_LCD decode for Cyrilic font (By Andriy Ribalko). Added setFont()
00013  *
00014  * Permission is hereby granted, free of charge, to any person obtaining a copy
00015  * of this software and associated documentation files (the "Software"), to deal
00016  * in the Software without restriction, including without limitation the rights
00017  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00018  * copies of the Software, and to permit persons to whom the Software is
00019  * furnished to do so, subject to the following conditions:
00020  *
00021  * The above copyright notice and this permission notice shall be included in
00022  * all copies or substantial portions of the Software.
00023  *
00024  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00025  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00026  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00027  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00028  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00029  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
00030  * THE SOFTWARE.
00031  */
00032 #ifndef MBED_TEXTLCDCONFIG_H
00033 #define MBED_TEXTLCDCONFIG_H
00034 
00035 //Select hardware interface options to reduce memory footprint (multiple options allowed)
00036 #define LCD_I2C        1           /* I2C Expander PCF8574/MCP23008 */
00037 #define LCD_SPI        1           /* SPI Expander SN74595          */
00038 #define LCD_I2C_N      1           /* Native I2C bus     */
00039 #define LCD_SPI_N      1           /* Native SPI bus     */
00040 #define LCD_SPI_N_3_8  1           /* Native SPI bus     */
00041 #define LCD_SPI_N_3_9  1           /* Native SPI bus     */
00042 #define LCD_SPI_N_3_10 1           /* Native SPI bus     */
00043 #define LCD_SPI_N_3_16 1           /* Native SPI bus     */
00044 #define LCD_SPI_N_3_24 1           /* Native SPI bus     */
00045 
00046 //Select options to reduce memory footprint (multiple options allowed)
00047 #define LCD_UDC        1           /* Enable predefined UDC example*/
00048 #define LCD_PRINTF     1           /* Enable Stream implementation */
00049 #define LCD_ICON       1           /* Enable Icon implementation -2.0K codesize*/
00050 #define LCD_ORIENT     1           /* Enable Orientation switch implementation -0.9K codesize*/
00051 #define LCD_BIGFONT    1           /* Enable Big Font implementation -0.6K codesize */
00052 #define LCD_INVERT     1           /* Enable display Invert implementation -0.5K codesize*/
00053 #define LCD_POWER      1           /* Enable Power control implementation -0.1K codesize*/
00054 #define LCD_BLINK      1           /* Enable UDC and Icon Blink control implementation -0.8K codesize*/
00055 #define LCD_CONTRAST   1           /* Enable Contrast control implementation -0.9K codesize*/
00056 #define LCD_TWO_CTRL   1           /* Enable LCD40x4 (two controller) implementation -0.1K codesize*/
00057 #define LCD_FONTSEL    0           /* Enable runtime font select implementation using setFont -0.9K codesize*/
00058 
00059 //Select option to activate default fonttable or alternatively use conversion for specific controller versions (eg PCF2116C, PCF2119R, SSD1803, US2066)
00060 #define LCD_DEF_FONT   1           //Default HD44780 font
00061 //#define LCD_C_FONT     1           //PCF21xxC font
00062 //#define LCD_R_FONT     1           //PCF21xxR font
00063 //#define LCD_UTF8_FONT  1           /* Enable UTF8 Support (eg Cyrillic tables) -0.4K codesize*/
00064 //#define LCD_UTF8_CYR_B 1           /*  Select specific UTF8 Cyrillic table (SSD1803 ROM_B)              */
00065 
00066 //Pin Defines for I2C PCF8574/PCF8574A or MCP23008 and SPI 74595 bus expander interfaces
00067 //Different commercially available LCD portexpanders use different wiring conventions.
00068 //LCD and serial portexpanders should be wired according to the tables below.
00069 //
00070 //Select Serial Port Expander Hardware module (one option only)
00071 #define DEFAULT        1
00072 #define ADAFRUIT       0
00073 #define DFROBOT        0
00074 #define LCM1602        0
00075 #define YWROBOT        0
00076 #define GYLCD          0
00077 #define MJKDZ          0
00078 #define SYDZ           0
00079 #define WIDEHK         0
00080 #define LCDPLUG        0
00081 
00082 #if (DEFAULT==1)
00083 //Definitions for default (WH) mapping between serial port expander pins and LCD controller
00084 //This hardware supports the I2C bus expander (PCF8574/PCF8574A or MCP23008) and SPI bus expander (74595) interfaces
00085 //See https://mbed.org/cookbook/Text-LCD-Enhanced
00086 //
00087 //Note: LCD RW pin must be connected to GND
00088 //      E2 is used for LCD40x4 (second controller)
00089 //      BL may be used to control backlight
00090 
00091 //I2C bus expander (PCF8574/PCF8574A or MCP23008) interface
00092 #define LCD_BUS_I2C_D4 (1 << 0)
00093 #define LCD_BUS_I2C_D5 (1 << 1)
00094 #define LCD_BUS_I2C_D6 (1 << 2)
00095 #define LCD_BUS_I2C_D7 (1 << 3)
00096 #define LCD_BUS_I2C_RS (1 << 4)
00097 #define LCD_BUS_I2C_E  (1 << 5)
00098 #define LCD_BUS_I2C_E2 (1 << 6)
00099 #define LCD_BUS_I2C_BL (1 << 7)
00100 
00101 #define LCD_BUS_I2C_RW (1 << 6)
00102 
00103 //SPI bus expander (74595) interface, same as I2C 
00104 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4
00105 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5
00106 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6
00107 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7
00108 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS
00109 #define LCD_BUS_SPI_E  LCD_BUS_I2C_E
00110 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2
00111 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL
00112 
00113 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW
00114 
00115 //Select I2C Portexpander type (one option only)
00116 #define PCF8574        1
00117 #define MCP23008       0
00118 
00119 //Inverted Backlight control
00120 #define BACKLIGHT_INV  0
00121 #endif
00122 
00123 #if (ADAFRUIT==1)
00124 //Definitions for Adafruit i2cspilcdbackpack mapping between serial port expander pins and LCD controller
00125 //This hardware supports both an I2C expander (MCP23008) and an SPI expander (74595) selectable by a jumper.
00126 //Slaveaddress may be set by solderbridges (default 0x40). SDA/SCL has pullup Resistors onboard.
00127 //See http://www.ladyada.net/products/i2cspilcdbackpack
00128 //
00129 //Note: LCD RW pin must be kept LOW
00130 //      E2 is not available on this hardware and so it does not support LCD40x4 (second controller)
00131 //      BL is used to control backlight
00132 //Note: The pinmappings are different for the MCP23008 and the 74595!
00133 
00134 //I2C bus expander (MCP23008) interface
00135 #define LCD_BUS_I2C_0  (1 << 0)
00136 #define LCD_BUS_I2C_RS (1 << 1)
00137 #define LCD_BUS_I2C_E  (1 << 2)
00138 #define LCD_BUS_I2C_D4 (1 << 3)
00139 #define LCD_BUS_I2C_D5 (1 << 4)
00140 #define LCD_BUS_I2C_D6 (1 << 5)
00141 #define LCD_BUS_I2C_D7 (1 << 6)
00142 #define LCD_BUS_I2C_BL (1 << 7)
00143 
00144 #define LCD_BUS_I2C_E2 (1 << 0)
00145 #define LCD_BUS_I2C_RW (1 << 0)
00146 
00147 //SPI bus expander (74595) interface
00148 #define LCD_BUS_SPI_0  (1 << 0)
00149 #define LCD_BUS_SPI_RS (1 << 1)
00150 #define LCD_BUS_SPI_E  (1 << 2)
00151 #define LCD_BUS_SPI_D7 (1 << 3)
00152 #define LCD_BUS_SPI_D6 (1 << 4)
00153 #define LCD_BUS_SPI_D5 (1 << 5)
00154 #define LCD_BUS_SPI_D4 (1 << 6)
00155 #define LCD_BUS_SPI_BL (1 << 7)
00156 
00157 #define LCD_BUS_SPI_E2 (1 << 0)
00158 #define LCD_BUS_SPI_RW (1 << 0)
00159 
00160 //Force I2C portexpander type
00161 #define PCF8574        0
00162 #define MCP23008       1
00163 
00164 //Inverted Backlight control
00165 #define BACKLIGHT_INV  0
00166 #endif
00167 
00168 #if (DFROBOT==1)
00169 //Definitions for DFROBOT LCD2004 Module mapping between serial port expander pins and LCD controller
00170 //This hardware uses PCF8574 and is different from earlier/different Arduino I2C LCD displays
00171 //Slaveaddress hardwired to 0x4E. SDA/SCL has pullup Resistors onboard.
00172 //See http://arduino-info.wikispaces.com/LCD-Blue-I2C
00173 //
00174 //Definitions for DFROBOT V1.1 
00175 //This hardware uses PCF8574. Slaveaddress may be set by jumpers (default 0x40).
00176 //SDA/SCL has pullup Resistors onboard and features a voltage level converter 3V3 <-> 5V.
00177 //See http://www.dfrobot.com/index.php?route=product/product&product_id=135
00178 //
00179 //
00180 //Note: LCD RW pin must be kept LOW
00181 //      E2 is not available on default Arduino hardware and so it does not support LCD40x4 (second controller)
00182 //      BL is used to control backlight
00183 
00184 //I2C bus expander PCF8574 interface
00185 #define LCD_BUS_I2C_RS (1 << 0)
00186 #define LCD_BUS_I2C_RW (1 << 1)
00187 #define LCD_BUS_I2C_E  (1 << 2)
00188 #define LCD_BUS_I2C_BL (1 << 3)
00189 #define LCD_BUS_I2C_D4 (1 << 4)
00190 #define LCD_BUS_I2C_D5 (1 << 5)
00191 #define LCD_BUS_I2C_D6 (1 << 6)
00192 #define LCD_BUS_I2C_D7 (1 << 7)
00193 
00194 #define LCD_BUS_I2C_E2 (1 << 1)
00195 
00196 //SPI bus expander (74595) interface, same as I2C
00197 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS
00198 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW
00199 #define LCD_BUS_SPI_E  LCD_BUS_I2C_E
00200 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL
00201 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4
00202 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5
00203 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6
00204 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7
00205 
00206 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2
00207 
00208 
00209 //Force I2C portexpander type
00210 #define PCF8574        1
00211 #define MCP23008       0
00212 
00213 //Inverted Backlight control
00214 #define BACKLIGHT_INV  0
00215 #endif
00216 
00217 #if ((YWROBOT==1) || (LCM1602==1))
00218 //Definitions for YWROBOT LCM1602 V1 Module mapping between serial port expander pins and LCD controller. 
00219 //Very similar to DFROBOT. Also marked as 'Funduino'. This hardware uses PCF8574.
00220 //Slaveaddress may be set by solderbridges (default 0x4E). SDA/SCL has no pullup Resistors onboard.
00221 //See http://arduino-info.wikispaces.com/LCD-Blue-I2C
00222 //
00223 //Note: LCD RW pin must be kept LOW
00224 //      E2 is not available on default hardware and so it does not support LCD40x4 (second controller)
00225 //      BL is used to control backlight.
00226 
00227 //I2C bus expander PCF8574 interface
00228 #define LCD_BUS_I2C_RS (1 << 0)
00229 #define LCD_BUS_I2C_RW (1 << 1)
00230 #define LCD_BUS_I2C_E  (1 << 2)
00231 #define LCD_BUS_I2C_BL (1 << 3)
00232 #define LCD_BUS_I2C_D4 (1 << 4)
00233 #define LCD_BUS_I2C_D5 (1 << 5)
00234 #define LCD_BUS_I2C_D6 (1 << 6)
00235 #define LCD_BUS_I2C_D7 (1 << 7)
00236 
00237 #define LCD_BUS_I2C_E2 (1 << 1)
00238 
00239 //SPI bus expander (74595) interface, same as I2C
00240 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS
00241 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW
00242 #define LCD_BUS_SPI_E  LCD_BUS_I2C_E
00243 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL
00244 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4
00245 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5
00246 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6
00247 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7
00248 
00249 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2
00250 
00251 //Force I2C portexpander type
00252 #define PCF8574        1
00253 #define MCP23008       0
00254 
00255 //Inverted Backlight control
00256 #define BACKLIGHT_INV  0
00257 #endif
00258 
00259 #if ((GYLCD==1) || (MJKDZ==1))
00260 //Definitions for Arduino-IIC-LCD GY-LCD-V1, for GY-IICLCD and for MJKDZ Module mapping between serial port expander pins and LCD controller. 
00261 //Very similar to DFROBOT. This hardware uses PCF8574.
00262 //Slaveaddress may be set by solderbridges (default 0x4E). SDA/SCL has pullup Resistors onboard.
00263 //See http://arduino-info.wikispaces.com/LCD-Blue-I2C
00264 //
00265 //Note: LCD RW pin must be kept LOW
00266 //      E2 is not available on default hardware and so it does not support LCD40x4 (second controller)
00267 //      BL is used to control backlight, reverse logic: Low turns on Backlight. This is handled in setBacklight()
00268 
00269 //I2C bus expander PCF8574 interface
00270 #define LCD_BUS_I2C_D4 (1 << 0)
00271 #define LCD_BUS_I2C_D5 (1 << 1)
00272 #define LCD_BUS_I2C_D6 (1 << 2)
00273 #define LCD_BUS_I2C_D7 (1 << 3)
00274 #define LCD_BUS_I2C_E  (1 << 4)
00275 #define LCD_BUS_I2C_RW (1 << 5)
00276 #define LCD_BUS_I2C_RS (1 << 6)
00277 #define LCD_BUS_I2C_BL (1 << 7)
00278 
00279 #define LCD_BUS_I2C_E2 (1 << 5)
00280 
00281 //SPI bus expander (74595) interface
00282 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4
00283 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5
00284 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6
00285 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7
00286 #define LCD_BUS_SPI_E  LCD_BUS_I2C_E
00287 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW
00288 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS
00289 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL
00290 
00291 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2
00292 
00293 //Force I2C portexpander type
00294 #define PCF8574        1
00295 #define MCP23008       0
00296 
00297 //Force Inverted Backlight control
00298 #define BACKLIGHT_INV  1
00299 #endif
00300 
00301 #if (SYDZ==1)
00302 //Definitions for SYDZ Module mapping between serial port expander pins and LCD controller. 
00303 //Very similar to DFROBOT. This hardware uses PCF8574A.
00304 //Slaveaddress may be set by switches (default 0x70). SDA/SCL has pullup Resistors onboard.
00305 //See ebay
00306 //
00307 //Note: LCD RW pin must be kept LOW
00308 //      E2 is not available on default hardware and so it does not support LCD40x4 (second controller)
00309 //      BL is used to control backlight
00310 
00311 //I2C bus expander PCF8574A interface
00312 #define LCD_BUS_I2C_RS (1 << 0)
00313 #define LCD_BUS_I2C_RW (1 << 1)
00314 #define LCD_BUS_I2C_E  (1 << 2)
00315 #define LCD_BUS_I2C_BL (1 << 3)
00316 #define LCD_BUS_I2C_D4 (1 << 4)
00317 #define LCD_BUS_I2C_D5 (1 << 5)
00318 #define LCD_BUS_I2C_D6 (1 << 6)
00319 #define LCD_BUS_I2C_D7 (1 << 7)
00320 
00321 #define LCD_BUS_I2C_E2 (1 << 1)
00322 
00323 //SPI bus expander (74595) interface, same as I2C
00324 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS
00325 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW
00326 #define LCD_BUS_SPI_E  LCD_BUS_I2C_E
00327 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL
00328 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4
00329 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5
00330 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6
00331 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7
00332 
00333 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2
00334 
00335 //Force I2C portexpander type
00336 #define PCF8574        1
00337 #define MCP23008       0
00338 
00339 //Force Inverted Backlight control
00340 #define BACKLIGHT_INV  0
00341 #endif
00342 
00343 #if (WIDEHK==1)
00344 //Definitions for WIDE.HK I2C backpack mapping between serial port expander pins and LCD controller
00345 //This hardware uses an MCP23008 I2C expander.
00346 //Slaveaddress is hardcoded at 0x4E. SDA/SCL has pullup Resistors onboard (3k3).
00347 //See http://www.wide.hk
00348 //
00349 //Note: LCD RW pin must be kept LOW
00350 //      E2 is not available on this hardware and so it does not support LCD40x4 (second controller)
00351 //      BL is used to control backlight
00352 //
00353 
00354 //I2C bus expander (MCP23008) interface
00355 #define LCD_BUS_I2C_D4 (1 << 0)
00356 #define LCD_BUS_I2C_D5 (1 << 1)
00357 #define LCD_BUS_I2C_D6 (1 << 2)
00358 #define LCD_BUS_I2C_D7 (1 << 3)
00359 #define LCD_BUS_I2C_RS (1 << 4)
00360 #define LCD_BUS_I2C_RW (1 << 5)
00361 #define LCD_BUS_I2C_BL (1 << 6)
00362 #define LCD_BUS_I2C_E  (1 << 7)
00363 
00364 #define LCD_BUS_I2C_E2 (1 << 5)
00365 
00366 //SPI bus expander (74595) interface, same as I2C
00367 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4
00368 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5
00369 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6
00370 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7
00371 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS
00372 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW
00373 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL
00374 #define LCD_BUS_SPI_E  LCD_BUS_I2C_E
00375 
00376 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2
00377 
00378 //Force I2C portexpander type
00379 #define PCF8574        0
00380 #define MCP23008       1
00381 
00382 //Inverted Backlight control
00383 #define BACKLIGHT_INV  0
00384 #endif
00385 
00386 #if (LCDPLUG==1)
00387 //Definitions for Jeelabs LCD_Plug I2C backpack mapping between serial port expander pins and LCD controller
00388 //This hardware uses an MCP23008 I2C expander.
00389 //Slaveaddress is hardcoded at 0x48. SDA/SCL has no pullup Resistors onboard.
00390 //See http://jeelabs.net/projects/hardware/wiki/lcd_plug
00391 //
00392 //Note: LCD RW pin must be kept LOW
00393 //      E2 is available on a plug and so it does support LCD40x4 (second controller)
00394 //      BL is used to control backlight
00395 //
00396 
00397 //I2C bus expander (MCP23008) interface
00398 #define LCD_BUS_I2C_D4 (1 << 0)
00399 #define LCD_BUS_I2C_D5 (1 << 1)
00400 #define LCD_BUS_I2C_D6 (1 << 2)
00401 #define LCD_BUS_I2C_D7 (1 << 3)
00402 #define LCD_BUS_I2C_RS (1 << 4)
00403 #define LCD_BUS_I2C_E2 (1 << 5)
00404 #define LCD_BUS_I2C_E  (1 << 6)
00405 #define LCD_BUS_I2C_BL (1 << 7)
00406 
00407 #define LCD_BUS_I2C_RW (1 << 5)
00408 
00409 //SPI bus expander (74595) interface, same as I2C
00410 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4
00411 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5
00412 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6
00413 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7
00414 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS
00415 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2
00416 #define LCD_BUS_SPI_E  LCD_BUS_I2C_E
00417 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL
00418 
00419 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW
00420 
00421 //Force I2C portexpander type
00422 #define PCF8574        0
00423 #define MCP23008       1
00424 
00425 //Inverted Backlight control
00426 #define BACKLIGHT_INV  0
00427 #endif
00428 
00429 
00430 //Bitpattern Defines for I2C PCF8574/PCF8574A, MCP23008 and SPI 74595 Bus expanders
00431 //Don't change!
00432 #define LCD_BUS_I2C_MSK (LCD_BUS_I2C_D4 | LCD_BUS_I2C_D5 | LCD_BUS_I2C_D6 | LCD_BUS_I2C_D7)
00433 #if (BACKLIGHT_INV == 1)
00434 #define LCD_BUS_I2C_DEF (0x00 | LCD_BUS_I2C_BL)
00435 #else
00436 #define LCD_BUS_I2C_DEF  0x00
00437 #endif
00438 
00439 #define LCD_BUS_SPI_MSK (LCD_BUS_SPI_D4 | LCD_BUS_SPI_D5 | LCD_BUS_SPI_D6 | LCD_BUS_SPI_D7)
00440 #if (BACKLIGHT_INV == 1)
00441 #define LCD_BUS_SPI_DEF (0x00 | LCD_BUS_SPI_BL)
00442 #else
00443 #define LCD_BUS_SPI_DEF  0x00
00444 #endif
00445 
00446 
00447 /* PCF8574/PCF8574A I2C portexpander slave address */
00448 #define PCF8574_SA0    0x40
00449 #define PCF8574_SA1    0x42
00450 #define PCF8574_SA2    0x44
00451 #define PCF8574_SA3    0x46
00452 #define PCF8574_SA4    0x48
00453 #define PCF8574_SA5    0x4A
00454 #define PCF8574_SA6    0x4C
00455 #define PCF8574_SA7    0x4E
00456 
00457 #define PCF8574A_SA0   0x70
00458 #define PCF8574A_SA1   0x72
00459 #define PCF8574A_SA2   0x74
00460 #define PCF8574A_SA3   0x76
00461 #define PCF8574A_SA4   0x78
00462 #define PCF8574A_SA5   0x7A
00463 #define PCF8574A_SA6   0x7C
00464 #define PCF8574A_SA7   0x7E
00465 
00466 /* MCP23008 I2C portexpander slave address */
00467 #define MCP23008_SA0   0x40
00468 #define MCP23008_SA1   0x42
00469 #define MCP23008_SA2   0x44
00470 #define MCP23008_SA3   0x46
00471 #define MCP23008_SA4   0x48
00472 #define MCP23008_SA5   0x4A
00473 #define MCP23008_SA6   0x4C
00474 #define MCP23008_SA7   0x4E
00475 
00476 /* MCP23008 I2C portexpander internal registers */
00477 #define IODIR          0x00
00478 #define IPOL           0x01
00479 #define GPINTEN        0x02
00480 #define DEFVAL         0x03
00481 #define INTCON         0x04
00482 #define IOCON          0x05
00483 #define GPPU           0x06
00484 #define INTF           0x07
00485 #define INTCAP         0x08
00486 #define GPIO           0x09
00487 #define OLAT           0x0A
00488 
00489 /* ST7032i I2C slave address */
00490 #define ST7032_SA      0x7C
00491 
00492 /* ST7036i I2C slave address */
00493 #define ST7036_SA0     0x78
00494 #define ST7036_SA1     0x7A
00495 #define ST7036_SA2     0x7C
00496 #define ST7036_SA3     0x7E
00497 
00498 /* ST7066_ACM I2C slave address, Added for ACM1602 module  */
00499 #define ST7066_SA0     0xA0
00500 
00501 /* PCF21XX I2C slave address */
00502 #define PCF21XX_SA0    0x74
00503 #define PCF21XX_SA1    0x76
00504 
00505 /* AIP31068 I2C slave address */
00506 #define AIP31068_SA    0x7C
00507 
00508 /* SSD1803 I2C slave address */
00509 #define SSD1803_SA0    0x78
00510 #define SSD1803_SA1    0x7A
00511 
00512 /* US2066/SSD1311 I2C slave address */
00513 #define US2066_SA0     0x78
00514 #define US2066_SA1     0x7A
00515 
00516 /* AC780 I2C slave address */
00517 #define AC780_SA0      0x78
00518 #define AC780_SA1      0x7A
00519 #define AC780_SA2      0x7C
00520 #define AC780_SA3      0x7E
00521 
00522 /* SPLC792A is clone of ST7032i */
00523 #define SPLC792A_SA0   0x78
00524 #define SPLC792A_SA1   0x7A
00525 #define SPLC792A_SA2   0x7C
00526 #define SPLC792A_SA3   0x7E
00527 
00528 //Some native I2C controllers dont support ACK. Set define to '0' to allow code to proceed even without ACK
00529 //#define LCD_I2C_ACK    0
00530 #define LCD_I2C_ACK    1
00531 
00532 
00533 // Contrast setting, 6 significant bits (only supported for controllers with extended features)
00534 // Voltage Multiplier setting, 2 or 3 significant bits (only supported for controllers with extended features)
00535 #define LCD_DEF_CONTRAST    0x20
00536 
00537 //ST7032 EastRising ERC1602FS-4 display
00538 //Contrast setting 6 significant bits (0..63)
00539 //Voltage Multiplier setting 3 significant bits:
00540 // 0: 1.818V
00541 // 1: 2.222V
00542 // 2: 2.667V
00543 // 3: 3.333V
00544 // 4: 3.636V (ST7032 default)
00545 // 5: 4.000V
00546 // 6: 4.444V
00547 // 7: 5.000V
00548 #define LCD_ST7032_CONTRAST 0x28 
00549 #define LCD_ST7032_RAB      0x04
00550 
00551 //ST7036 EA DOGM1603 display
00552 //Contrast setting 6 significant bits
00553 //Voltage Multiplier setting 3 significant bits
00554 #define LCD_ST7036_CONTRAST 0x28
00555 #define LCD_ST7036_RAB      0x04
00556 
00557 //SSD1803 EA DOGM204 display
00558 //Contrast setting 6 significant bits
00559 //Voltage Multiplier setting 3 significant bits
00560 #define LCD_SSD1_CONTRAST   0x28
00561 #define LCD_SSD1_RAB        0x06
00562 
00563 //US2066/SSD1311 EastRising ER-OLEDM2002-4 display
00564 //Contrast setting 8 significant bits, use 6 for compatibility
00565 #define LCD_US20_CONTRAST   0x3F
00566 //#define LCD_US20_CONTRAST   0x1F
00567 
00568 //PCF2113, PCF2119 display
00569 //Contrast setting 6 significant bits
00570 //Voltage Multiplier setting 2 significant bits
00571 #define LCD_PCF2_CONTRAST   0x20
00572 #define LCD_PCF2_S12        0x02
00573 
00574 //PT6314 VFD display
00575 //Contrast setting 2 significant bits, use 6 for compatibility
00576 #define LCD_PT63_CONTRAST   0x3F
00577 
00578 //SPLC792A is clone of ST7032i
00579 //Contrast setting 6 significant bits (0..63)
00580 //Voltage Multiplier setting 3 significant bits:
00581 // 0: 1.818V
00582 // 1: 2.222V
00583 // 2: 2.667V
00584 // 3: 3.333V (SPLC792A default) 
00585 // 4: 3.636V
00586 // 5: 4.000V
00587 // 6: 4.444V
00588 // 7: 5.000V
00589 #define LCD_SPLC792A_CONTRAST 0x28
00590 #define LCD_SPLC792A_RAB      0x04
00591 
00592 #endif //MBED_TEXTLCDCONFIG_H