add UTF-8 recode support, Cyrilic rus/ukr tables

Dependents:   Current_load1

Fork of TextLCD by Wim Huiskamp

TextLCD Library UTF-8 recode support, Cyrilic rus/ukr tables

Committer:
andrey_als
Date:
Sun Feb 11 20:19:02 2018 +0000
Revision:
45:8625be98ecd4
Parent:
42:041673da5e53
1

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 38:cbe275b0b647 8 * 2015, v06: WH, Performance improvement I2C portexpander
wim 38:cbe275b0b647 9 * 2015, v07: WH, Fixed Adafruit I2C/SPI portexpander pinmappings, fixed SYDZ Backlight
wim 39:e9c2319de9c5 10 * 2015, v08: WH, Added defines to reduce memory footprint (eg LCD_ICON), added some I2C portexpander defines
wim 34:e5a0dcb43ecc 11 *
wim 34:e5a0dcb43ecc 12 * Permission is hereby granted, free of charge, to any person obtaining a copy
wim 34:e5a0dcb43ecc 13 * of this software and associated documentation files (the "Software"), to deal
wim 34:e5a0dcb43ecc 14 * in the Software without restriction, including without limitation the rights
wim 34:e5a0dcb43ecc 15 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
wim 34:e5a0dcb43ecc 16 * copies of the Software, and to permit persons to whom the Software is
wim 34:e5a0dcb43ecc 17 * furnished to do so, subject to the following conditions:
wim 34:e5a0dcb43ecc 18 *
wim 34:e5a0dcb43ecc 19 * The above copyright notice and this permission notice shall be included in
wim 34:e5a0dcb43ecc 20 * all copies or substantial portions of the Software.
wim 34:e5a0dcb43ecc 21 *
wim 34:e5a0dcb43ecc 22 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
wim 34:e5a0dcb43ecc 23 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
wim 34:e5a0dcb43ecc 24 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
wim 34:e5a0dcb43ecc 25 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
wim 34:e5a0dcb43ecc 26 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
wim 34:e5a0dcb43ecc 27 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
wim 34:e5a0dcb43ecc 28 * THE SOFTWARE.
wim 34:e5a0dcb43ecc 29 */
wim 34:e5a0dcb43ecc 30 #ifndef MBED_TEXTLCDCONFIG_H
wim 34:e5a0dcb43ecc 31 #define MBED_TEXTLCDCONFIG_H
wim 34:e5a0dcb43ecc 32
wim 34:e5a0dcb43ecc 33 //Select hardware interface options to reduce memory footprint (multiple options allowed)
wim 34:e5a0dcb43ecc 34 #define LCD_I2C 1 /* I2C Expander PCF8574/MCP23008 */
andrey_als 41:51a77c5a45b6 35 #define LCD_SPI 0 /* SPI Expander SN74595 */
andrey_als 41:51a77c5a45b6 36 #define LCD_I2C_N 0 /* Native I2C bus */
andrey_als 41:51a77c5a45b6 37 #define LCD_SPI_N 0 /* Native SPI bus */
andrey_als 41:51a77c5a45b6 38 #define LCD_SPI_N_3_8 0 /* Native SPI bus */
andrey_als 41:51a77c5a45b6 39 #define LCD_SPI_N_3_9 0 /* Native SPI bus */
andrey_als 41:51a77c5a45b6 40 #define LCD_SPI_N_3_10 0 /* Native SPI bus */
andrey_als 41:51a77c5a45b6 41 #define LCD_SPI_N_3_16 0 /* Native SPI bus */
andrey_als 41:51a77c5a45b6 42 #define LCD_SPI_N_3_24 0 /* Native SPI bus */
wim 35:311be6444a39 43
wim 34:e5a0dcb43ecc 44 //Select options to reduce memory footprint (multiple options allowed)
wim 39:e9c2319de9c5 45 #define LCD_UDC 1 /* Enable predefined UDC example*/
wim 39:e9c2319de9c5 46 #define LCD_PRINTF 1 /* Enable Stream implementation */
andrey_als 41:51a77c5a45b6 47 #define LCD_ICON 0 /* Enable Icon implementation -2.0K codesize*/
andrey_als 41:51a77c5a45b6 48 #define LCD_ORIENT 0 /* Enable Orientation switch implementation -0.9K codesize*/
andrey_als 41:51a77c5a45b6 49 #define LCD_BIGFONT 0 /* Enable Big Font implementation -0.6K codesize */
andrey_als 41:51a77c5a45b6 50 #define LCD_INVERT 0 /* Enable display Invert implementation -0.5K codesize*/
wim 40:d3496c3ea301 51 #define LCD_POWER 1 /* Enable Power control implementation -0.1K codesize*/
wim 39:e9c2319de9c5 52 #define LCD_BLINK 1 /* Enable UDC and Icon Blink control implementation -0.8K codesize*/
andrey_als 42:041673da5e53 53 #define UTF8_SUPP 1 /* Enable UTF-8 Support and cyrilic tables -0.128K codesize*/
wim 34:e5a0dcb43ecc 54
wim 40:d3496c3ea301 55 //Select option to activate default fonttable or alternatively use conversion for specific controller versions (eg PCF2116C, PCF2119R)
andrey_als 42:041673da5e53 56 //#define LCD_DEF_FONT 0
andrey_als 42:041673da5e53 57 #define LCD_DEF_FONT 2 //Cyrilic
wim 37:ce348c002929 58
wim 34:e5a0dcb43ecc 59 //Pin Defines for I2C PCF8574/PCF8574A or MCP23008 and SPI 74595 bus expander interfaces
wim 37:ce348c002929 60 //Different commercially available LCD portexpanders use different wiring conventions.
wim 37:ce348c002929 61 //LCD and serial portexpanders should be wired according to the tables below.
wim 34:e5a0dcb43ecc 62 //
wim 37:ce348c002929 63 //Select Serial Port Expander Hardware module (one option only)
andrey_als 41:51a77c5a45b6 64 #define DEFAULT 0
wim 34:e5a0dcb43ecc 65 #define ADAFRUIT 0
wim 34:e5a0dcb43ecc 66 #define DFROBOT 0
andrey_als 41:51a77c5a45b6 67 #define LCM1602 1
wim 35:311be6444a39 68 #define YWROBOT 0
wim 35:311be6444a39 69 #define GYLCD 0
wim 39:e9c2319de9c5 70 #define MJKDZ 0
wim 40:d3496c3ea301 71 #define SYDZ 0
wim 39:e9c2319de9c5 72 #define WIDEHK 0
wim 39:e9c2319de9c5 73 #define LCDPLUG 0
wim 34:e5a0dcb43ecc 74
wim 34:e5a0dcb43ecc 75 #if (DEFAULT==1)
wim 34:e5a0dcb43ecc 76 //Definitions for default (WH) mapping between serial port expander pins and LCD controller
wim 34:e5a0dcb43ecc 77 //This hardware supports the I2C bus expander (PCF8574/PCF8574A or MCP23008) and SPI bus expander (74595) interfaces
wim 34:e5a0dcb43ecc 78 //See https://mbed.org/cookbook/Text-LCD-Enhanced
wim 34:e5a0dcb43ecc 79 //
wim 34:e5a0dcb43ecc 80 //Note: LCD RW pin must be connected to GND
wim 34:e5a0dcb43ecc 81 // E2 is used for LCD40x4 (second controller)
wim 34:e5a0dcb43ecc 82 // BL may be used to control backlight
wim 38:cbe275b0b647 83
wim 38:cbe275b0b647 84 //I2C bus expander (PCF8574/PCF8574A or MCP23008) interface
wim 38:cbe275b0b647 85 #define LCD_BUS_I2C_D4 (1 << 0)
wim 38:cbe275b0b647 86 #define LCD_BUS_I2C_D5 (1 << 1)
wim 38:cbe275b0b647 87 #define LCD_BUS_I2C_D6 (1 << 2)
wim 38:cbe275b0b647 88 #define LCD_BUS_I2C_D7 (1 << 3)
wim 38:cbe275b0b647 89 #define LCD_BUS_I2C_RS (1 << 4)
wim 38:cbe275b0b647 90 #define LCD_BUS_I2C_E (1 << 5)
wim 38:cbe275b0b647 91 #define LCD_BUS_I2C_E2 (1 << 6)
wim 38:cbe275b0b647 92 #define LCD_BUS_I2C_BL (1 << 7)
wim 34:e5a0dcb43ecc 93
wim 38:cbe275b0b647 94 #define LCD_BUS_I2C_RW (1 << 6)
wim 38:cbe275b0b647 95
andrey_als 41:51a77c5a45b6 96
wim 38:cbe275b0b647 97 //SPI bus expander (74595) interface, same as I2C
wim 38:cbe275b0b647 98 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4
wim 38:cbe275b0b647 99 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5
wim 38:cbe275b0b647 100 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6
wim 38:cbe275b0b647 101 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7
wim 38:cbe275b0b647 102 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS
wim 38:cbe275b0b647 103 #define LCD_BUS_SPI_E LCD_BUS_I2C_E
wim 38:cbe275b0b647 104 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2
wim 38:cbe275b0b647 105 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL
wim 38:cbe275b0b647 106
wim 38:cbe275b0b647 107 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW
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 38:cbe275b0b647 126 //Note: The pinmappings are different for the MCP23008 and the 74595!
wim 38:cbe275b0b647 127
wim 38:cbe275b0b647 128 //I2C bus expander (MCP23008) interface
wim 38:cbe275b0b647 129 #define LCD_BUS_I2C_0 (1 << 0)
wim 38:cbe275b0b647 130 #define LCD_BUS_I2C_RS (1 << 1)
wim 38:cbe275b0b647 131 #define LCD_BUS_I2C_E (1 << 2)
wim 38:cbe275b0b647 132 #define LCD_BUS_I2C_D4 (1 << 3)
wim 38:cbe275b0b647 133 #define LCD_BUS_I2C_D5 (1 << 4)
wim 38:cbe275b0b647 134 #define LCD_BUS_I2C_D6 (1 << 5)
wim 38:cbe275b0b647 135 #define LCD_BUS_I2C_D7 (1 << 6)
wim 38:cbe275b0b647 136 #define LCD_BUS_I2C_BL (1 << 7)
wim 34:e5a0dcb43ecc 137
wim 38:cbe275b0b647 138 #define LCD_BUS_I2C_E2 (1 << 0)
wim 38:cbe275b0b647 139 #define LCD_BUS_I2C_RW (1 << 0)
wim 38:cbe275b0b647 140
wim 38:cbe275b0b647 141 //SPI bus expander (74595) interface
wim 38:cbe275b0b647 142 #define LCD_BUS_SPI_0 (1 << 0)
wim 38:cbe275b0b647 143 #define LCD_BUS_SPI_RS (1 << 1)
wim 38:cbe275b0b647 144 #define LCD_BUS_SPI_E (1 << 2)
wim 38:cbe275b0b647 145 #define LCD_BUS_SPI_D7 (1 << 3)
wim 38:cbe275b0b647 146 #define LCD_BUS_SPI_D6 (1 << 4)
wim 38:cbe275b0b647 147 #define LCD_BUS_SPI_D5 (1 << 5)
wim 38:cbe275b0b647 148 #define LCD_BUS_SPI_D4 (1 << 6)
wim 38:cbe275b0b647 149 #define LCD_BUS_SPI_BL (1 << 7)
wim 38:cbe275b0b647 150
wim 38:cbe275b0b647 151 #define LCD_BUS_SPI_E2 (1 << 0)
wim 38:cbe275b0b647 152 #define LCD_BUS_SPI_RW (1 << 0)
wim 34:e5a0dcb43ecc 153
wim 34:e5a0dcb43ecc 154 //Force I2C portexpander type
wim 34:e5a0dcb43ecc 155 #define PCF8574 0
wim 34:e5a0dcb43ecc 156 #define MCP23008 1
wim 35:311be6444a39 157
wim 35:311be6444a39 158 //Inverted Backlight control
wim 35:311be6444a39 159 #define BACKLIGHT_INV 0
wim 34:e5a0dcb43ecc 160 #endif
wim 34:e5a0dcb43ecc 161
wim 34:e5a0dcb43ecc 162 #if (DFROBOT==1)
wim 34:e5a0dcb43ecc 163 //Definitions for DFROBOT LCD2004 Module mapping between serial port expander pins and LCD controller
wim 34:e5a0dcb43ecc 164 //This hardware uses PCF8574 and is different from earlier/different Arduino I2C LCD displays
wim 35:311be6444a39 165 //Slaveaddress hardwired to 0x4E. SDA/SCL has pullup Resistors onboard.
wim 35:311be6444a39 166 //See http://arduino-info.wikispaces.com/LCD-Blue-I2C
wim 35:311be6444a39 167 //
wim 35:311be6444a39 168 //Definitions for DFROBOT V1.1
wim 35:311be6444a39 169 //This hardware uses PCF8574. Slaveaddress may be set by jumpers (default 0x40).
wim 35:311be6444a39 170 //SDA/SCL has pullup Resistors onboard and features a voltage level converter 3V3 <-> 5V.
wim 35:311be6444a39 171 //See http://www.dfrobot.com/index.php?route=product/product&product_id=135
wim 35:311be6444a39 172 //
wim 35:311be6444a39 173 //
wim 35:311be6444a39 174 //Note: LCD RW pin must be kept LOW
wim 35:311be6444a39 175 // E2 is not available on default Arduino hardware and so it does not support LCD40x4 (second controller)
wim 35:311be6444a39 176 // BL is used to control backlight
wim 38:cbe275b0b647 177
wim 38:cbe275b0b647 178 //I2C bus expander PCF8574 interface
wim 38:cbe275b0b647 179 #define LCD_BUS_I2C_RS (1 << 0)
wim 38:cbe275b0b647 180 #define LCD_BUS_I2C_RW (1 << 1)
wim 38:cbe275b0b647 181 #define LCD_BUS_I2C_E (1 << 2)
wim 38:cbe275b0b647 182 #define LCD_BUS_I2C_BL (1 << 3)
wim 38:cbe275b0b647 183 #define LCD_BUS_I2C_D4 (1 << 4)
wim 38:cbe275b0b647 184 #define LCD_BUS_I2C_D5 (1 << 5)
wim 38:cbe275b0b647 185 #define LCD_BUS_I2C_D6 (1 << 6)
wim 38:cbe275b0b647 186 #define LCD_BUS_I2C_D7 (1 << 7)
wim 38:cbe275b0b647 187
wim 38:cbe275b0b647 188 #define LCD_BUS_I2C_E2 (1 << 1)
wim 35:311be6444a39 189
wim 38:cbe275b0b647 190 //SPI bus expander (74595) interface, same as I2C
wim 38:cbe275b0b647 191 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS
wim 38:cbe275b0b647 192 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW
wim 38:cbe275b0b647 193 #define LCD_BUS_SPI_E LCD_BUS_I2C_E
wim 38:cbe275b0b647 194 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL
wim 38:cbe275b0b647 195 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4
wim 38:cbe275b0b647 196 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5
wim 38:cbe275b0b647 197 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6
wim 38:cbe275b0b647 198 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7
wim 38:cbe275b0b647 199
wim 38:cbe275b0b647 200 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2
wim 38:cbe275b0b647 201
wim 35:311be6444a39 202
wim 35:311be6444a39 203 //Force I2C portexpander type
wim 35:311be6444a39 204 #define PCF8574 1
wim 35:311be6444a39 205 #define MCP23008 0
wim 35:311be6444a39 206
wim 35:311be6444a39 207 //Inverted Backlight control
wim 35:311be6444a39 208 #define BACKLIGHT_INV 0
wim 35:311be6444a39 209 #endif
wim 35:311be6444a39 210
wim 39:e9c2319de9c5 211 #if ((YWROBOT==1) || (LCM1602==1))
wim 35:311be6444a39 212 //Definitions for YWROBOT LCM1602 V1 Module mapping between serial port expander pins and LCD controller.
wim 39:e9c2319de9c5 213 //Very similar to DFROBOT. Also marked as 'Funduino'. This hardware uses PCF8574.
wim 35:311be6444a39 214 //Slaveaddress may be set by solderbridges (default 0x4E). SDA/SCL has no pullup Resistors onboard.
wim 34:e5a0dcb43ecc 215 //See http://arduino-info.wikispaces.com/LCD-Blue-I2C
wim 34:e5a0dcb43ecc 216 //
wim 34:e5a0dcb43ecc 217 //Note: LCD RW pin must be kept LOW
wim 35:311be6444a39 218 // E2 is not available on default hardware and so it does not support LCD40x4 (second controller)
wim 39:e9c2319de9c5 219 // BL is used to control backlight.
wim 38:cbe275b0b647 220
wim 38:cbe275b0b647 221 //I2C bus expander PCF8574 interface
wim 38:cbe275b0b647 222 #define LCD_BUS_I2C_RS (1 << 0)
wim 38:cbe275b0b647 223 #define LCD_BUS_I2C_RW (1 << 1)
wim 38:cbe275b0b647 224 #define LCD_BUS_I2C_E (1 << 2)
wim 38:cbe275b0b647 225 #define LCD_BUS_I2C_BL (1 << 3)
wim 38:cbe275b0b647 226 #define LCD_BUS_I2C_D4 (1 << 4)
wim 38:cbe275b0b647 227 #define LCD_BUS_I2C_D5 (1 << 5)
wim 38:cbe275b0b647 228 #define LCD_BUS_I2C_D6 (1 << 6)
wim 38:cbe275b0b647 229 #define LCD_BUS_I2C_D7 (1 << 7)
wim 34:e5a0dcb43ecc 230
wim 38:cbe275b0b647 231 #define LCD_BUS_I2C_E2 (1 << 1)
wim 38:cbe275b0b647 232
wim 38:cbe275b0b647 233 //SPI bus expander (74595) interface, same as I2C
wim 38:cbe275b0b647 234 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS
wim 38:cbe275b0b647 235 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW
wim 38:cbe275b0b647 236 #define LCD_BUS_SPI_E LCD_BUS_I2C_E
wim 38:cbe275b0b647 237 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL
wim 38:cbe275b0b647 238 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4
wim 38:cbe275b0b647 239 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5
wim 38:cbe275b0b647 240 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6
wim 38:cbe275b0b647 241 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7
wim 38:cbe275b0b647 242
wim 38:cbe275b0b647 243 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2
wim 34:e5a0dcb43ecc 244
wim 34:e5a0dcb43ecc 245 //Force I2C portexpander type
wim 34:e5a0dcb43ecc 246 #define PCF8574 1
wim 34:e5a0dcb43ecc 247 #define MCP23008 0
wim 35:311be6444a39 248
wim 35:311be6444a39 249 //Inverted Backlight control
wim 35:311be6444a39 250 #define BACKLIGHT_INV 0
wim 34:e5a0dcb43ecc 251 #endif
wim 34:e5a0dcb43ecc 252
wim 39:e9c2319de9c5 253 #if ((GYLCD==1) || (MJKDZ==1))
wim 39:e9c2319de9c5 254 //Definitions for Arduino-IIC-LCD GY-LCD-V1, for GY-IICLCD and for MJKDZ Module mapping between serial port expander pins and LCD controller.
wim 35:311be6444a39 255 //Very similar to DFROBOT. This hardware uses PCF8574.
wim 35:311be6444a39 256 //Slaveaddress may be set by solderbridges (default 0x4E). SDA/SCL has pullup Resistors onboard.
wim 35:311be6444a39 257 //See http://arduino-info.wikispaces.com/LCD-Blue-I2C
wim 35:311be6444a39 258 //
wim 35:311be6444a39 259 //Note: LCD RW pin must be kept LOW
wim 35:311be6444a39 260 // E2 is not available on default hardware and so it does not support LCD40x4 (second controller)
wim 35:311be6444a39 261 // BL is used to control backlight, reverse logic: Low turns on Backlight. This is handled in setBacklight()
wim 38:cbe275b0b647 262
wim 38:cbe275b0b647 263 //I2C bus expander PCF8574 interface
wim 38:cbe275b0b647 264 #define LCD_BUS_I2C_D4 (1 << 0)
wim 38:cbe275b0b647 265 #define LCD_BUS_I2C_D5 (1 << 1)
wim 38:cbe275b0b647 266 #define LCD_BUS_I2C_D6 (1 << 2)
wim 38:cbe275b0b647 267 #define LCD_BUS_I2C_D7 (1 << 3)
wim 38:cbe275b0b647 268 #define LCD_BUS_I2C_E (1 << 4)
wim 38:cbe275b0b647 269 #define LCD_BUS_I2C_RW (1 << 5)
wim 38:cbe275b0b647 270 #define LCD_BUS_I2C_RS (1 << 6)
wim 38:cbe275b0b647 271 #define LCD_BUS_I2C_BL (1 << 7)
wim 35:311be6444a39 272
wim 38:cbe275b0b647 273 #define LCD_BUS_I2C_E2 (1 << 5)
wim 38:cbe275b0b647 274
wim 38:cbe275b0b647 275 //SPI bus expander (74595) interface
wim 38:cbe275b0b647 276 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4
wim 38:cbe275b0b647 277 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5
wim 38:cbe275b0b647 278 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6
wim 38:cbe275b0b647 279 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7
wim 38:cbe275b0b647 280 #define LCD_BUS_SPI_E LCD_BUS_I2C_E
wim 38:cbe275b0b647 281 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW
wim 38:cbe275b0b647 282 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS
wim 38:cbe275b0b647 283 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL
wim 38:cbe275b0b647 284
wim 38:cbe275b0b647 285 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2
wim 35:311be6444a39 286
wim 35:311be6444a39 287 //Force I2C portexpander type
wim 35:311be6444a39 288 #define PCF8574 1
wim 35:311be6444a39 289 #define MCP23008 0
wim 35:311be6444a39 290
wim 35:311be6444a39 291 //Force Inverted Backlight control
wim 35:311be6444a39 292 #define BACKLIGHT_INV 1
wim 35:311be6444a39 293 #endif
wim 35:311be6444a39 294
wim 35:311be6444a39 295 #if (SYDZ==1)
wim 35:311be6444a39 296 //Definitions for SYDZ Module mapping between serial port expander pins and LCD controller.
wim 38:cbe275b0b647 297 //Very similar to DFROBOT. This hardware uses PCF8574A.
wim 38:cbe275b0b647 298 //Slaveaddress may be set by switches (default 0x70). SDA/SCL has pullup Resistors onboard.
wim 35:311be6444a39 299 //See ebay
wim 35:311be6444a39 300 //
wim 35:311be6444a39 301 //Note: LCD RW pin must be kept LOW
wim 35:311be6444a39 302 // E2 is not available on default hardware and so it does not support LCD40x4 (second controller)
wim 38:cbe275b0b647 303 // BL is used to control backlight
wim 38:cbe275b0b647 304
wim 38:cbe275b0b647 305 //I2C bus expander PCF8574A interface
wim 38:cbe275b0b647 306 #define LCD_BUS_I2C_RS (1 << 0)
wim 38:cbe275b0b647 307 #define LCD_BUS_I2C_RW (1 << 1)
wim 38:cbe275b0b647 308 #define LCD_BUS_I2C_E (1 << 2)
wim 38:cbe275b0b647 309 #define LCD_BUS_I2C_BL (1 << 3)
wim 38:cbe275b0b647 310 #define LCD_BUS_I2C_D4 (1 << 4)
wim 38:cbe275b0b647 311 #define LCD_BUS_I2C_D5 (1 << 5)
wim 38:cbe275b0b647 312 #define LCD_BUS_I2C_D6 (1 << 6)
wim 38:cbe275b0b647 313 #define LCD_BUS_I2C_D7 (1 << 7)
wim 35:311be6444a39 314
wim 38:cbe275b0b647 315 #define LCD_BUS_I2C_E2 (1 << 1)
wim 38:cbe275b0b647 316
wim 38:cbe275b0b647 317 //SPI bus expander (74595) interface, same as I2C
wim 38:cbe275b0b647 318 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS
wim 38:cbe275b0b647 319 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW
wim 38:cbe275b0b647 320 #define LCD_BUS_SPI_E LCD_BUS_I2C_E
wim 38:cbe275b0b647 321 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL
wim 38:cbe275b0b647 322 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4
wim 38:cbe275b0b647 323 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5
wim 38:cbe275b0b647 324 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6
wim 38:cbe275b0b647 325 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7
wim 38:cbe275b0b647 326
wim 38:cbe275b0b647 327 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2
wim 35:311be6444a39 328
wim 35:311be6444a39 329 //Force I2C portexpander type
wim 35:311be6444a39 330 #define PCF8574 1
wim 35:311be6444a39 331 #define MCP23008 0
wim 35:311be6444a39 332
wim 35:311be6444a39 333 //Force Inverted Backlight control
wim 38:cbe275b0b647 334 #define BACKLIGHT_INV 0
wim 35:311be6444a39 335 #endif
wim 34:e5a0dcb43ecc 336
wim 39:e9c2319de9c5 337 #if (WIDEHK==1)
wim 39:e9c2319de9c5 338 //Definitions for WIDE.HK I2C backpack mapping between serial port expander pins and LCD controller
wim 39:e9c2319de9c5 339 //This hardware uses an MCP23008 I2C expander.
wim 39:e9c2319de9c5 340 //Slaveaddress is hardcoded at 0x4E. SDA/SCL has pullup Resistors onboard (3k3).
wim 39:e9c2319de9c5 341 //See http://www.wide.hk
wim 39:e9c2319de9c5 342 //
wim 39:e9c2319de9c5 343 //Note: LCD RW pin must be kept LOW
wim 39:e9c2319de9c5 344 // E2 is not available on this hardware and so it does not support LCD40x4 (second controller)
wim 39:e9c2319de9c5 345 // BL is used to control backlight
wim 39:e9c2319de9c5 346 //
wim 39:e9c2319de9c5 347
wim 39:e9c2319de9c5 348 //I2C bus expander (MCP23008) interface
wim 39:e9c2319de9c5 349 #define LCD_BUS_I2C_D4 (1 << 0)
wim 39:e9c2319de9c5 350 #define LCD_BUS_I2C_D5 (1 << 1)
wim 39:e9c2319de9c5 351 #define LCD_BUS_I2C_D6 (1 << 2)
wim 39:e9c2319de9c5 352 #define LCD_BUS_I2C_D7 (1 << 3)
wim 39:e9c2319de9c5 353 #define LCD_BUS_I2C_RS (1 << 4)
wim 39:e9c2319de9c5 354 #define LCD_BUS_I2C_RW (1 << 5)
wim 39:e9c2319de9c5 355 #define LCD_BUS_I2C_BL (1 << 6)
wim 39:e9c2319de9c5 356 #define LCD_BUS_I2C_E (1 << 7)
wim 39:e9c2319de9c5 357
wim 39:e9c2319de9c5 358 #define LCD_BUS_I2C_E2 (1 << 5)
wim 39:e9c2319de9c5 359
wim 39:e9c2319de9c5 360 //SPI bus expander (74595) interface, same as I2C
wim 39:e9c2319de9c5 361 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4
wim 39:e9c2319de9c5 362 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5
wim 39:e9c2319de9c5 363 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6
wim 39:e9c2319de9c5 364 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7
wim 39:e9c2319de9c5 365 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS
wim 39:e9c2319de9c5 366 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW
wim 39:e9c2319de9c5 367 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL
wim 39:e9c2319de9c5 368 #define LCD_BUS_SPI_E LCD_BUS_I2C_E
wim 39:e9c2319de9c5 369
wim 39:e9c2319de9c5 370 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2
wim 39:e9c2319de9c5 371
wim 39:e9c2319de9c5 372 //Force I2C portexpander type
wim 39:e9c2319de9c5 373 #define PCF8574 0
wim 39:e9c2319de9c5 374 #define MCP23008 1
wim 39:e9c2319de9c5 375
wim 39:e9c2319de9c5 376 //Inverted Backlight control
wim 39:e9c2319de9c5 377 #define BACKLIGHT_INV 0
wim 39:e9c2319de9c5 378 #endif
wim 39:e9c2319de9c5 379
wim 39:e9c2319de9c5 380 #if (LCDPLUG==1)
wim 39:e9c2319de9c5 381 //Definitions for Jeelabs LCD_Plug I2C backpack mapping between serial port expander pins and LCD controller
wim 39:e9c2319de9c5 382 //This hardware uses an MCP23008 I2C expander.
wim 39:e9c2319de9c5 383 //Slaveaddress is hardcoded at 0x48. SDA/SCL has no pullup Resistors onboard.
wim 39:e9c2319de9c5 384 //See http://jeelabs.net/projects/hardware/wiki/lcd_plug
wim 39:e9c2319de9c5 385 //
wim 39:e9c2319de9c5 386 //Note: LCD RW pin must be kept LOW
wim 39:e9c2319de9c5 387 // E2 is available on a plug and so it does support LCD40x4 (second controller)
wim 39:e9c2319de9c5 388 // BL is used to control backlight
wim 39:e9c2319de9c5 389 //
wim 39:e9c2319de9c5 390
wim 39:e9c2319de9c5 391 //I2C bus expander (MCP23008) interface
wim 39:e9c2319de9c5 392 #define LCD_BUS_I2C_D4 (1 << 0)
wim 39:e9c2319de9c5 393 #define LCD_BUS_I2C_D5 (1 << 1)
wim 39:e9c2319de9c5 394 #define LCD_BUS_I2C_D6 (1 << 2)
wim 39:e9c2319de9c5 395 #define LCD_BUS_I2C_D7 (1 << 3)
wim 39:e9c2319de9c5 396 #define LCD_BUS_I2C_RS (1 << 4)
wim 39:e9c2319de9c5 397 #define LCD_BUS_I2C_E2 (1 << 5)
wim 39:e9c2319de9c5 398 #define LCD_BUS_I2C_E (1 << 6)
wim 39:e9c2319de9c5 399 #define LCD_BUS_I2C_BL (1 << 7)
wim 39:e9c2319de9c5 400
wim 39:e9c2319de9c5 401 #define LCD_BUS_I2C_RW (1 << 5)
wim 39:e9c2319de9c5 402
wim 39:e9c2319de9c5 403 //SPI bus expander (74595) interface, same as I2C
wim 39:e9c2319de9c5 404 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4
wim 39:e9c2319de9c5 405 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5
wim 39:e9c2319de9c5 406 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6
wim 39:e9c2319de9c5 407 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7
wim 39:e9c2319de9c5 408 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS
wim 39:e9c2319de9c5 409 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2
wim 39:e9c2319de9c5 410 #define LCD_BUS_SPI_E LCD_BUS_I2C_E
wim 39:e9c2319de9c5 411 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL
wim 39:e9c2319de9c5 412
wim 39:e9c2319de9c5 413 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW
wim 39:e9c2319de9c5 414
wim 39:e9c2319de9c5 415 //Force I2C portexpander type
wim 39:e9c2319de9c5 416 #define PCF8574 0
wim 39:e9c2319de9c5 417 #define MCP23008 1
wim 39:e9c2319de9c5 418
wim 39:e9c2319de9c5 419 //Inverted Backlight control
wim 39:e9c2319de9c5 420 #define BACKLIGHT_INV 0
wim 39:e9c2319de9c5 421 #endif
wim 39:e9c2319de9c5 422
wim 39:e9c2319de9c5 423
wim 34:e5a0dcb43ecc 424 //Bitpattern Defines for I2C PCF8574/PCF8574A, MCP23008 and SPI 74595 Bus expanders
wim 37:ce348c002929 425 //Don't change!
wim 38:cbe275b0b647 426 #define LCD_BUS_I2C_MSK (LCD_BUS_I2C_D4 | LCD_BUS_I2C_D5 | LCD_BUS_I2C_D6 | LCD_BUS_I2C_D7)
wim 38:cbe275b0b647 427 #if (BACKLIGHT_INV == 1)
wim 38:cbe275b0b647 428 #define LCD_BUS_I2C_DEF (0x00 | LCD_BUS_I2C_BL)
wim 38:cbe275b0b647 429 #else
wim 38:cbe275b0b647 430 #define LCD_BUS_I2C_DEF 0x00
wim 38:cbe275b0b647 431 #endif
wim 34:e5a0dcb43ecc 432
wim 38:cbe275b0b647 433 #define LCD_BUS_SPI_MSK (LCD_BUS_SPI_D4 | LCD_BUS_SPI_D5 | LCD_BUS_SPI_D6 | LCD_BUS_SPI_D7)
wim 38:cbe275b0b647 434 #if (BACKLIGHT_INV == 1)
wim 38:cbe275b0b647 435 #define LCD_BUS_SPI_DEF (0x00 | LCD_BUS_SPI_BL)
wim 38:cbe275b0b647 436 #else
wim 38:cbe275b0b647 437 #define LCD_BUS_SPI_DEF 0x00
wim 38:cbe275b0b647 438 #endif
wim 38:cbe275b0b647 439
wim 34:e5a0dcb43ecc 440
wim 34:e5a0dcb43ecc 441 /* PCF8574/PCF8574A I2C portexpander slave address */
wim 34:e5a0dcb43ecc 442 #define PCF8574_SA0 0x40
wim 34:e5a0dcb43ecc 443 #define PCF8574_SA1 0x42
wim 34:e5a0dcb43ecc 444 #define PCF8574_SA2 0x44
wim 34:e5a0dcb43ecc 445 #define PCF8574_SA3 0x46
wim 34:e5a0dcb43ecc 446 #define PCF8574_SA4 0x48
wim 34:e5a0dcb43ecc 447 #define PCF8574_SA5 0x4A
wim 34:e5a0dcb43ecc 448 #define PCF8574_SA6 0x4C
wim 34:e5a0dcb43ecc 449 #define PCF8574_SA7 0x4E
wim 34:e5a0dcb43ecc 450
wim 34:e5a0dcb43ecc 451 #define PCF8574A_SA0 0x70
wim 34:e5a0dcb43ecc 452 #define PCF8574A_SA1 0x72
wim 34:e5a0dcb43ecc 453 #define PCF8574A_SA2 0x74
wim 34:e5a0dcb43ecc 454 #define PCF8574A_SA3 0x76
wim 34:e5a0dcb43ecc 455 #define PCF8574A_SA4 0x78
wim 34:e5a0dcb43ecc 456 #define PCF8574A_SA5 0x7A
wim 34:e5a0dcb43ecc 457 #define PCF8574A_SA6 0x7C
wim 34:e5a0dcb43ecc 458 #define PCF8574A_SA7 0x7E
wim 34:e5a0dcb43ecc 459
wim 34:e5a0dcb43ecc 460 /* MCP23008 I2C portexpander slave address */
wim 34:e5a0dcb43ecc 461 #define MCP23008_SA0 0x40
wim 34:e5a0dcb43ecc 462 #define MCP23008_SA1 0x42
wim 34:e5a0dcb43ecc 463 #define MCP23008_SA2 0x44
wim 34:e5a0dcb43ecc 464 #define MCP23008_SA3 0x46
wim 34:e5a0dcb43ecc 465 #define MCP23008_SA4 0x48
wim 34:e5a0dcb43ecc 466 #define MCP23008_SA5 0x4A
wim 34:e5a0dcb43ecc 467 #define MCP23008_SA6 0x4C
wim 34:e5a0dcb43ecc 468 #define MCP23008_SA7 0x4E
wim 34:e5a0dcb43ecc 469
wim 34:e5a0dcb43ecc 470 /* MCP23008 I2C portexpander internal registers */
wim 34:e5a0dcb43ecc 471 #define IODIR 0x00
wim 34:e5a0dcb43ecc 472 #define IPOL 0x01
wim 34:e5a0dcb43ecc 473 #define GPINTEN 0x02
wim 34:e5a0dcb43ecc 474 #define DEFVAL 0x03
wim 34:e5a0dcb43ecc 475 #define INTCON 0x04
wim 34:e5a0dcb43ecc 476 #define IOCON 0x05
wim 34:e5a0dcb43ecc 477 #define GPPU 0x06
wim 34:e5a0dcb43ecc 478 #define INTF 0x07
wim 34:e5a0dcb43ecc 479 #define INTCAP 0x08
wim 34:e5a0dcb43ecc 480 #define GPIO 0x09
wim 34:e5a0dcb43ecc 481 #define OLAT 0x0A
wim 34:e5a0dcb43ecc 482
wim 34:e5a0dcb43ecc 483 /* ST7032i I2C slave address */
wim 34:e5a0dcb43ecc 484 #define ST7032_SA 0x7C
wim 34:e5a0dcb43ecc 485
wim 34:e5a0dcb43ecc 486 /* ST7036i I2C slave address */
wim 34:e5a0dcb43ecc 487 #define ST7036_SA0 0x78
wim 34:e5a0dcb43ecc 488 #define ST7036_SA1 0x7A
wim 34:e5a0dcb43ecc 489 #define ST7036_SA2 0x7C
wim 34:e5a0dcb43ecc 490 #define ST7036_SA3 0x7E
wim 34:e5a0dcb43ecc 491
wim 37:ce348c002929 492 /* ST7066_ACM I2C slave address, Added for ACM1602 module */
wim 37:ce348c002929 493 #define ST7066_SA0 0xA0
wim 37:ce348c002929 494
wim 34:e5a0dcb43ecc 495 /* PCF21XX I2C slave address */
wim 34:e5a0dcb43ecc 496 #define PCF21XX_SA0 0x74
wim 34:e5a0dcb43ecc 497 #define PCF21XX_SA1 0x76
wim 34:e5a0dcb43ecc 498
wim 34:e5a0dcb43ecc 499 /* AIP31068 I2C slave address */
wim 34:e5a0dcb43ecc 500 #define AIP31068_SA 0x7C
wim 34:e5a0dcb43ecc 501
wim 34:e5a0dcb43ecc 502 /* SSD1803 I2C slave address */
wim 34:e5a0dcb43ecc 503 #define SSD1803_SA0 0x78
wim 34:e5a0dcb43ecc 504 #define SSD1803_SA1 0x7A
wim 34:e5a0dcb43ecc 505
wim 34:e5a0dcb43ecc 506 /* US2066/SSD1311 I2C slave address */
wim 34:e5a0dcb43ecc 507 #define US2066_SA0 0x78
wim 34:e5a0dcb43ecc 508 #define US2066_SA1 0x7A
wim 34:e5a0dcb43ecc 509
wim 34:e5a0dcb43ecc 510 /* AC780 I2C slave address */
wim 34:e5a0dcb43ecc 511 #define AC780_SA0 0x78
wim 34:e5a0dcb43ecc 512 #define AC780_SA1 0x7A
wim 34:e5a0dcb43ecc 513 #define AC780_SA2 0x7C
wim 34:e5a0dcb43ecc 514 #define AC780_SA3 0x7E
wim 34:e5a0dcb43ecc 515
wim 34:e5a0dcb43ecc 516 //Some native I2C controllers dont support ACK. Set define to '0' to allow code to proceed even without ACK
wim 34:e5a0dcb43ecc 517 //#define LCD_I2C_ACK 0
wim 34:e5a0dcb43ecc 518 #define LCD_I2C_ACK 1
wim 34:e5a0dcb43ecc 519
wim 34:e5a0dcb43ecc 520
wim 34:e5a0dcb43ecc 521 // Contrast setting, 6 significant bits (only supported for controllers with extended features)
wim 34:e5a0dcb43ecc 522 // Voltage Multiplier setting, 2 or 3 significant bits (only supported for controllers with extended features)
wim 34:e5a0dcb43ecc 523 #define LCD_DEF_CONTRAST 0x20
wim 34:e5a0dcb43ecc 524
wim 34:e5a0dcb43ecc 525 //ST7032 EastRising ERC1602FS-4 display
wim 34:e5a0dcb43ecc 526 //Contrast setting 6 significant bits
wim 34:e5a0dcb43ecc 527 //Voltage Multiplier setting 3 significant bits
wim 37:ce348c002929 528 #define LCD_ST7032_CONTRAST 0x28
wim 34:e5a0dcb43ecc 529 #define LCD_ST7032_RAB 0x04
wim 34:e5a0dcb43ecc 530
wim 34:e5a0dcb43ecc 531 //ST7036 EA DOGM1603 display
wim 34:e5a0dcb43ecc 532 //Contrast setting 6 significant bits
wim 34:e5a0dcb43ecc 533 //Voltage Multiplier setting 3 significant bits
wim 34:e5a0dcb43ecc 534 #define LCD_ST7036_CONTRAST 0x28
wim 34:e5a0dcb43ecc 535 #define LCD_ST7036_RAB 0x04
wim 34:e5a0dcb43ecc 536
wim 34:e5a0dcb43ecc 537 //SSD1803 EA DOGM204 display
wim 34:e5a0dcb43ecc 538 //Contrast setting 6 significant bits
wim 34:e5a0dcb43ecc 539 //Voltage Multiplier setting 3 significant bits
wim 34:e5a0dcb43ecc 540 #define LCD_SSD1_CONTRAST 0x28
wim 34:e5a0dcb43ecc 541 #define LCD_SSD1_RAB 0x06
wim 34:e5a0dcb43ecc 542
wim 34:e5a0dcb43ecc 543 //US2066/SSD1311 EastRising ER-OLEDM2002-4 display
wim 34:e5a0dcb43ecc 544 //Contrast setting 8 significant bits, use 6 for compatibility
wim 34:e5a0dcb43ecc 545 #define LCD_US20_CONTRAST 0x3F
wim 34:e5a0dcb43ecc 546 //#define LCD_US20_CONTRAST 0x1F
wim 34:e5a0dcb43ecc 547
wim 34:e5a0dcb43ecc 548 //PCF2113, PCF2119 display
wim 34:e5a0dcb43ecc 549 //Contrast setting 6 significant bits
wim 34:e5a0dcb43ecc 550 //Voltage Multiplier setting 2 significant bits
wim 34:e5a0dcb43ecc 551 #define LCD_PCF2_CONTRAST 0x20
wim 34:e5a0dcb43ecc 552 #define LCD_PCF2_S12 0x02
wim 34:e5a0dcb43ecc 553
wim 34:e5a0dcb43ecc 554 //PT6314 VFD display
wim 34:e5a0dcb43ecc 555 //Contrast setting 2 significant bits, use 6 for compatibility
wim 34:e5a0dcb43ecc 556 #define LCD_PT63_CONTRAST 0x3F
wim 34:e5a0dcb43ecc 557
wim 34:e5a0dcb43ecc 558
wim 34:e5a0dcb43ecc 559 #endif //MBED_TEXTLCDCONFIG_H