Wim Huiskamp / TextLCD

Committer:
wim
Date:
Sun Mar 29 13:08:03 2015 +0000
Revision:
37:ce348c002929
Parent:
36:9f5f86dfd44a
Child:
38:cbe275b0b647
Cleaned up low level command and data write operations to improve speed of I2C expander versions (PCF8574 and MCP23008). Added initial support for controllers with alternative fonttables.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wim 37:ce348c002929 1 /* mbed TextLCD Library, for LCDs based on HD44780 controllers
wim 34:e5a0dcb43ecc 2 * Copyright (c) 2014, WH
wim 34:e5a0dcb43ecc 3 * 2014, v01: WH, Extracted from TextLCD.h as of v14
wim 35:311be6444a39 4 * 2014, v02: WH, Added AC780 support, added I2C expander modules, fixed setBacklight() for inverted logic modules. Fixed bug in LCD_SPI_N define
wim 36:9f5f86dfd44a 5 * 2014, v03: WH, Added LCD_SPI_N_3_8 define for ST7070
wim 37:ce348c002929 6 * 2015, v04: WH, Added support for alternative fonttables (eg PCF21XX)
wim 37:ce348c002929 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
wim 34:e5a0dcb43ecc 8 *
wim 34:e5a0dcb43ecc 9 * Permission is hereby granted, free of charge, to any person obtaining a copy
wim 34:e5a0dcb43ecc 10 * of this software and associated documentation files (the "Software"), to deal
wim 34:e5a0dcb43ecc 11 * in the Software without restriction, including without limitation the rights
wim 34:e5a0dcb43ecc 12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
wim 34:e5a0dcb43ecc 13 * copies of the Software, and to permit persons to whom the Software is
wim 34:e5a0dcb43ecc 14 * furnished to do so, subject to the following conditions:
wim 34:e5a0dcb43ecc 15 *
wim 34:e5a0dcb43ecc 16 * The above copyright notice and this permission notice shall be included in
wim 34:e5a0dcb43ecc 17 * all copies or substantial portions of the Software.
wim 34:e5a0dcb43ecc 18 *
wim 34:e5a0dcb43ecc 19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
wim 34:e5a0dcb43ecc 20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
wim 34:e5a0dcb43ecc 21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
wim 34:e5a0dcb43ecc 22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
wim 34:e5a0dcb43ecc 23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
wim 34:e5a0dcb43ecc 24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
wim 34:e5a0dcb43ecc 25 * THE SOFTWARE.
wim 34:e5a0dcb43ecc 26 */
wim 34:e5a0dcb43ecc 27 #ifndef MBED_TEXTLCDCONFIG_H
wim 34:e5a0dcb43ecc 28 #define MBED_TEXTLCDCONFIG_H
wim 34:e5a0dcb43ecc 29
wim 34:e5a0dcb43ecc 30 //Select hardware interface options to reduce memory footprint (multiple options allowed)
wim 34:e5a0dcb43ecc 31 #define LCD_I2C 1 /* I2C Expander PCF8574/MCP23008 */
wim 34:e5a0dcb43ecc 32 #define LCD_SPI 1 /* SPI Expander SN74595 */
wim 34:e5a0dcb43ecc 33 #define LCD_I2C_N 1 /* Native I2C bus */
wim 35:311be6444a39 34 #define LCD_SPI_N 1 /* Native SPI bus */
wim 36:9f5f86dfd44a 35 #define LCD_SPI_N_3_8 1 /* Native SPI bus */
wim 34:e5a0dcb43ecc 36 #define LCD_SPI_N_3_9 1 /* Native SPI bus */
wim 34:e5a0dcb43ecc 37 #define LCD_SPI_N_3_10 1 /* Native SPI bus */
wim 34:e5a0dcb43ecc 38 #define LCD_SPI_N_3_16 1 /* Native SPI bus */
wim 34:e5a0dcb43ecc 39 #define LCD_SPI_N_3_24 1 /* Native SPI bus */
wim 35:311be6444a39 40
wim 34:e5a0dcb43ecc 41 //Select options to reduce memory footprint (multiple options allowed)
wim 34:e5a0dcb43ecc 42 #define LCD_UDC 1 /* Enable predefined UDC example*/
wim 34:e5a0dcb43ecc 43 #define LCD_PRINTF 1 /* Enable Stream implementation */
wim 34:e5a0dcb43ecc 44
wim 37:ce348c002929 45 //Select option to activate default fonttable or alternatively use conversion for specific controller versions (eg PCF2119C)
wim 37:ce348c002929 46 #define LCD_DEFAULT_FONT 1
wim 37:ce348c002929 47
wim 34:e5a0dcb43ecc 48 //Pin Defines for I2C PCF8574/PCF8574A or MCP23008 and SPI 74595 bus expander interfaces
wim 37:ce348c002929 49 //Different commercially available LCD portexpanders use different wiring conventions.
wim 37:ce348c002929 50 //LCD and serial portexpanders should be wired according to the tables below.
wim 34:e5a0dcb43ecc 51 //
wim 37:ce348c002929 52 //Select Serial Port Expander Hardware module (one option only)
wim 34:e5a0dcb43ecc 53 #define DEFAULT 1
wim 34:e5a0dcb43ecc 54 #define ADAFRUIT 0
wim 34:e5a0dcb43ecc 55 #define DFROBOT 0
wim 35:311be6444a39 56 #define YWROBOT 0
wim 35:311be6444a39 57 #define GYLCD 0
wim 35:311be6444a39 58 #define SYDZ 0
wim 34:e5a0dcb43ecc 59
wim 34:e5a0dcb43ecc 60 #if (DEFAULT==1)
wim 34:e5a0dcb43ecc 61 //Definitions for default (WH) mapping between serial port expander pins and LCD controller
wim 34:e5a0dcb43ecc 62 //This hardware supports the I2C bus expander (PCF8574/PCF8574A or MCP23008) and SPI bus expander (74595) interfaces
wim 34:e5a0dcb43ecc 63 //See https://mbed.org/cookbook/Text-LCD-Enhanced
wim 34:e5a0dcb43ecc 64 //
wim 34:e5a0dcb43ecc 65 //Note: LCD RW pin must be connected to GND
wim 34:e5a0dcb43ecc 66 // E2 is used for LCD40x4 (second controller)
wim 34:e5a0dcb43ecc 67 // BL may be used to control backlight
wim 34:e5a0dcb43ecc 68 #define D_LCD_PIN_D4 0
wim 34:e5a0dcb43ecc 69 #define D_LCD_PIN_D5 1
wim 34:e5a0dcb43ecc 70 #define D_LCD_PIN_D6 2
wim 34:e5a0dcb43ecc 71 #define D_LCD_PIN_D7 3
wim 34:e5a0dcb43ecc 72 #define D_LCD_PIN_RS 4
wim 34:e5a0dcb43ecc 73 #define D_LCD_PIN_E 5
wim 34:e5a0dcb43ecc 74 #define D_LCD_PIN_E2 6
wim 34:e5a0dcb43ecc 75 #define D_LCD_PIN_BL 7
wim 34:e5a0dcb43ecc 76
wim 34:e5a0dcb43ecc 77 #define D_LCD_PIN_RW D_LCD_PIN_E2
wim 34:e5a0dcb43ecc 78
wim 34:e5a0dcb43ecc 79 //Select I2C Portexpander type (one option only)
wim 34:e5a0dcb43ecc 80 #define PCF8574 1
wim 34:e5a0dcb43ecc 81 #define MCP23008 0
wim 35:311be6444a39 82
wim 35:311be6444a39 83 //Inverted Backlight control
wim 35:311be6444a39 84 #define BACKLIGHT_INV 0
wim 34:e5a0dcb43ecc 85 #endif
wim 34:e5a0dcb43ecc 86
wim 34:e5a0dcb43ecc 87 #if (ADAFRUIT==1)
wim 34:e5a0dcb43ecc 88 //Definitions for Adafruit i2cspilcdbackpack mapping between serial port expander pins and LCD controller
wim 34:e5a0dcb43ecc 89 //This hardware supports both an I2C expander (MCP23008) and an SPI expander (74595) selectable by a jumper.
wim 35:311be6444a39 90 //Slaveaddress may be set by solderbridges (default 0x40). SDA/SCL has pullup Resistors onboard.
wim 34:e5a0dcb43ecc 91 //See http://www.ladyada.net/products/i2cspilcdbackpack
wim 34:e5a0dcb43ecc 92 //
wim 34:e5a0dcb43ecc 93 //Note: LCD RW pin must be kept LOW
wim 34:e5a0dcb43ecc 94 // E2 is not available on this hardware and so it does not support LCD40x4 (second controller)
wim 34:e5a0dcb43ecc 95 // BL is used to control backlight
wim 34:e5a0dcb43ecc 96 #define D_LCD_PIN_0 0
wim 34:e5a0dcb43ecc 97 #define D_LCD_PIN_RS 1
wim 34:e5a0dcb43ecc 98 #define D_LCD_PIN_E 2
wim 34:e5a0dcb43ecc 99 #define D_LCD_PIN_D4 3
wim 34:e5a0dcb43ecc 100 #define D_LCD_PIN_D5 4
wim 34:e5a0dcb43ecc 101 #define D_LCD_PIN_D6 5
wim 34:e5a0dcb43ecc 102 #define D_LCD_PIN_D7 6
wim 34:e5a0dcb43ecc 103 #define D_LCD_PIN_BL 7
wim 34:e5a0dcb43ecc 104
wim 34:e5a0dcb43ecc 105 #define D_LCD_PIN_E2 D_LCD_PIN_0
wim 34:e5a0dcb43ecc 106
wim 34:e5a0dcb43ecc 107 //Force I2C portexpander type
wim 34:e5a0dcb43ecc 108 #define PCF8574 0
wim 34:e5a0dcb43ecc 109 #define MCP23008 1
wim 35:311be6444a39 110
wim 35:311be6444a39 111 //Inverted Backlight control
wim 35:311be6444a39 112 #define BACKLIGHT_INV 0
wim 34:e5a0dcb43ecc 113 #endif
wim 34:e5a0dcb43ecc 114
wim 34:e5a0dcb43ecc 115 #if (DFROBOT==1)
wim 34:e5a0dcb43ecc 116 //Definitions for DFROBOT LCD2004 Module mapping between serial port expander pins and LCD controller
wim 34:e5a0dcb43ecc 117 //This hardware uses PCF8574 and is different from earlier/different Arduino I2C LCD displays
wim 35:311be6444a39 118 //Slaveaddress hardwired to 0x4E. SDA/SCL has pullup Resistors onboard.
wim 35:311be6444a39 119 //See http://arduino-info.wikispaces.com/LCD-Blue-I2C
wim 35:311be6444a39 120 //
wim 35:311be6444a39 121 //Definitions for DFROBOT V1.1
wim 35:311be6444a39 122 //This hardware uses PCF8574. Slaveaddress may be set by jumpers (default 0x40).
wim 35:311be6444a39 123 //SDA/SCL has pullup Resistors onboard and features a voltage level converter 3V3 <-> 5V.
wim 35:311be6444a39 124 //See http://www.dfrobot.com/index.php?route=product/product&product_id=135
wim 35:311be6444a39 125 //
wim 35:311be6444a39 126 //
wim 35:311be6444a39 127 //Note: LCD RW pin must be kept LOW
wim 35:311be6444a39 128 // E2 is not available on default Arduino hardware and so it does not support LCD40x4 (second controller)
wim 35:311be6444a39 129 // BL is used to control backlight
wim 35:311be6444a39 130 #define D_LCD_PIN_RS 0
wim 35:311be6444a39 131 #define D_LCD_PIN_RW 1
wim 35:311be6444a39 132 #define D_LCD_PIN_E 2
wim 35:311be6444a39 133 #define D_LCD_PIN_BL 3
wim 35:311be6444a39 134 #define D_LCD_PIN_D4 4
wim 35:311be6444a39 135 #define D_LCD_PIN_D5 5
wim 35:311be6444a39 136 #define D_LCD_PIN_D6 6
wim 35:311be6444a39 137 #define D_LCD_PIN_D7 7
wim 35:311be6444a39 138
wim 35:311be6444a39 139 #define D_LCD_PIN_E2 D_LCD_PIN_RW
wim 35:311be6444a39 140
wim 35:311be6444a39 141 //Force I2C portexpander type
wim 35:311be6444a39 142 #define PCF8574 1
wim 35:311be6444a39 143 #define MCP23008 0
wim 35:311be6444a39 144
wim 35:311be6444a39 145 //Inverted Backlight control
wim 35:311be6444a39 146 #define BACKLIGHT_INV 0
wim 35:311be6444a39 147 #endif
wim 35:311be6444a39 148
wim 35:311be6444a39 149 #if (YWROBOT==1)
wim 35:311be6444a39 150 //Definitions for YWROBOT LCM1602 V1 Module mapping between serial port expander pins and LCD controller.
wim 35:311be6444a39 151 //Very similar to DFROBOT. This hardware uses PCF8574.
wim 35:311be6444a39 152 //Slaveaddress may be set by solderbridges (default 0x4E). SDA/SCL has no pullup Resistors onboard.
wim 34:e5a0dcb43ecc 153 //See http://arduino-info.wikispaces.com/LCD-Blue-I2C
wim 34:e5a0dcb43ecc 154 //
wim 34:e5a0dcb43ecc 155 //Note: LCD RW pin must be kept LOW
wim 35:311be6444a39 156 // E2 is not available on default hardware and so it does not support LCD40x4 (second controller)
wim 34:e5a0dcb43ecc 157 // BL is used to control backlight, reverse logic: Low turns on Backlight. This is handled in setBacklight()
wim 34:e5a0dcb43ecc 158 #define D_LCD_PIN_RS 0
wim 34:e5a0dcb43ecc 159 #define D_LCD_PIN_RW 1
wim 34:e5a0dcb43ecc 160 #define D_LCD_PIN_E 2
wim 34:e5a0dcb43ecc 161 #define D_LCD_PIN_BL 3
wim 34:e5a0dcb43ecc 162 #define D_LCD_PIN_D4 4
wim 34:e5a0dcb43ecc 163 #define D_LCD_PIN_D5 5
wim 34:e5a0dcb43ecc 164 #define D_LCD_PIN_D6 6
wim 34:e5a0dcb43ecc 165 #define D_LCD_PIN_D7 7
wim 34:e5a0dcb43ecc 166
wim 34:e5a0dcb43ecc 167 #define D_LCD_PIN_E2 D_LCD_PIN_RW
wim 34:e5a0dcb43ecc 168
wim 34:e5a0dcb43ecc 169 //Force I2C portexpander type
wim 34:e5a0dcb43ecc 170 #define PCF8574 1
wim 34:e5a0dcb43ecc 171 #define MCP23008 0
wim 35:311be6444a39 172
wim 35:311be6444a39 173 //Inverted Backlight control
wim 35:311be6444a39 174 #define BACKLIGHT_INV 0
wim 34:e5a0dcb43ecc 175 #endif
wim 34:e5a0dcb43ecc 176
wim 35:311be6444a39 177 #if (GYLCD==1)
wim 35:311be6444a39 178 //Definitions for Arduino-IIC-LCD GY-LCD-V1 Module mapping between serial port expander pins and LCD controller.
wim 35:311be6444a39 179 //Very similar to DFROBOT. This hardware uses PCF8574.
wim 35:311be6444a39 180 //Slaveaddress may be set by solderbridges (default 0x4E). SDA/SCL has pullup Resistors onboard.
wim 35:311be6444a39 181 //See http://arduino-info.wikispaces.com/LCD-Blue-I2C
wim 35:311be6444a39 182 //
wim 35:311be6444a39 183 //Note: LCD RW pin must be kept LOW
wim 35:311be6444a39 184 // E2 is not available on default hardware and so it does not support LCD40x4 (second controller)
wim 35:311be6444a39 185 // BL is used to control backlight, reverse logic: Low turns on Backlight. This is handled in setBacklight()
wim 35:311be6444a39 186 #define D_LCD_PIN_D4 0
wim 35:311be6444a39 187 #define D_LCD_PIN_D5 1
wim 35:311be6444a39 188 #define D_LCD_PIN_D6 2
wim 35:311be6444a39 189 #define D_LCD_PIN_D7 3
wim 35:311be6444a39 190 #define D_LCD_PIN_EN 4
wim 35:311be6444a39 191 #define D_LCD_PIN_RW 5
wim 35:311be6444a39 192 #define D_LCD_PIN_RS 6
wim 35:311be6444a39 193 #define D_LCD_PIN_BL 7
wim 35:311be6444a39 194
wim 35:311be6444a39 195 #define D_LCD_PIN_E2 D_LCD_PIN_RW
wim 35:311be6444a39 196
wim 35:311be6444a39 197 //Force I2C portexpander type
wim 35:311be6444a39 198 #define PCF8574 1
wim 35:311be6444a39 199 #define MCP23008 0
wim 35:311be6444a39 200
wim 35:311be6444a39 201 //Force Inverted Backlight control
wim 35:311be6444a39 202 #define BACKLIGHT_INV 1
wim 35:311be6444a39 203 #endif
wim 35:311be6444a39 204
wim 35:311be6444a39 205 #if (SYDZ==1)
wim 35:311be6444a39 206 //Definitions for SYDZ Module mapping between serial port expander pins and LCD controller.
wim 35:311be6444a39 207 //Very similar to DFROBOT. This hardware uses PCF8574A and uses inverted Backlight control
wim 35:311be6444a39 208 //Slaveaddress may be set by switches (default 0x40). SDA/SCL has pullup Resistors onboard.
wim 35:311be6444a39 209 //See ebay
wim 35:311be6444a39 210 //
wim 35:311be6444a39 211 //Note: LCD RW pin must be kept LOW
wim 35:311be6444a39 212 // E2 is not available on default hardware and so it does not support LCD40x4 (second controller)
wim 35:311be6444a39 213 // BL is used to control backlight, reverse logic: Low turns on Backlight. This is handled in setBacklight()
wim 35:311be6444a39 214 #define D_LCD_PIN_RS 0
wim 35:311be6444a39 215 #define D_LCD_PIN_RW 1
wim 35:311be6444a39 216 #define D_LCD_PIN_E 2
wim 35:311be6444a39 217 #define D_LCD_PIN_BL 3
wim 35:311be6444a39 218 #define D_LCD_PIN_D4 4
wim 35:311be6444a39 219 #define D_LCD_PIN_D5 5
wim 35:311be6444a39 220 #define D_LCD_PIN_D6 6
wim 35:311be6444a39 221 #define D_LCD_PIN_D7 7
wim 35:311be6444a39 222
wim 35:311be6444a39 223 #define D_LCD_PIN_E2 D_LCD_PIN_RW
wim 35:311be6444a39 224
wim 35:311be6444a39 225 //Force I2C portexpander type
wim 35:311be6444a39 226 #define PCF8574 1
wim 35:311be6444a39 227 #define MCP23008 0
wim 35:311be6444a39 228
wim 35:311be6444a39 229 //Force Inverted Backlight control
wim 35:311be6444a39 230 #define BACKLIGHT_INV 1
wim 35:311be6444a39 231 #endif
wim 34:e5a0dcb43ecc 232
wim 34:e5a0dcb43ecc 233 //Bitpattern Defines for I2C PCF8574/PCF8574A, MCP23008 and SPI 74595 Bus expanders
wim 37:ce348c002929 234 //Don't change!
wim 34:e5a0dcb43ecc 235 //
wim 34:e5a0dcb43ecc 236 #define D_LCD_D4 (1<<D_LCD_PIN_D4)
wim 34:e5a0dcb43ecc 237 #define D_LCD_D5 (1<<D_LCD_PIN_D5)
wim 34:e5a0dcb43ecc 238 #define D_LCD_D6 (1<<D_LCD_PIN_D6)
wim 34:e5a0dcb43ecc 239 #define D_LCD_D7 (1<<D_LCD_PIN_D7)
wim 34:e5a0dcb43ecc 240 #define D_LCD_RS (1<<D_LCD_PIN_RS)
wim 34:e5a0dcb43ecc 241 #define D_LCD_E (1<<D_LCD_PIN_E)
wim 34:e5a0dcb43ecc 242 #define D_LCD_E2 (1<<D_LCD_PIN_E2)
wim 34:e5a0dcb43ecc 243 #define D_LCD_BL (1<<D_LCD_PIN_BL)
wim 34:e5a0dcb43ecc 244 //#define D_LCD_RW (1<<D_LCD_PIN_RW)
wim 34:e5a0dcb43ecc 245
wim 34:e5a0dcb43ecc 246 #define D_LCD_BUS_MSK (D_LCD_D4 | D_LCD_D5 | D_LCD_D6 | D_LCD_D7)
wim 34:e5a0dcb43ecc 247 #define D_LCD_BUS_DEF 0x00
wim 34:e5a0dcb43ecc 248
wim 34:e5a0dcb43ecc 249 /* PCF8574/PCF8574A I2C portexpander slave address */
wim 34:e5a0dcb43ecc 250 #define PCF8574_SA0 0x40
wim 34:e5a0dcb43ecc 251 #define PCF8574_SA1 0x42
wim 34:e5a0dcb43ecc 252 #define PCF8574_SA2 0x44
wim 34:e5a0dcb43ecc 253 #define PCF8574_SA3 0x46
wim 34:e5a0dcb43ecc 254 #define PCF8574_SA4 0x48
wim 34:e5a0dcb43ecc 255 #define PCF8574_SA5 0x4A
wim 34:e5a0dcb43ecc 256 #define PCF8574_SA6 0x4C
wim 34:e5a0dcb43ecc 257 #define PCF8574_SA7 0x4E
wim 34:e5a0dcb43ecc 258
wim 34:e5a0dcb43ecc 259 #define PCF8574A_SA0 0x70
wim 34:e5a0dcb43ecc 260 #define PCF8574A_SA1 0x72
wim 34:e5a0dcb43ecc 261 #define PCF8574A_SA2 0x74
wim 34:e5a0dcb43ecc 262 #define PCF8574A_SA3 0x76
wim 34:e5a0dcb43ecc 263 #define PCF8574A_SA4 0x78
wim 34:e5a0dcb43ecc 264 #define PCF8574A_SA5 0x7A
wim 34:e5a0dcb43ecc 265 #define PCF8574A_SA6 0x7C
wim 34:e5a0dcb43ecc 266 #define PCF8574A_SA7 0x7E
wim 34:e5a0dcb43ecc 267
wim 34:e5a0dcb43ecc 268 /* MCP23008 I2C portexpander slave address */
wim 34:e5a0dcb43ecc 269 #define MCP23008_SA0 0x40
wim 34:e5a0dcb43ecc 270 #define MCP23008_SA1 0x42
wim 34:e5a0dcb43ecc 271 #define MCP23008_SA2 0x44
wim 34:e5a0dcb43ecc 272 #define MCP23008_SA3 0x46
wim 34:e5a0dcb43ecc 273 #define MCP23008_SA4 0x48
wim 34:e5a0dcb43ecc 274 #define MCP23008_SA5 0x4A
wim 34:e5a0dcb43ecc 275 #define MCP23008_SA6 0x4C
wim 34:e5a0dcb43ecc 276 #define MCP23008_SA7 0x4E
wim 34:e5a0dcb43ecc 277
wim 34:e5a0dcb43ecc 278 /* MCP23008 I2C portexpander internal registers */
wim 34:e5a0dcb43ecc 279 #define IODIR 0x00
wim 34:e5a0dcb43ecc 280 #define IPOL 0x01
wim 34:e5a0dcb43ecc 281 #define GPINTEN 0x02
wim 34:e5a0dcb43ecc 282 #define DEFVAL 0x03
wim 34:e5a0dcb43ecc 283 #define INTCON 0x04
wim 34:e5a0dcb43ecc 284 #define IOCON 0x05
wim 34:e5a0dcb43ecc 285 #define GPPU 0x06
wim 34:e5a0dcb43ecc 286 #define INTF 0x07
wim 34:e5a0dcb43ecc 287 #define INTCAP 0x08
wim 34:e5a0dcb43ecc 288 #define GPIO 0x09
wim 34:e5a0dcb43ecc 289 #define OLAT 0x0A
wim 34:e5a0dcb43ecc 290
wim 34:e5a0dcb43ecc 291 /* ST7032i I2C slave address */
wim 34:e5a0dcb43ecc 292 #define ST7032_SA 0x7C
wim 34:e5a0dcb43ecc 293
wim 34:e5a0dcb43ecc 294 /* ST7036i I2C slave address */
wim 34:e5a0dcb43ecc 295 #define ST7036_SA0 0x78
wim 34:e5a0dcb43ecc 296 #define ST7036_SA1 0x7A
wim 34:e5a0dcb43ecc 297 #define ST7036_SA2 0x7C
wim 34:e5a0dcb43ecc 298 #define ST7036_SA3 0x7E
wim 34:e5a0dcb43ecc 299
wim 37:ce348c002929 300 /* ST7066_ACM I2C slave address, Added for ACM1602 module */
wim 37:ce348c002929 301 #define ST7066_SA0 0xA0
wim 37:ce348c002929 302
wim 34:e5a0dcb43ecc 303 /* PCF21XX I2C slave address */
wim 34:e5a0dcb43ecc 304 #define PCF21XX_SA0 0x74
wim 34:e5a0dcb43ecc 305 #define PCF21XX_SA1 0x76
wim 34:e5a0dcb43ecc 306
wim 34:e5a0dcb43ecc 307 /* AIP31068 I2C slave address */
wim 34:e5a0dcb43ecc 308 #define AIP31068_SA 0x7C
wim 34:e5a0dcb43ecc 309
wim 34:e5a0dcb43ecc 310 /* SSD1803 I2C slave address */
wim 34:e5a0dcb43ecc 311 #define SSD1803_SA0 0x78
wim 34:e5a0dcb43ecc 312 #define SSD1803_SA1 0x7A
wim 34:e5a0dcb43ecc 313
wim 34:e5a0dcb43ecc 314 /* US2066/SSD1311 I2C slave address */
wim 34:e5a0dcb43ecc 315 #define US2066_SA0 0x78
wim 34:e5a0dcb43ecc 316 #define US2066_SA1 0x7A
wim 34:e5a0dcb43ecc 317
wim 34:e5a0dcb43ecc 318 /* AC780 I2C slave address */
wim 34:e5a0dcb43ecc 319 #define AC780_SA0 0x78
wim 34:e5a0dcb43ecc 320 #define AC780_SA1 0x7A
wim 34:e5a0dcb43ecc 321 #define AC780_SA2 0x7C
wim 34:e5a0dcb43ecc 322 #define AC780_SA3 0x7E
wim 34:e5a0dcb43ecc 323
wim 34:e5a0dcb43ecc 324 //Some native I2C controllers dont support ACK. Set define to '0' to allow code to proceed even without ACK
wim 34:e5a0dcb43ecc 325 //#define LCD_I2C_ACK 0
wim 34:e5a0dcb43ecc 326 #define LCD_I2C_ACK 1
wim 34:e5a0dcb43ecc 327
wim 34:e5a0dcb43ecc 328
wim 34:e5a0dcb43ecc 329 // Contrast setting, 6 significant bits (only supported for controllers with extended features)
wim 34:e5a0dcb43ecc 330 // Voltage Multiplier setting, 2 or 3 significant bits (only supported for controllers with extended features)
wim 34:e5a0dcb43ecc 331 #define LCD_DEF_CONTRAST 0x20
wim 34:e5a0dcb43ecc 332
wim 34:e5a0dcb43ecc 333 //ST7032 EastRising ERC1602FS-4 display
wim 34:e5a0dcb43ecc 334 //Contrast setting 6 significant bits
wim 34:e5a0dcb43ecc 335 //Voltage Multiplier setting 3 significant bits
wim 37:ce348c002929 336 #define LCD_ST7032_CONTRAST 0x28
wim 34:e5a0dcb43ecc 337 #define LCD_ST7032_RAB 0x04
wim 34:e5a0dcb43ecc 338
wim 34:e5a0dcb43ecc 339 //ST7036 EA DOGM1603 display
wim 34:e5a0dcb43ecc 340 //Contrast setting 6 significant bits
wim 34:e5a0dcb43ecc 341 //Voltage Multiplier setting 3 significant bits
wim 34:e5a0dcb43ecc 342 #define LCD_ST7036_CONTRAST 0x28
wim 34:e5a0dcb43ecc 343 #define LCD_ST7036_RAB 0x04
wim 34:e5a0dcb43ecc 344
wim 34:e5a0dcb43ecc 345 //SSD1803 EA DOGM204 display
wim 34:e5a0dcb43ecc 346 //Contrast setting 6 significant bits
wim 34:e5a0dcb43ecc 347 //Voltage Multiplier setting 3 significant bits
wim 34:e5a0dcb43ecc 348 #define LCD_SSD1_CONTRAST 0x28
wim 34:e5a0dcb43ecc 349 #define LCD_SSD1_RAB 0x06
wim 34:e5a0dcb43ecc 350
wim 34:e5a0dcb43ecc 351 //US2066/SSD1311 EastRising ER-OLEDM2002-4 display
wim 34:e5a0dcb43ecc 352 //Contrast setting 8 significant bits, use 6 for compatibility
wim 34:e5a0dcb43ecc 353 #define LCD_US20_CONTRAST 0x3F
wim 34:e5a0dcb43ecc 354 //#define LCD_US20_CONTRAST 0x1F
wim 34:e5a0dcb43ecc 355
wim 34:e5a0dcb43ecc 356 //PCF2113, PCF2119 display
wim 34:e5a0dcb43ecc 357 //Contrast setting 6 significant bits
wim 34:e5a0dcb43ecc 358 //Voltage Multiplier setting 2 significant bits
wim 34:e5a0dcb43ecc 359 #define LCD_PCF2_CONTRAST 0x20
wim 34:e5a0dcb43ecc 360 #define LCD_PCF2_S12 0x02
wim 34:e5a0dcb43ecc 361
wim 34:e5a0dcb43ecc 362 //PT6314 VFD display
wim 34:e5a0dcb43ecc 363 //Contrast setting 2 significant bits, use 6 for compatibility
wim 34:e5a0dcb43ecc 364 #define LCD_PT63_CONTRAST 0x3F
wim 34:e5a0dcb43ecc 365
wim 34:e5a0dcb43ecc 366
wim 34:e5a0dcb43ecc 367 #endif //MBED_TEXTLCDCONFIG_H