Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of TextLCD by
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/PCA9538 */ 00037 #define LCD_SPI 0 /* SPI Expander SN74595 */ 00038 #define LCD_I2C_N 0 /* Native I2C bus */ 00039 #define LCD_SPI_N 0 /* Native SPI bus */ 00040 #define LCD_SPI_N_3_8 0 /* Native SPI bus */ 00041 #define LCD_SPI_N_3_9 0 /* Native SPI bus */ 00042 #define LCD_SPI_N_3_10 0 /* Native SPI bus */ 00043 #define LCD_SPI_N_3_16 0 /* Native SPI bus */ 00044 #define LCD_SPI_N_3_24 0 /* 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 0 /* 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 or PCA9538 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 MCP23008or PCA9538) 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 or PCA9538) 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 0 00117 #define MCP23008 0 00118 #define PCA9538 1 00119 00120 //Inverted Backlight control 00121 #define BACKLIGHT_INV 0 00122 #endif 00123 00124 #if (ADAFRUIT==1) 00125 //Definitions for Adafruit i2cspilcdbackpack mapping between serial port expander pins and LCD controller 00126 //This hardware supports both an I2C expander (MCP23008) and an SPI expander (74595) selectable by a jumper. 00127 //Slaveaddress may be set by solderbridges (default 0x40). SDA/SCL has pullup Resistors onboard. 00128 //See http://www.ladyada.net/products/i2cspilcdbackpack 00129 // 00130 //Note: LCD RW pin must be kept LOW 00131 // E2 is not available on this hardware and so it does not support LCD40x4 (second controller) 00132 // BL is used to control backlight 00133 //Note: The pinmappings are different for the MCP23008 and the 74595! 00134 00135 //I2C bus expander (MCP23008) interface 00136 #define LCD_BUS_I2C_0 (1 << 0) 00137 #define LCD_BUS_I2C_RS (1 << 1) 00138 #define LCD_BUS_I2C_E (1 << 2) 00139 #define LCD_BUS_I2C_D4 (1 << 3) 00140 #define LCD_BUS_I2C_D5 (1 << 4) 00141 #define LCD_BUS_I2C_D6 (1 << 5) 00142 #define LCD_BUS_I2C_D7 (1 << 6) 00143 #define LCD_BUS_I2C_BL (1 << 7) 00144 00145 #define LCD_BUS_I2C_E2 (1 << 0) 00146 #define LCD_BUS_I2C_RW (1 << 0) 00147 00148 //SPI bus expander (74595) interface 00149 #define LCD_BUS_SPI_0 (1 << 0) 00150 #define LCD_BUS_SPI_RS (1 << 1) 00151 #define LCD_BUS_SPI_E (1 << 2) 00152 #define LCD_BUS_SPI_D7 (1 << 3) 00153 #define LCD_BUS_SPI_D6 (1 << 4) 00154 #define LCD_BUS_SPI_D5 (1 << 5) 00155 #define LCD_BUS_SPI_D4 (1 << 6) 00156 #define LCD_BUS_SPI_BL (1 << 7) 00157 00158 #define LCD_BUS_SPI_E2 (1 << 0) 00159 #define LCD_BUS_SPI_RW (1 << 0) 00160 00161 //Force I2C portexpander type 00162 #define PCF8574 0 00163 #define MCP23008 1 00164 #define PCA9538 0 00165 00166 //Inverted Backlight control 00167 #define BACKLIGHT_INV 0 00168 #endif 00169 00170 #if (DFROBOT==1) 00171 //Definitions for DFROBOT LCD2004 Module mapping between serial port expander pins and LCD controller 00172 //This hardware uses PCF8574 and is different from earlier/different Arduino I2C LCD displays 00173 //Slaveaddress hardwired to 0x4E. SDA/SCL has pullup Resistors onboard. 00174 //See http://arduino-info.wikispaces.com/LCD-Blue-I2C 00175 // 00176 //Definitions for DFROBOT V1.1 00177 //This hardware uses PCF8574. Slaveaddress may be set by jumpers (default 0x40). 00178 //SDA/SCL has pullup Resistors onboard and features a voltage level converter 3V3 <-> 5V. 00179 //See http://www.dfrobot.com/index.php?route=product/product&product_id=135 00180 // 00181 // 00182 //Note: LCD RW pin must be kept LOW 00183 // E2 is not available on default Arduino hardware and so it does not support LCD40x4 (second controller) 00184 // BL is used to control backlight 00185 00186 //I2C bus expander PCF8574 interface 00187 #define LCD_BUS_I2C_RS (1 << 0) 00188 #define LCD_BUS_I2C_RW (1 << 1) 00189 #define LCD_BUS_I2C_E (1 << 2) 00190 #define LCD_BUS_I2C_BL (1 << 3) 00191 #define LCD_BUS_I2C_D4 (1 << 4) 00192 #define LCD_BUS_I2C_D5 (1 << 5) 00193 #define LCD_BUS_I2C_D6 (1 << 6) 00194 #define LCD_BUS_I2C_D7 (1 << 7) 00195 00196 #define LCD_BUS_I2C_E2 (1 << 1) 00197 00198 //SPI bus expander (74595) interface, same as I2C 00199 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS 00200 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW 00201 #define LCD_BUS_SPI_E LCD_BUS_I2C_E 00202 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL 00203 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4 00204 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5 00205 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6 00206 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7 00207 00208 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2 00209 00210 00211 //Force I2C portexpander type 00212 #define PCF8574 1 00213 #define MCP23008 0 00214 #define PCA9538 0 00215 00216 //Inverted Backlight control 00217 #define BACKLIGHT_INV 0 00218 #endif 00219 00220 #if ((YWROBOT==1) || (LCM1602==1)) 00221 //Definitions for YWROBOT LCM1602 V1 Module mapping between serial port expander pins and LCD controller. 00222 //Very similar to DFROBOT. Also marked as 'Funduino'. This hardware uses PCF8574. 00223 //Slaveaddress may be set by solderbridges (default 0x4E). SDA/SCL has no pullup Resistors onboard. 00224 //See http://arduino-info.wikispaces.com/LCD-Blue-I2C 00225 // 00226 //Note: LCD RW pin must be kept LOW 00227 // E2 is not available on default hardware and so it does not support LCD40x4 (second controller) 00228 // BL is used to control backlight. 00229 00230 //I2C bus expander PCF8574 interface 00231 #define LCD_BUS_I2C_RS (1 << 0) 00232 #define LCD_BUS_I2C_RW (1 << 1) 00233 #define LCD_BUS_I2C_E (1 << 2) 00234 #define LCD_BUS_I2C_BL (1 << 3) 00235 #define LCD_BUS_I2C_D4 (1 << 4) 00236 #define LCD_BUS_I2C_D5 (1 << 5) 00237 #define LCD_BUS_I2C_D6 (1 << 6) 00238 #define LCD_BUS_I2C_D7 (1 << 7) 00239 00240 #define LCD_BUS_I2C_E2 (1 << 1) 00241 00242 //SPI bus expander (74595) interface, same as I2C 00243 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS 00244 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW 00245 #define LCD_BUS_SPI_E LCD_BUS_I2C_E 00246 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL 00247 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4 00248 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5 00249 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6 00250 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7 00251 00252 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2 00253 00254 //Force I2C portexpander type 00255 #define PCF8574 1 00256 #define MCP23008 0 00257 #define PCA9538 0 00258 00259 //Inverted Backlight control 00260 #define BACKLIGHT_INV 0 00261 #endif 00262 00263 #if ((GYLCD==1) || (MJKDZ==1)) 00264 //Definitions for Arduino-IIC-LCD GY-LCD-V1, for GY-IICLCD and for MJKDZ Module mapping between serial port expander pins and LCD controller. 00265 //Very similar to DFROBOT. This hardware uses PCF8574. 00266 //Slaveaddress may be set by solderbridges (default 0x4E). SDA/SCL has pullup Resistors onboard. 00267 //See http://arduino-info.wikispaces.com/LCD-Blue-I2C 00268 // 00269 //Note: LCD RW pin must be kept LOW 00270 // E2 is not available on default hardware and so it does not support LCD40x4 (second controller) 00271 // BL is used to control backlight, reverse logic: Low turns on Backlight. This is handled in setBacklight() 00272 00273 //I2C bus expander PCF8574 interface 00274 #define LCD_BUS_I2C_D4 (1 << 0) 00275 #define LCD_BUS_I2C_D5 (1 << 1) 00276 #define LCD_BUS_I2C_D6 (1 << 2) 00277 #define LCD_BUS_I2C_D7 (1 << 3) 00278 #define LCD_BUS_I2C_E (1 << 4) 00279 #define LCD_BUS_I2C_RW (1 << 5) 00280 #define LCD_BUS_I2C_RS (1 << 6) 00281 #define LCD_BUS_I2C_BL (1 << 7) 00282 00283 #define LCD_BUS_I2C_E2 (1 << 5) 00284 00285 //SPI bus expander (74595) interface 00286 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4 00287 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5 00288 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6 00289 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7 00290 #define LCD_BUS_SPI_E LCD_BUS_I2C_E 00291 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW 00292 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS 00293 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL 00294 00295 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2 00296 00297 //Force I2C portexpander type 00298 #define PCF8574 1 00299 #define MCP23008 0 00300 #define PCA9538 0 00301 00302 //Force Inverted Backlight control 00303 #define BACKLIGHT_INV 1 00304 #endif 00305 00306 #if (SYDZ==1) 00307 //Definitions for SYDZ Module mapping between serial port expander pins and LCD controller. 00308 //Very similar to DFROBOT. This hardware uses PCF8574A. 00309 //Slaveaddress may be set by switches (default 0x70). SDA/SCL has pullup Resistors onboard. 00310 //See ebay 00311 // 00312 //Note: LCD RW pin must be kept LOW 00313 // E2 is not available on default hardware and so it does not support LCD40x4 (second controller) 00314 // BL is used to control backlight 00315 00316 //I2C bus expander PCF8574A interface 00317 #define LCD_BUS_I2C_RS (1 << 0) 00318 #define LCD_BUS_I2C_RW (1 << 1) 00319 #define LCD_BUS_I2C_E (1 << 2) 00320 #define LCD_BUS_I2C_BL (1 << 3) 00321 #define LCD_BUS_I2C_D4 (1 << 4) 00322 #define LCD_BUS_I2C_D5 (1 << 5) 00323 #define LCD_BUS_I2C_D6 (1 << 6) 00324 #define LCD_BUS_I2C_D7 (1 << 7) 00325 00326 #define LCD_BUS_I2C_E2 (1 << 1) 00327 00328 //SPI bus expander (74595) interface, same as I2C 00329 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS 00330 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW 00331 #define LCD_BUS_SPI_E LCD_BUS_I2C_E 00332 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL 00333 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4 00334 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5 00335 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6 00336 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7 00337 00338 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2 00339 00340 //Force I2C portexpander type 00341 #define PCF8574 1 00342 #define MCP23008 0 00343 #define PCA9538 0 00344 00345 //Force Inverted Backlight control 00346 #define BACKLIGHT_INV 0 00347 #endif 00348 00349 #if (WIDEHK==1) 00350 //Definitions for WIDE.HK I2C backpack mapping between serial port expander pins and LCD controller 00351 //This hardware uses an MCP23008 I2C expander. 00352 //Slaveaddress is hardcoded at 0x4E. SDA/SCL has pullup Resistors onboard (3k3). 00353 //See http://www.wide.hk 00354 // 00355 //Note: LCD RW pin must be kept LOW 00356 // E2 is not available on this hardware and so it does not support LCD40x4 (second controller) 00357 // BL is used to control backlight 00358 // 00359 00360 //I2C bus expander (MCP23008) interface 00361 #define LCD_BUS_I2C_D4 (1 << 0) 00362 #define LCD_BUS_I2C_D5 (1 << 1) 00363 #define LCD_BUS_I2C_D6 (1 << 2) 00364 #define LCD_BUS_I2C_D7 (1 << 3) 00365 #define LCD_BUS_I2C_RS (1 << 4) 00366 #define LCD_BUS_I2C_RW (1 << 5) 00367 #define LCD_BUS_I2C_BL (1 << 6) 00368 #define LCD_BUS_I2C_E (1 << 7) 00369 00370 #define LCD_BUS_I2C_E2 (1 << 5) 00371 00372 //SPI bus expander (74595) interface, same as I2C 00373 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4 00374 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5 00375 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6 00376 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7 00377 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS 00378 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW 00379 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL 00380 #define LCD_BUS_SPI_E LCD_BUS_I2C_E 00381 00382 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2 00383 00384 //Force I2C portexpander type 00385 #define PCF8574 1 00386 #define MCP23008 0 00387 #define PCA9538 0 00388 00389 //Inverted Backlight control 00390 #define BACKLIGHT_INV 0 00391 #endif 00392 00393 #if (LCDPLUG==1) 00394 //Definitions for Jeelabs LCD_Plug I2C backpack mapping between serial port expander pins and LCD controller 00395 //This hardware uses an MCP23008 I2C expander. 00396 //Slaveaddress is hardcoded at 0x48. SDA/SCL has no pullup Resistors onboard. 00397 //See http://jeelabs.net/projects/hardware/wiki/lcd_plug 00398 // 00399 //Note: LCD RW pin must be kept LOW 00400 // E2 is available on a plug and so it does support LCD40x4 (second controller) 00401 // BL is used to control backlight 00402 // 00403 00404 //I2C bus expander (MCP23008) interface 00405 #define LCD_BUS_I2C_D4 (1 << 0) 00406 #define LCD_BUS_I2C_D5 (1 << 1) 00407 #define LCD_BUS_I2C_D6 (1 << 2) 00408 #define LCD_BUS_I2C_D7 (1 << 3) 00409 #define LCD_BUS_I2C_RS (1 << 4) 00410 #define LCD_BUS_I2C_E2 (1 << 5) 00411 #define LCD_BUS_I2C_E (1 << 6) 00412 #define LCD_BUS_I2C_BL (1 << 7) 00413 00414 #define LCD_BUS_I2C_RW (1 << 5) 00415 00416 //SPI bus expander (74595) interface, same as I2C 00417 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4 00418 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5 00419 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6 00420 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7 00421 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS 00422 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2 00423 #define LCD_BUS_SPI_E LCD_BUS_I2C_E 00424 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL 00425 00426 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW 00427 00428 //Force I2C portexpander type 00429 #define PCF8574 1 00430 #define MCP23008 0 00431 #define PCA9538 0 00432 00433 //Inverted Backlight control 00434 #define BACKLIGHT_INV 0 00435 #endif 00436 00437 00438 //Bitpattern Defines for I2C PCF8574/PCF8574A, MCP23008 and SPI 74595 Bus expanders 00439 //Don't change! 00440 #define LCD_BUS_I2C_MSK (LCD_BUS_I2C_D4 | LCD_BUS_I2C_D5 | LCD_BUS_I2C_D6 | LCD_BUS_I2C_D7) 00441 #if (BACKLIGHT_INV == 1) 00442 #define LCD_BUS_I2C_DEF (0x00 | LCD_BUS_I2C_BL) 00443 #else 00444 #define LCD_BUS_I2C_DEF 0x00 00445 #endif 00446 00447 #define LCD_BUS_SPI_MSK (LCD_BUS_SPI_D4 | LCD_BUS_SPI_D5 | LCD_BUS_SPI_D6 | LCD_BUS_SPI_D7) 00448 #if (BACKLIGHT_INV == 1) 00449 #define LCD_BUS_SPI_DEF (0x00 | LCD_BUS_SPI_BL) 00450 #else 00451 #define LCD_BUS_SPI_DEF 0x00 00452 #endif 00453 00454 00455 /* PCF8574/PCF8574A I2C portexpander slave address */ 00456 #define PCF8574_SA0 0x40 00457 #define PCF8574_SA1 0x42 00458 #define PCF8574_SA2 0x44 00459 #define PCF8574_SA3 0x46 00460 #define PCF8574_SA4 0x48 00461 #define PCF8574_SA5 0x4A 00462 #define PCF8574_SA6 0x4C 00463 #define PCF8574_SA7 0x4E 00464 00465 #define PCF8574A_SA0 0x70 00466 #define PCF8574A_SA1 0x72 00467 #define PCF8574A_SA2 0x74 00468 #define PCF8574A_SA3 0x76 00469 #define PCF8574A_SA4 0x78 00470 #define PCF8574A_SA5 0x7A 00471 #define PCF8574A_SA6 0x7C 00472 #define PCF8574A_SA7 0x7E 00473 00474 /* MCP23008 I2C portexpander slave address */ 00475 #define MCP23008_SA0 0x40 00476 #define MCP23008_SA1 0x42 00477 #define MCP23008_SA2 0x44 00478 #define MCP23008_SA3 0x46 00479 #define MCP23008_SA4 0x48 00480 #define MCP23008_SA5 0x4A 00481 #define MCP23008_SA6 0x4C 00482 #define MCP23008_SA7 0x4E 00483 00484 /* MCP23008 I2C portexpander internal registers */ 00485 #define IODIR 0x00 00486 #define IPOL 0x01 00487 #define GPINTEN 0x02 00488 #define DEFVAL 0x03 00489 #define INTCON 0x04 00490 #define IOCON 0x05 00491 #define GPPU 0x06 00492 #define INTF 0x07 00493 #define INTCAP 0x08 00494 #define GPIO 0x09 00495 #define OLAT 0x0A 00496 00497 /* PCA9538 I2C portexpander slave address */ 00498 #define PCA9538_SA0 0xE0 00499 #define PCA9538_SA1 0xE2 00500 #define PCA9538_SA2 0xE4 00501 #define PCA9538_SA3 0xE6 00502 00503 /* PCA9538 I2C portexpander internal registers */ 00504 #define PCA_INPUT 0x00 00505 #define PCA_OUTPUT 0x01 00506 #define PCA_POLARITY 0x02 00507 #define PCA_CONFIG 0x03 00508 00509 /* ST7032i I2C slave address */ 00510 #define ST7032_SA 0x7C 00511 00512 /* ST7036i I2C slave address */ 00513 #define ST7036_SA0 0x78 00514 #define ST7036_SA1 0x7A 00515 #define ST7036_SA2 0x7C 00516 #define ST7036_SA3 0x7E 00517 00518 /* ST7066_ACM I2C slave address, Added for ACM1602 module */ 00519 #define ST7066_SA0 0xA0 00520 00521 /* PCF21XX I2C slave address */ 00522 #define PCF21XX_SA0 0x74 00523 #define PCF21XX_SA1 0x76 00524 00525 /* AIP31068 I2C slave address */ 00526 #define AIP31068_SA 0x7C 00527 00528 /* SSD1803 I2C slave address */ 00529 #define SSD1803_SA0 0x78 00530 #define SSD1803_SA1 0x7A 00531 00532 /* US2066/SSD1311 I2C slave address */ 00533 #define US2066_SA0 0x78 00534 #define US2066_SA1 0x7A 00535 00536 /* AC780 I2C slave address */ 00537 #define AC780_SA0 0x78 00538 #define AC780_SA1 0x7A 00539 #define AC780_SA2 0x7C 00540 #define AC780_SA3 0x7E 00541 00542 /* SPLC792A is clone of ST7032i */ 00543 #define SPLC792A_SA0 0x78 00544 #define SPLC792A_SA1 0x7A 00545 #define SPLC792A_SA2 0x7C 00546 #define SPLC792A_SA3 0x7E 00547 00548 //Some native I2C controllers dont support ACK. Set define to '0' to allow code to proceed even without ACK 00549 //#define LCD_I2C_ACK 0 00550 #define LCD_I2C_ACK 1 00551 00552 00553 // Contrast setting, 6 significant bits (only supported for controllers with extended features) 00554 // Voltage Multiplier setting, 2 or 3 significant bits (only supported for controllers with extended features) 00555 #define LCD_DEF_CONTRAST 0x20 00556 00557 //ST7032 EastRising ERC1602FS-4 display 00558 //Contrast setting 6 significant bits (0..63) 00559 //Voltage Multiplier setting 3 significant bits: 00560 // 0: 1.818V 00561 // 1: 2.222V 00562 // 2: 2.667V 00563 // 3: 3.333V 00564 // 4: 3.636V (ST7032 default) 00565 // 5: 4.000V 00566 // 6: 4.444V 00567 // 7: 5.000V 00568 #define LCD_ST7032_CONTRAST 0x28 00569 #define LCD_ST7032_RAB 0x04 00570 00571 //ST7036 EA DOGM1603 display 00572 //Contrast setting 6 significant bits 00573 //Voltage Multiplier setting 3 significant bits 00574 #define LCD_ST7036_CONTRAST 0x28 00575 #define LCD_ST7036_RAB 0x04 00576 00577 //SSD1803 EA DOGM204 display 00578 //Contrast setting 6 significant bits 00579 //Voltage Multiplier setting 3 significant bits 00580 #define LCD_SSD1_CONTRAST 0x28 00581 #define LCD_SSD1_RAB 0x06 00582 00583 //US2066/SSD1311 EastRising ER-OLEDM2002-4 display 00584 //Contrast setting 8 significant bits, use 6 for compatibility 00585 #define LCD_US20_CONTRAST 0x3F 00586 //#define LCD_US20_CONTRAST 0x1F 00587 00588 //PCF2113, PCF2119 display 00589 //Contrast setting 6 significant bits 00590 //Voltage Multiplier setting 2 significant bits 00591 #define LCD_PCF2_CONTRAST 0x20 00592 #define LCD_PCF2_S12 0x02 00593 00594 //PT6314 VFD display 00595 //Contrast setting 2 significant bits, use 6 for compatibility 00596 #define LCD_PT63_CONTRAST 0x3F 00597 00598 //SPLC792A is clone of ST7032i 00599 //Contrast setting 6 significant bits (0..63) 00600 //Voltage Multiplier setting 3 significant bits: 00601 // 0: 1.818V 00602 // 1: 2.222V 00603 // 2: 2.667V 00604 // 3: 3.333V (SPLC792A default) 00605 // 4: 3.636V 00606 // 5: 4.000V 00607 // 6: 4.444V 00608 // 7: 5.000V 00609 #define LCD_SPLC792A_CONTRAST 0x28 00610 #define LCD_SPLC792A_RAB 0x04 00611 00612 #endif //MBED_TEXTLCDCONFIG_H
Generated on Wed Jul 13 2022 05:29:05 by
1.7.2
