Addition Support for Arduino I2C based on PCF8574A

Fork of TextLCD by Wim Huiskamp

Committer:
Antulius
Date:
Mon Aug 20 08:17:37 2018 +0000
Revision:
42:c1862c9160b4
Parent:
37:ce348c002929
Child:
43:067e07b6f5b8
Adici?n de soporte para LCD con adecuaciones a la Libreria TextLCD para soporte del shield de Arduino PCF8274A

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