Bartek Wereszczyński / TextLCD

Dependents:   Cassaforte Cassaforte2 Cassaforte5dic18 Cassaforte5_copy ... more

Fork of TextLCD by Wim Huiskamp

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        0
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 #define fc113          1
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)) || (fc113==1)
00218 //Definitions for FC113 based Pcf8574T Module mapping between serial port expander pins and LCD controller. 
00219 //Definitions for YWROBOT LCM1602 V1 Module mapping between serial port expander pins and LCD controller. 
00220 //Very similar to DFROBOT. Also marked as 'Funduino'. This hardware uses PCF8574.
00221 //Slaveaddress may be set by solderbridges (default 0x4E). SDA/SCL has no pullup Resistors onboard.
00222 //See http://arduino-info.wikispaces.com/LCD-Blue-I2C
00223 //
00224 //Note: LCD RW pin must be kept LOW
00225 //      E2 is not available on default hardware and so it does not support LCD40x4 (second controller)
00226 //      BL is used to control backlight.
00227 
00228 //I2C bus expander PCF8574 interface
00229 #define LCD_BUS_I2C_RS (1 << 0)
00230 #define LCD_BUS_I2C_RW (1 << 1)
00231 #define LCD_BUS_I2C_E  (1 << 2)
00232 #define LCD_BUS_I2C_BL (1 << 3)
00233 #define LCD_BUS_I2C_D4 (1 << 4)
00234 #define LCD_BUS_I2C_D5 (1 << 5)
00235 #define LCD_BUS_I2C_D6 (1 << 6)
00236 #define LCD_BUS_I2C_D7 (1 << 7)
00237 
00238 #define LCD_BUS_I2C_E2 (1 << 1)
00239 
00240 //SPI bus expander (74595) interface, same as I2C
00241 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS
00242 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW
00243 #define LCD_BUS_SPI_E  LCD_BUS_I2C_E
00244 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL
00245 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4
00246 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5
00247 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6
00248 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7
00249 
00250 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2
00251 
00252 //Force I2C portexpander type
00253 #define PCF8574        1
00254 #define MCP23008       0
00255 
00256 //Inverted Backlight control
00257 #define BACKLIGHT_INV  1
00258 #endif
00259 
00260 #if ((GYLCD==1) || (MJKDZ==1))
00261 //Definitions for Arduino-IIC-LCD GY-LCD-V1, for GY-IICLCD and for MJKDZ Module mapping between serial port expander pins and LCD controller. 
00262 //Very similar to DFROBOT. This hardware uses PCF8574.
00263 //Slaveaddress may be set by solderbridges (default 0x4E). SDA/SCL has pullup Resistors onboard.
00264 //See http://arduino-info.wikispaces.com/LCD-Blue-I2C
00265 //
00266 //Note: LCD RW pin must be kept LOW
00267 //      E2 is not available on default hardware and so it does not support LCD40x4 (second controller)
00268 //      BL is used to control backlight, reverse logic: Low turns on Backlight. This is handled in setBacklight()
00269 
00270 //I2C bus expander PCF8574 interface
00271 #define LCD_BUS_I2C_D4 (1 << 0)
00272 #define LCD_BUS_I2C_D5 (1 << 1)
00273 #define LCD_BUS_I2C_D6 (1 << 2)
00274 #define LCD_BUS_I2C_D7 (1 << 3)
00275 #define LCD_BUS_I2C_E  (1 << 4)
00276 #define LCD_BUS_I2C_RW (1 << 5)
00277 #define LCD_BUS_I2C_RS (1 << 6)
00278 #define LCD_BUS_I2C_BL (1 << 7)
00279 
00280 #define LCD_BUS_I2C_E2 (1 << 5)
00281 
00282 //SPI bus expander (74595) interface
00283 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4
00284 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5
00285 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6
00286 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7
00287 #define LCD_BUS_SPI_E  LCD_BUS_I2C_E
00288 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW
00289 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS
00290 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL
00291 
00292 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2
00293 
00294 //Force I2C portexpander type
00295 #define PCF8574        1
00296 #define MCP23008       0
00297 
00298 //Force Inverted Backlight control
00299 #define BACKLIGHT_INV  1
00300 #endif
00301 
00302 #if (SYDZ==1)
00303 //Definitions for SYDZ Module mapping between serial port expander pins and LCD controller. 
00304 //Very similar to DFROBOT. This hardware uses PCF8574A.
00305 //Slaveaddress may be set by switches (default 0x70). SDA/SCL has pullup Resistors onboard.
00306 //See ebay
00307 //
00308 //Note: LCD RW pin must be kept LOW
00309 //      E2 is not available on default hardware and so it does not support LCD40x4 (second controller)
00310 //      BL is used to control backlight
00311 
00312 //I2C bus expander PCF8574A interface
00313 #define LCD_BUS_I2C_RS (1 << 0)
00314 #define LCD_BUS_I2C_RW (1 << 1)
00315 #define LCD_BUS_I2C_E  (1 << 2)
00316 #define LCD_BUS_I2C_BL (1 << 3)
00317 #define LCD_BUS_I2C_D4 (1 << 4)
00318 #define LCD_BUS_I2C_D5 (1 << 5)
00319 #define LCD_BUS_I2C_D6 (1 << 6)
00320 #define LCD_BUS_I2C_D7 (1 << 7)
00321 
00322 #define LCD_BUS_I2C_E2 (1 << 1)
00323 
00324 //SPI bus expander (74595) interface, same as I2C
00325 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS
00326 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW
00327 #define LCD_BUS_SPI_E  LCD_BUS_I2C_E
00328 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL
00329 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4
00330 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5
00331 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6
00332 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7
00333 
00334 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2
00335 
00336 //Force I2C portexpander type
00337 #define PCF8574        1
00338 #define MCP23008       0
00339 
00340 //Force Inverted Backlight control
00341 #define BACKLIGHT_INV  0
00342 #endif
00343 
00344 #if (WIDEHK==1)
00345 //Definitions for WIDE.HK I2C backpack mapping between serial port expander pins and LCD controller
00346 //This hardware uses an MCP23008 I2C expander.
00347 //Slaveaddress is hardcoded at 0x4E. SDA/SCL has pullup Resistors onboard (3k3).
00348 //See http://www.wide.hk
00349 //
00350 //Note: LCD RW pin must be kept LOW
00351 //      E2 is not available on this hardware and so it does not support LCD40x4 (second controller)
00352 //      BL is used to control backlight
00353 //
00354 
00355 //I2C bus expander (MCP23008) interface
00356 #define LCD_BUS_I2C_D4 (1 << 0)
00357 #define LCD_BUS_I2C_D5 (1 << 1)
00358 #define LCD_BUS_I2C_D6 (1 << 2)
00359 #define LCD_BUS_I2C_D7 (1 << 3)
00360 #define LCD_BUS_I2C_RS (1 << 4)
00361 #define LCD_BUS_I2C_RW (1 << 5)
00362 #define LCD_BUS_I2C_BL (1 << 6)
00363 #define LCD_BUS_I2C_E  (1 << 7)
00364 
00365 #define LCD_BUS_I2C_E2 (1 << 5)
00366 
00367 //SPI bus expander (74595) interface, same as I2C
00368 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4
00369 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5
00370 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6
00371 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7
00372 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS
00373 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW
00374 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL
00375 #define LCD_BUS_SPI_E  LCD_BUS_I2C_E
00376 
00377 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2
00378 
00379 //Force I2C portexpander type
00380 #define PCF8574        0
00381 #define MCP23008       1
00382 
00383 //Inverted Backlight control
00384 #define BACKLIGHT_INV  0
00385 #endif
00386 
00387 #if (LCDPLUG==1)
00388 //Definitions for Jeelabs LCD_Plug I2C backpack mapping between serial port expander pins and LCD controller
00389 //This hardware uses an MCP23008 I2C expander.
00390 //Slaveaddress is hardcoded at 0x48. SDA/SCL has no pullup Resistors onboard.
00391 //See http://jeelabs.net/projects/hardware/wiki/lcd_plug
00392 //
00393 //Note: LCD RW pin must be kept LOW
00394 //      E2 is available on a plug and so it does support LCD40x4 (second controller)
00395 //      BL is used to control backlight
00396 //
00397 
00398 //I2C bus expander (MCP23008) interface
00399 #define LCD_BUS_I2C_D4 (1 << 0)
00400 #define LCD_BUS_I2C_D5 (1 << 1)
00401 #define LCD_BUS_I2C_D6 (1 << 2)
00402 #define LCD_BUS_I2C_D7 (1 << 3)
00403 #define LCD_BUS_I2C_RS (1 << 4)
00404 #define LCD_BUS_I2C_E2 (1 << 5)
00405 #define LCD_BUS_I2C_E  (1 << 6)
00406 #define LCD_BUS_I2C_BL (1 << 7)
00407 
00408 #define LCD_BUS_I2C_RW (1 << 5)
00409 
00410 //SPI bus expander (74595) interface, same as I2C
00411 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4
00412 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5
00413 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6
00414 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7
00415 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS
00416 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2
00417 #define LCD_BUS_SPI_E  LCD_BUS_I2C_E
00418 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL
00419 
00420 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW
00421 
00422 //Force I2C portexpander type
00423 #define PCF8574        0
00424 #define MCP23008       1
00425 
00426 //Inverted Backlight control
00427 #define BACKLIGHT_INV  0
00428 #endif
00429 
00430 
00431 //Bitpattern Defines for I2C PCF8574/PCF8574A, MCP23008 and SPI 74595 Bus expanders
00432 //Don't change!
00433 #define LCD_BUS_I2C_MSK (LCD_BUS_I2C_D4 | LCD_BUS_I2C_D5 | LCD_BUS_I2C_D6 | LCD_BUS_I2C_D7)
00434 #if (BACKLIGHT_INV == 1)
00435 #define LCD_BUS_I2C_DEF (0x00 | LCD_BUS_I2C_BL)
00436 #else
00437 #define LCD_BUS_I2C_DEF  0x00
00438 #endif
00439 
00440 #define LCD_BUS_SPI_MSK (LCD_BUS_SPI_D4 | LCD_BUS_SPI_D5 | LCD_BUS_SPI_D6 | LCD_BUS_SPI_D7)
00441 #if (BACKLIGHT_INV == 1)
00442 #define LCD_BUS_SPI_DEF (0x00 | LCD_BUS_SPI_BL)
00443 #else
00444 #define LCD_BUS_SPI_DEF  0x00
00445 #endif
00446 
00447 
00448 /* PCF8574/PCF8574A I2C portexpander slave address */
00449 #define PCF8574_SA0    0x40
00450 #define PCF8574_SA1    0x42
00451 #define PCF8574_SA2    0x44
00452 #define PCF8574_SA3    0x46
00453 #define PCF8574_SA4    0x48
00454 #define PCF8574_SA5    0x4A
00455 #define PCF8574_SA6    0x4C
00456 #define PCF8574_SA7    0x4E
00457 
00458 #define PCF8574A_SA0   0x70
00459 #define PCF8574A_SA1   0x72
00460 #define PCF8574A_SA2   0x74
00461 #define PCF8574A_SA3   0x76
00462 #define PCF8574A_SA4   0x78
00463 #define PCF8574A_SA5   0x7A
00464 #define PCF8574A_SA6   0x7C
00465 #define PCF8574A_SA7   0x7E
00466 
00467 /* MCP23008 I2C portexpander slave address */
00468 #define MCP23008_SA0   0x40
00469 #define MCP23008_SA1   0x42
00470 #define MCP23008_SA2   0x44
00471 #define MCP23008_SA3   0x46
00472 #define MCP23008_SA4   0x48
00473 #define MCP23008_SA5   0x4A
00474 #define MCP23008_SA6   0x4C
00475 #define MCP23008_SA7   0x4E
00476 
00477 /* MCP23008 I2C portexpander internal registers */
00478 #define IODIR          0x00
00479 #define IPOL           0x01
00480 #define GPINTEN        0x02
00481 #define DEFVAL         0x03
00482 #define INTCON         0x04
00483 #define IOCON          0x05
00484 #define GPPU           0x06
00485 #define INTF           0x07
00486 #define INTCAP         0x08
00487 #define GPIO           0x09
00488 #define OLAT           0x0A
00489 
00490 /* ST7032i I2C slave address */
00491 #define ST7032_SA      0x7C
00492 
00493 /* ST7036i I2C slave address */
00494 #define ST7036_SA0     0x78
00495 #define ST7036_SA1     0x7A
00496 #define ST7036_SA2     0x7C
00497 #define ST7036_SA3     0x7E
00498 
00499 /* ST7066_ACM I2C slave address, Added for ACM1602 module  */
00500 #define ST7066_SA0     0xA0
00501 
00502 /* PCF21XX I2C slave address */
00503 #define PCF21XX_SA0    0x74
00504 #define PCF21XX_SA1    0x76
00505 
00506 /* AIP31068 I2C slave address */
00507 #define AIP31068_SA    0x7C
00508 
00509 /* SSD1803 I2C slave address */
00510 #define SSD1803_SA0    0x78
00511 #define SSD1803_SA1    0x7A
00512 
00513 /* US2066/SSD1311 I2C slave address */
00514 #define US2066_SA0     0x78
00515 #define US2066_SA1     0x7A
00516 
00517 /* AC780 I2C slave address */
00518 #define AC780_SA0      0x78
00519 #define AC780_SA1      0x7A
00520 #define AC780_SA2      0x7C
00521 #define AC780_SA3      0x7E
00522 
00523 /* SPLC792A is clone of ST7032i */
00524 #define SPLC792A_SA0   0x78
00525 #define SPLC792A_SA1   0x7A
00526 #define SPLC792A_SA2   0x7C
00527 #define SPLC792A_SA3   0x7E
00528 
00529 //Some native I2C controllers dont support ACK. Set define to '0' to allow code to proceed even without ACK
00530 //#define LCD_I2C_ACK    0
00531 #define LCD_I2C_ACK    1
00532 
00533 
00534 // Contrast setting, 6 significant bits (only supported for controllers with extended features)
00535 // Voltage Multiplier setting, 2 or 3 significant bits (only supported for controllers with extended features)
00536 #define LCD_DEF_CONTRAST    0x20
00537 
00538 //ST7032 EastRising ERC1602FS-4 display
00539 //Contrast setting 6 significant bits (0..63)
00540 //Voltage Multiplier setting 3 significant bits:
00541 // 0: 1.818V
00542 // 1: 2.222V
00543 // 2: 2.667V
00544 // 3: 3.333V
00545 // 4: 3.636V (ST7032 default)
00546 // 5: 4.000V
00547 // 6: 4.444V
00548 // 7: 5.000V
00549 #define LCD_ST7032_CONTRAST 0x28 
00550 #define LCD_ST7032_RAB      0x04
00551 
00552 //ST7036 EA DOGM1603 display
00553 //Contrast setting 6 significant bits
00554 //Voltage Multiplier setting 3 significant bits
00555 #define LCD_ST7036_CONTRAST 0x28
00556 #define LCD_ST7036_RAB      0x04
00557 
00558 //SSD1803 EA DOGM204 display
00559 //Contrast setting 6 significant bits
00560 //Voltage Multiplier setting 3 significant bits
00561 #define LCD_SSD1_CONTRAST   0x28
00562 #define LCD_SSD1_RAB        0x06
00563 
00564 //US2066/SSD1311 EastRising ER-OLEDM2002-4 display
00565 //Contrast setting 8 significant bits, use 6 for compatibility
00566 #define LCD_US20_CONTRAST   0x3F
00567 //#define LCD_US20_CONTRAST   0x1F
00568 
00569 //PCF2113, PCF2119 display
00570 //Contrast setting 6 significant bits
00571 //Voltage Multiplier setting 2 significant bits
00572 #define LCD_PCF2_CONTRAST   0x20
00573 #define LCD_PCF2_S12        0x02
00574 
00575 //PT6314 VFD display
00576 //Contrast setting 2 significant bits, use 6 for compatibility
00577 #define LCD_PT63_CONTRAST   0x3F
00578 
00579 //SPLC792A is clone of ST7032i
00580 //Contrast setting 6 significant bits (0..63)
00581 //Voltage Multiplier setting 3 significant bits:
00582 // 0: 1.818V
00583 // 1: 2.222V
00584 // 2: 2.667V
00585 // 3: 3.333V (SPLC792A default) 
00586 // 4: 3.636V
00587 // 5: 4.000V
00588 // 6: 4.444V
00589 // 7: 5.000V
00590 #define LCD_SPLC792A_CONTRAST 0x28
00591 #define LCD_SPLC792A_RAB      0x04
00592 
00593 #endif //MBED_TEXTLCDCONFIG_H