Addition Support for Arduino I2C based on PCF8574A

Fork of TextLCD by Wim Huiskamp

Committer:
Antulius
Date:
Thu Sep 20 06:17:44 2018 +0000
Revision:
43:067e07b6f5b8
Parent:
42:c1862c9160b4
TextLCD con soporte para el M?dulo Arduino I2C basado en PCF8574AT y para el SPI utilizando el SN74595

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)
Antulius 42:c1862c9160b4 53 #define DEFAULT 0
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
Antulius 42:c1862c9160b4 59 #define ARDUINO 1
Antulius 42:c1862c9160b4 60
Antulius 42:c1862c9160b4 61 #if (ARDUINO==1)
Antulius 42:c1862c9160b4 62 //Definitions for Arduino I2C PCF8574 mapping port expander pins and LCD controller
Antulius 42:c1862c9160b4 63 //This hardware supports the I2C bus expander (PCF8574/PCF8574A or MCP23008) and SPI bus expander (74595) interfaces
Antulius 42:c1862c9160b4 64 //See https://mbed.org/cookbook/Text-LCD-Enhanced
Antulius 42:c1862c9160b4 65 //
Antulius 42:c1862c9160b4 66 //Note: LCD RW pin must be connected to GND
Antulius 42:c1862c9160b4 67 // E2 is used for LCD40x4 (second controller)
Antulius 42:c1862c9160b4 68 // BL may be used to control backlight
Antulius 42:c1862c9160b4 69
Antulius 42:c1862c9160b4 70 #define D_LCD_PIN_RS 0
Antulius 42:c1862c9160b4 71 #define D_LCD_PIN_E2 1
Antulius 42:c1862c9160b4 72 #define D_LCD_PIN_E 2
Antulius 42:c1862c9160b4 73 #define D_LCD_PIN_BL 3
Antulius 42:c1862c9160b4 74 #define D_LCD_PIN_D4 4
Antulius 42:c1862c9160b4 75 #define D_LCD_PIN_D5 5
Antulius 42:c1862c9160b4 76 #define D_LCD_PIN_D6 6
Antulius 42:c1862c9160b4 77 #define D_LCD_PIN_D7 7
Antulius 42:c1862c9160b4 78
Antulius 42:c1862c9160b4 79 #define D_LCD_PIN_RW D_LCD_PIN_E2
Antulius 42:c1862c9160b4 80
Antulius 42:c1862c9160b4 81 //Select I2C Portexpander type (one option only)
Antulius 43:067e07b6f5b8 82 #define PCF8574 0
Antulius 42:c1862c9160b4 83 #define MCP23008 0
Antulius 43:067e07b6f5b8 84 #define SN74595 1
Antulius 42:c1862c9160b4 85
Antulius 42:c1862c9160b4 86 //Inverted Backlight control
Antulius 42:c1862c9160b4 87 #define BACKLIGHT_INV 0
Antulius 42:c1862c9160b4 88 #endif
Antulius 42:c1862c9160b4 89
wim 34:e5a0dcb43ecc 90
wim 34:e5a0dcb43ecc 91 #if (DEFAULT==1)
wim 34:e5a0dcb43ecc 92 //Definitions for default (WH) mapping between serial port expander pins and LCD controller
wim 34:e5a0dcb43ecc 93 //This hardware supports the I2C bus expander (PCF8574/PCF8574A or MCP23008) and SPI bus expander (74595) interfaces
wim 34:e5a0dcb43ecc 94 //See https://mbed.org/cookbook/Text-LCD-Enhanced
wim 34:e5a0dcb43ecc 95 //
wim 34:e5a0dcb43ecc 96 //Note: LCD RW pin must be connected to GND
wim 34:e5a0dcb43ecc 97 // E2 is used for LCD40x4 (second controller)
wim 34:e5a0dcb43ecc 98 // BL may be used to control backlight
wim 34:e5a0dcb43ecc 99 #define D_LCD_PIN_D4 0
wim 34:e5a0dcb43ecc 100 #define D_LCD_PIN_D5 1
wim 34:e5a0dcb43ecc 101 #define D_LCD_PIN_D6 2
wim 34:e5a0dcb43ecc 102 #define D_LCD_PIN_D7 3
wim 34:e5a0dcb43ecc 103 #define D_LCD_PIN_RS 4
wim 34:e5a0dcb43ecc 104 #define D_LCD_PIN_E 5
wim 34:e5a0dcb43ecc 105 #define D_LCD_PIN_E2 6
wim 34:e5a0dcb43ecc 106 #define D_LCD_PIN_BL 7
wim 34:e5a0dcb43ecc 107
wim 34:e5a0dcb43ecc 108 #define D_LCD_PIN_RW D_LCD_PIN_E2
wim 34:e5a0dcb43ecc 109
wim 34:e5a0dcb43ecc 110 //Select I2C Portexpander type (one option only)
wim 34:e5a0dcb43ecc 111 #define PCF8574 1
wim 34:e5a0dcb43ecc 112 #define MCP23008 0
wim 35:311be6444a39 113
wim 35:311be6444a39 114 //Inverted Backlight control
wim 35:311be6444a39 115 #define BACKLIGHT_INV 0
wim 34:e5a0dcb43ecc 116 #endif
wim 34:e5a0dcb43ecc 117
wim 34:e5a0dcb43ecc 118 #if (ADAFRUIT==1)
wim 34:e5a0dcb43ecc 119 //Definitions for Adafruit i2cspilcdbackpack mapping between serial port expander pins and LCD controller
wim 34:e5a0dcb43ecc 120 //This hardware supports both an I2C expander (MCP23008) and an SPI expander (74595) selectable by a jumper.
wim 35:311be6444a39 121 //Slaveaddress may be set by solderbridges (default 0x40). SDA/SCL has pullup Resistors onboard.
wim 34:e5a0dcb43ecc 122 //See http://www.ladyada.net/products/i2cspilcdbackpack
wim 34:e5a0dcb43ecc 123 //
wim 34:e5a0dcb43ecc 124 //Note: LCD RW pin must be kept LOW
wim 34:e5a0dcb43ecc 125 // E2 is not available on this hardware and so it does not support LCD40x4 (second controller)
wim 34:e5a0dcb43ecc 126 // BL is used to control backlight
wim 34:e5a0dcb43ecc 127 #define D_LCD_PIN_0 0
wim 34:e5a0dcb43ecc 128 #define D_LCD_PIN_RS 1
wim 34:e5a0dcb43ecc 129 #define D_LCD_PIN_E 2
wim 34:e5a0dcb43ecc 130 #define D_LCD_PIN_D4 3
wim 34:e5a0dcb43ecc 131 #define D_LCD_PIN_D5 4
wim 34:e5a0dcb43ecc 132 #define D_LCD_PIN_D6 5
wim 34:e5a0dcb43ecc 133 #define D_LCD_PIN_D7 6
wim 34:e5a0dcb43ecc 134 #define D_LCD_PIN_BL 7
wim 34:e5a0dcb43ecc 135
wim 34:e5a0dcb43ecc 136 #define D_LCD_PIN_E2 D_LCD_PIN_0
wim 34:e5a0dcb43ecc 137
wim 34:e5a0dcb43ecc 138 //Force I2C portexpander type
wim 34:e5a0dcb43ecc 139 #define PCF8574 0
wim 34:e5a0dcb43ecc 140 #define MCP23008 1
wim 35:311be6444a39 141
wim 35:311be6444a39 142 //Inverted Backlight control
wim 35:311be6444a39 143 #define BACKLIGHT_INV 0
wim 34:e5a0dcb43ecc 144 #endif
wim 34:e5a0dcb43ecc 145
wim 34:e5a0dcb43ecc 146 #if (DFROBOT==1)
wim 34:e5a0dcb43ecc 147 //Definitions for DFROBOT LCD2004 Module mapping between serial port expander pins and LCD controller
wim 34:e5a0dcb43ecc 148 //This hardware uses PCF8574 and is different from earlier/different Arduino I2C LCD displays
wim 35:311be6444a39 149 //Slaveaddress hardwired to 0x4E. SDA/SCL has pullup Resistors onboard.
wim 35:311be6444a39 150 //See http://arduino-info.wikispaces.com/LCD-Blue-I2C
wim 35:311be6444a39 151 //
wim 35:311be6444a39 152 //Definitions for DFROBOT V1.1
wim 35:311be6444a39 153 //This hardware uses PCF8574. Slaveaddress may be set by jumpers (default 0x40).
wim 35:311be6444a39 154 //SDA/SCL has pullup Resistors onboard and features a voltage level converter 3V3 <-> 5V.
wim 35:311be6444a39 155 //See http://www.dfrobot.com/index.php?route=product/product&product_id=135
wim 35:311be6444a39 156 //
wim 35:311be6444a39 157 //
wim 35:311be6444a39 158 //Note: LCD RW pin must be kept LOW
wim 35:311be6444a39 159 // E2 is not available on default Arduino hardware and so it does not support LCD40x4 (second controller)
wim 35:311be6444a39 160 // BL is used to control backlight
wim 35:311be6444a39 161 #define D_LCD_PIN_RS 0
wim 35:311be6444a39 162 #define D_LCD_PIN_RW 1
wim 35:311be6444a39 163 #define D_LCD_PIN_E 2
wim 35:311be6444a39 164 #define D_LCD_PIN_BL 3
wim 35:311be6444a39 165 #define D_LCD_PIN_D4 4
wim 35:311be6444a39 166 #define D_LCD_PIN_D5 5
wim 35:311be6444a39 167 #define D_LCD_PIN_D6 6
wim 35:311be6444a39 168 #define D_LCD_PIN_D7 7
wim 35:311be6444a39 169
wim 35:311be6444a39 170 #define D_LCD_PIN_E2 D_LCD_PIN_RW
wim 35:311be6444a39 171
wim 35:311be6444a39 172 //Force I2C portexpander type
wim 35:311be6444a39 173 #define PCF8574 1
wim 35:311be6444a39 174 #define MCP23008 0
wim 35:311be6444a39 175
wim 35:311be6444a39 176 //Inverted Backlight control
wim 35:311be6444a39 177 #define BACKLIGHT_INV 0
wim 35:311be6444a39 178 #endif
wim 35:311be6444a39 179
wim 35:311be6444a39 180 #if (YWROBOT==1)
wim 35:311be6444a39 181 //Definitions for YWROBOT LCM1602 V1 Module mapping between serial port expander pins and LCD controller.
wim 35:311be6444a39 182 //Very similar to DFROBOT. This hardware uses PCF8574.
wim 35:311be6444a39 183 //Slaveaddress may be set by solderbridges (default 0x4E). SDA/SCL has no pullup Resistors onboard.
wim 34:e5a0dcb43ecc 184 //See http://arduino-info.wikispaces.com/LCD-Blue-I2C
wim 34:e5a0dcb43ecc 185 //
wim 34:e5a0dcb43ecc 186 //Note: LCD RW pin must be kept LOW
wim 35:311be6444a39 187 // E2 is not available on default hardware and so it does not support LCD40x4 (second controller)
wim 34:e5a0dcb43ecc 188 // BL is used to control backlight, reverse logic: Low turns on Backlight. This is handled in setBacklight()
wim 34:e5a0dcb43ecc 189 #define D_LCD_PIN_RS 0
wim 34:e5a0dcb43ecc 190 #define D_LCD_PIN_RW 1
wim 34:e5a0dcb43ecc 191 #define D_LCD_PIN_E 2
wim 34:e5a0dcb43ecc 192 #define D_LCD_PIN_BL 3
wim 34:e5a0dcb43ecc 193 #define D_LCD_PIN_D4 4
wim 34:e5a0dcb43ecc 194 #define D_LCD_PIN_D5 5
wim 34:e5a0dcb43ecc 195 #define D_LCD_PIN_D6 6
wim 34:e5a0dcb43ecc 196 #define D_LCD_PIN_D7 7
wim 34:e5a0dcb43ecc 197
wim 34:e5a0dcb43ecc 198 #define D_LCD_PIN_E2 D_LCD_PIN_RW
wim 34:e5a0dcb43ecc 199
wim 34:e5a0dcb43ecc 200 //Force I2C portexpander type
wim 34:e5a0dcb43ecc 201 #define PCF8574 1
wim 34:e5a0dcb43ecc 202 #define MCP23008 0
wim 35:311be6444a39 203
wim 35:311be6444a39 204 //Inverted Backlight control
wim 35:311be6444a39 205 #define BACKLIGHT_INV 0
wim 34:e5a0dcb43ecc 206 #endif
wim 34:e5a0dcb43ecc 207
wim 35:311be6444a39 208 #if (GYLCD==1)
wim 35:311be6444a39 209 //Definitions for Arduino-IIC-LCD GY-LCD-V1 Module mapping between serial port expander pins and LCD controller.
wim 35:311be6444a39 210 //Very similar to DFROBOT. This hardware uses PCF8574.
wim 35:311be6444a39 211 //Slaveaddress may be set by solderbridges (default 0x4E). SDA/SCL has pullup Resistors onboard.
wim 35:311be6444a39 212 //See http://arduino-info.wikispaces.com/LCD-Blue-I2C
wim 35:311be6444a39 213 //
wim 35:311be6444a39 214 //Note: LCD RW pin must be kept LOW
wim 35:311be6444a39 215 // E2 is not available on default hardware and so it does not support LCD40x4 (second controller)
wim 35:311be6444a39 216 // BL is used to control backlight, reverse logic: Low turns on Backlight. This is handled in setBacklight()
wim 35:311be6444a39 217 #define D_LCD_PIN_D4 0
wim 35:311be6444a39 218 #define D_LCD_PIN_D5 1
wim 35:311be6444a39 219 #define D_LCD_PIN_D6 2
wim 35:311be6444a39 220 #define D_LCD_PIN_D7 3
wim 35:311be6444a39 221 #define D_LCD_PIN_EN 4
wim 35:311be6444a39 222 #define D_LCD_PIN_RW 5
wim 35:311be6444a39 223 #define D_LCD_PIN_RS 6
wim 35:311be6444a39 224 #define D_LCD_PIN_BL 7
wim 35:311be6444a39 225
wim 35:311be6444a39 226 #define D_LCD_PIN_E2 D_LCD_PIN_RW
wim 35:311be6444a39 227
wim 35:311be6444a39 228 //Force I2C portexpander type
wim 35:311be6444a39 229 #define PCF8574 1
wim 35:311be6444a39 230 #define MCP23008 0
wim 35:311be6444a39 231
wim 35:311be6444a39 232 //Force Inverted Backlight control
wim 35:311be6444a39 233 #define BACKLIGHT_INV 1
wim 35:311be6444a39 234 #endif
wim 35:311be6444a39 235
wim 35:311be6444a39 236 #if (SYDZ==1)
wim 35:311be6444a39 237 //Definitions for SYDZ Module mapping between serial port expander pins and LCD controller.
wim 35:311be6444a39 238 //Very similar to DFROBOT. This hardware uses PCF8574A and uses inverted Backlight control
wim 35:311be6444a39 239 //Slaveaddress may be set by switches (default 0x40). SDA/SCL has pullup Resistors onboard.
wim 35:311be6444a39 240 //See ebay
wim 35:311be6444a39 241 //
wim 35:311be6444a39 242 //Note: LCD RW pin must be kept LOW
wim 35:311be6444a39 243 // E2 is not available on default hardware and so it does not support LCD40x4 (second controller)
wim 35:311be6444a39 244 // BL is used to control backlight, reverse logic: Low turns on Backlight. This is handled in setBacklight()
wim 35:311be6444a39 245 #define D_LCD_PIN_RS 0
wim 35:311be6444a39 246 #define D_LCD_PIN_RW 1
wim 35:311be6444a39 247 #define D_LCD_PIN_E 2
wim 35:311be6444a39 248 #define D_LCD_PIN_BL 3
wim 35:311be6444a39 249 #define D_LCD_PIN_D4 4
wim 35:311be6444a39 250 #define D_LCD_PIN_D5 5
wim 35:311be6444a39 251 #define D_LCD_PIN_D6 6
wim 35:311be6444a39 252 #define D_LCD_PIN_D7 7
wim 35:311be6444a39 253
wim 35:311be6444a39 254 #define D_LCD_PIN_E2 D_LCD_PIN_RW
wim 35:311be6444a39 255
wim 35:311be6444a39 256 //Force I2C portexpander type
wim 35:311be6444a39 257 #define PCF8574 1
wim 35:311be6444a39 258 #define MCP23008 0
wim 35:311be6444a39 259
wim 35:311be6444a39 260 //Force Inverted Backlight control
wim 35:311be6444a39 261 #define BACKLIGHT_INV 1
wim 35:311be6444a39 262 #endif
wim 34:e5a0dcb43ecc 263
wim 34:e5a0dcb43ecc 264 //Bitpattern Defines for I2C PCF8574/PCF8574A, MCP23008 and SPI 74595 Bus expanders
wim 37:ce348c002929 265 //Don't change!
wim 34:e5a0dcb43ecc 266 //
wim 34:e5a0dcb43ecc 267 #define D_LCD_D4 (1<<D_LCD_PIN_D4)
wim 34:e5a0dcb43ecc 268 #define D_LCD_D5 (1<<D_LCD_PIN_D5)
wim 34:e5a0dcb43ecc 269 #define D_LCD_D6 (1<<D_LCD_PIN_D6)
wim 34:e5a0dcb43ecc 270 #define D_LCD_D7 (1<<D_LCD_PIN_D7)
wim 34:e5a0dcb43ecc 271 #define D_LCD_RS (1<<D_LCD_PIN_RS)
wim 34:e5a0dcb43ecc 272 #define D_LCD_E (1<<D_LCD_PIN_E)
wim 34:e5a0dcb43ecc 273 #define D_LCD_E2 (1<<D_LCD_PIN_E2)
wim 34:e5a0dcb43ecc 274 #define D_LCD_BL (1<<D_LCD_PIN_BL)
wim 34:e5a0dcb43ecc 275 //#define D_LCD_RW (1<<D_LCD_PIN_RW)
wim 34:e5a0dcb43ecc 276
wim 34:e5a0dcb43ecc 277 #define D_LCD_BUS_MSK (D_LCD_D4 | D_LCD_D5 | D_LCD_D6 | D_LCD_D7)
wim 34:e5a0dcb43ecc 278 #define D_LCD_BUS_DEF 0x00
wim 34:e5a0dcb43ecc 279
wim 34:e5a0dcb43ecc 280 /* PCF8574/PCF8574A I2C portexpander slave address */
wim 34:e5a0dcb43ecc 281 #define PCF8574_SA0 0x40
wim 34:e5a0dcb43ecc 282 #define PCF8574_SA1 0x42
wim 34:e5a0dcb43ecc 283 #define PCF8574_SA2 0x44
wim 34:e5a0dcb43ecc 284 #define PCF8574_SA3 0x46
wim 34:e5a0dcb43ecc 285 #define PCF8574_SA4 0x48
wim 34:e5a0dcb43ecc 286 #define PCF8574_SA5 0x4A
wim 34:e5a0dcb43ecc 287 #define PCF8574_SA6 0x4C
wim 34:e5a0dcb43ecc 288 #define PCF8574_SA7 0x4E
wim 34:e5a0dcb43ecc 289
wim 34:e5a0dcb43ecc 290 #define PCF8574A_SA0 0x70
wim 34:e5a0dcb43ecc 291 #define PCF8574A_SA1 0x72
wim 34:e5a0dcb43ecc 292 #define PCF8574A_SA2 0x74
wim 34:e5a0dcb43ecc 293 #define PCF8574A_SA3 0x76
wim 34:e5a0dcb43ecc 294 #define PCF8574A_SA4 0x78
wim 34:e5a0dcb43ecc 295 #define PCF8574A_SA5 0x7A
wim 34:e5a0dcb43ecc 296 #define PCF8574A_SA6 0x7C
wim 34:e5a0dcb43ecc 297 #define PCF8574A_SA7 0x7E
wim 34:e5a0dcb43ecc 298
wim 34:e5a0dcb43ecc 299 /* MCP23008 I2C portexpander slave address */
wim 34:e5a0dcb43ecc 300 #define MCP23008_SA0 0x40
wim 34:e5a0dcb43ecc 301 #define MCP23008_SA1 0x42
wim 34:e5a0dcb43ecc 302 #define MCP23008_SA2 0x44
wim 34:e5a0dcb43ecc 303 #define MCP23008_SA3 0x46
wim 34:e5a0dcb43ecc 304 #define MCP23008_SA4 0x48
wim 34:e5a0dcb43ecc 305 #define MCP23008_SA5 0x4A
wim 34:e5a0dcb43ecc 306 #define MCP23008_SA6 0x4C
wim 34:e5a0dcb43ecc 307 #define MCP23008_SA7 0x4E
wim 34:e5a0dcb43ecc 308
wim 34:e5a0dcb43ecc 309 /* MCP23008 I2C portexpander internal registers */
wim 34:e5a0dcb43ecc 310 #define IODIR 0x00
wim 34:e5a0dcb43ecc 311 #define IPOL 0x01
wim 34:e5a0dcb43ecc 312 #define GPINTEN 0x02
wim 34:e5a0dcb43ecc 313 #define DEFVAL 0x03
wim 34:e5a0dcb43ecc 314 #define INTCON 0x04
wim 34:e5a0dcb43ecc 315 #define IOCON 0x05
wim 34:e5a0dcb43ecc 316 #define GPPU 0x06
wim 34:e5a0dcb43ecc 317 #define INTF 0x07
wim 34:e5a0dcb43ecc 318 #define INTCAP 0x08
wim 34:e5a0dcb43ecc 319 #define GPIO 0x09
wim 34:e5a0dcb43ecc 320 #define OLAT 0x0A
wim 34:e5a0dcb43ecc 321
wim 34:e5a0dcb43ecc 322 /* ST7032i I2C slave address */
wim 34:e5a0dcb43ecc 323 #define ST7032_SA 0x7C
wim 34:e5a0dcb43ecc 324
wim 34:e5a0dcb43ecc 325 /* ST7036i I2C slave address */
wim 34:e5a0dcb43ecc 326 #define ST7036_SA0 0x78
wim 34:e5a0dcb43ecc 327 #define ST7036_SA1 0x7A
wim 34:e5a0dcb43ecc 328 #define ST7036_SA2 0x7C
wim 34:e5a0dcb43ecc 329 #define ST7036_SA3 0x7E
wim 34:e5a0dcb43ecc 330
wim 37:ce348c002929 331 /* ST7066_ACM I2C slave address, Added for ACM1602 module */
wim 37:ce348c002929 332 #define ST7066_SA0 0xA0
wim 37:ce348c002929 333
wim 34:e5a0dcb43ecc 334 /* PCF21XX I2C slave address */
wim 34:e5a0dcb43ecc 335 #define PCF21XX_SA0 0x74
wim 34:e5a0dcb43ecc 336 #define PCF21XX_SA1 0x76
wim 34:e5a0dcb43ecc 337
wim 34:e5a0dcb43ecc 338 /* AIP31068 I2C slave address */
wim 34:e5a0dcb43ecc 339 #define AIP31068_SA 0x7C
wim 34:e5a0dcb43ecc 340
wim 34:e5a0dcb43ecc 341 /* SSD1803 I2C slave address */
wim 34:e5a0dcb43ecc 342 #define SSD1803_SA0 0x78
wim 34:e5a0dcb43ecc 343 #define SSD1803_SA1 0x7A
wim 34:e5a0dcb43ecc 344
wim 34:e5a0dcb43ecc 345 /* US2066/SSD1311 I2C slave address */
wim 34:e5a0dcb43ecc 346 #define US2066_SA0 0x78
wim 34:e5a0dcb43ecc 347 #define US2066_SA1 0x7A
wim 34:e5a0dcb43ecc 348
wim 34:e5a0dcb43ecc 349 /* AC780 I2C slave address */
wim 34:e5a0dcb43ecc 350 #define AC780_SA0 0x78
wim 34:e5a0dcb43ecc 351 #define AC780_SA1 0x7A
wim 34:e5a0dcb43ecc 352 #define AC780_SA2 0x7C
wim 34:e5a0dcb43ecc 353 #define AC780_SA3 0x7E
wim 34:e5a0dcb43ecc 354
wim 34:e5a0dcb43ecc 355 //Some native I2C controllers dont support ACK. Set define to '0' to allow code to proceed even without ACK
wim 34:e5a0dcb43ecc 356 //#define LCD_I2C_ACK 0
wim 34:e5a0dcb43ecc 357 #define LCD_I2C_ACK 1
wim 34:e5a0dcb43ecc 358
wim 34:e5a0dcb43ecc 359
wim 34:e5a0dcb43ecc 360 // Contrast setting, 6 significant bits (only supported for controllers with extended features)
wim 34:e5a0dcb43ecc 361 // Voltage Multiplier setting, 2 or 3 significant bits (only supported for controllers with extended features)
wim 34:e5a0dcb43ecc 362 #define LCD_DEF_CONTRAST 0x20
wim 34:e5a0dcb43ecc 363
wim 34:e5a0dcb43ecc 364 //ST7032 EastRising ERC1602FS-4 display
wim 34:e5a0dcb43ecc 365 //Contrast setting 6 significant bits
wim 34:e5a0dcb43ecc 366 //Voltage Multiplier setting 3 significant bits
wim 37:ce348c002929 367 #define LCD_ST7032_CONTRAST 0x28
wim 34:e5a0dcb43ecc 368 #define LCD_ST7032_RAB 0x04
wim 34:e5a0dcb43ecc 369
wim 34:e5a0dcb43ecc 370 //ST7036 EA DOGM1603 display
wim 34:e5a0dcb43ecc 371 //Contrast setting 6 significant bits
wim 34:e5a0dcb43ecc 372 //Voltage Multiplier setting 3 significant bits
wim 34:e5a0dcb43ecc 373 #define LCD_ST7036_CONTRAST 0x28
wim 34:e5a0dcb43ecc 374 #define LCD_ST7036_RAB 0x04
wim 34:e5a0dcb43ecc 375
wim 34:e5a0dcb43ecc 376 //SSD1803 EA DOGM204 display
wim 34:e5a0dcb43ecc 377 //Contrast setting 6 significant bits
wim 34:e5a0dcb43ecc 378 //Voltage Multiplier setting 3 significant bits
wim 34:e5a0dcb43ecc 379 #define LCD_SSD1_CONTRAST 0x28
wim 34:e5a0dcb43ecc 380 #define LCD_SSD1_RAB 0x06
wim 34:e5a0dcb43ecc 381
wim 34:e5a0dcb43ecc 382 //US2066/SSD1311 EastRising ER-OLEDM2002-4 display
wim 34:e5a0dcb43ecc 383 //Contrast setting 8 significant bits, use 6 for compatibility
wim 34:e5a0dcb43ecc 384 #define LCD_US20_CONTRAST 0x3F
wim 34:e5a0dcb43ecc 385 //#define LCD_US20_CONTRAST 0x1F
wim 34:e5a0dcb43ecc 386
wim 34:e5a0dcb43ecc 387 //PCF2113, PCF2119 display
wim 34:e5a0dcb43ecc 388 //Contrast setting 6 significant bits
wim 34:e5a0dcb43ecc 389 //Voltage Multiplier setting 2 significant bits
wim 34:e5a0dcb43ecc 390 #define LCD_PCF2_CONTRAST 0x20
wim 34:e5a0dcb43ecc 391 #define LCD_PCF2_S12 0x02
wim 34:e5a0dcb43ecc 392
wim 34:e5a0dcb43ecc 393 //PT6314 VFD display
wim 34:e5a0dcb43ecc 394 //Contrast setting 2 significant bits, use 6 for compatibility
wim 34:e5a0dcb43ecc 395 #define LCD_PT63_CONTRAST 0x3F
wim 34:e5a0dcb43ecc 396
wim 34:e5a0dcb43ecc 397
wim 34:e5a0dcb43ecc 398 #endif //MBED_TEXTLCDCONFIG_H