Change to "#define DEFAULT 1" → "#define DEFAULT 0" and "#define LCM1602 0" → "#define LCM1602 1" in the TextLCD_Config.h

Dependents:   Test_TextLCD_F303K

Committer:
wim
Date:
Thu Aug 28 15:44:08 2014 +0000
Revision:
33:900a94bc7585
Parent:
32:59c4b8f648d4
Child:
34:e5a0dcb43ecc
Added support for controllers US2066/SSD1311 (OLED), added setUDCBlink method for supported devices (eg SSD1803), fixed issue in setPower()

Who changed what in which revision?

UserRevisionLine numberNew contents of line
simon 1:ac48b187213c 1 /* mbed TextLCD Library, for a 4-bit LCD based on HD44780
simon 6:e4cb7ddee0d3 2 * Copyright (c) 2007-2010, sford, http://mbed.org
wim 13:24506ba22480 3 * 2013, v01: WH, Added LCD types, fixed LCD address issues, added Cursor and UDCs
wim 15:b70ebfffb258 4 * 2013, v02: WH, Added I2C and SPI bus interfaces
wim 15:b70ebfffb258 5 * 2013, v03: WH, Added support for LCD40x4 which uses 2 controllers
wim 17:652ab113bc2e 6 * 2013, v04: WH, Added support for Display On/Off, improved 4bit bootprocess
wim 18:bd65dc10f27f 7 * 2013, v05: WH, Added support for 8x2B, added some UDCs
wim 19:c747b9e2e7b8 8 * 2013, v06: WH, Added support for devices that use internal DC/DC converters
wim 20:e0da005a777f 9 * 2013, v07: WH, Added support for backlight and include portdefinitions for LCD2004 Module from DFROBOT
wim 21:9eb628d9e164 10 * 2014, v08: WH, Refactored in Base and Derived Classes to deal with mbed lib change regarding 'NC' defined DigitalOut pins
wim 25:6162b31128c9 11 * 2014, v09: WH/EO, Added Class for Native SPI controllers such as ST7032
wim 26:bd897a001012 12 * 2014, v10: WH, Added Class for Native I2C controllers such as ST7032i, Added support for MCP23008 I2C portexpander, Added support for Adafruit module
wim 30:033048611c01 13 * 2014, v11: WH, Added support for native I2C controllers such as PCF21XX, Improved the _initCtrl() method to deal with differences between all supported controllers
wim 32:59c4b8f648d4 14 * 2014, v12: WH, Added support for native I2C controller PCF2119 and native I2C/SPI controllers SSD1803, ST7036, added setContrast method (by JH1PJL) for supported devices (eg ST7032i)
wim 33:900a94bc7585 15 * 2014, v13: WH, Added support for controllers US2066/SSD1311 (OLED), added setUDCBlink method for supported devices (eg SSD1803), fixed issue in setPower()
wim 33:900a94bc7585 16 *@Todo Add AC780S/KS0066i
simon 1:ac48b187213c 17 *
simon 1:ac48b187213c 18 * Permission is hereby granted, free of charge, to any person obtaining a copy
simon 1:ac48b187213c 19 * of this software and associated documentation files (the "Software"), to deal
simon 1:ac48b187213c 20 * in the Software without restriction, including without limitation the rights
simon 1:ac48b187213c 21 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
simon 1:ac48b187213c 22 * copies of the Software, and to permit persons to whom the Software is
simon 1:ac48b187213c 23 * furnished to do so, subject to the following conditions:
simon 2:227356c7d12c 24 *
simon 1:ac48b187213c 25 * The above copyright notice and this permission notice shall be included in
simon 1:ac48b187213c 26 * all copies or substantial portions of the Software.
simon 2:227356c7d12c 27 *
simon 1:ac48b187213c 28 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
simon 1:ac48b187213c 29 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
simon 1:ac48b187213c 30 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
simon 1:ac48b187213c 31 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
simon 1:ac48b187213c 32 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
simon 1:ac48b187213c 33 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
simon 1:ac48b187213c 34 * THE SOFTWARE.
simon 1:ac48b187213c 35 */
simon 1:ac48b187213c 36
simon 1:ac48b187213c 37 #ifndef MBED_TEXTLCD_H
simon 1:ac48b187213c 38 #define MBED_TEXTLCD_H
simon 1:ac48b187213c 39
simon 1:ac48b187213c 40 #include "mbed.h"
simon 2:227356c7d12c 41
simon 5:a53b3e2d6f1e 42 /** A TextLCD interface for driving 4-bit HD44780-based LCDs
simon 2:227356c7d12c 43 *
wim 32:59c4b8f648d4 44 * Currently supports 8x1, 8x2, 12x3, 12x4, 16x1, 16x2, 16x3, 16x4, 20x2, 20x4, 24x1, 24x2, 24x4, 40x2 and 40x4 panels
wim 27:22d5086f6ba6 45 * Interface options include direct mbed pins, I2C portexpander (PCF8474/PCF8574A or MCP23008) or SPI bus shiftregister (74595).
wim 27:22d5086f6ba6 46 * Supports some controllers with native I2C or SP interface. Supports some controllers that provide internal DC/DC converters for VLCD or VLED.
simon 2:227356c7d12c 47 *
simon 2:227356c7d12c 48 * @code
simon 2:227356c7d12c 49 * #include "mbed.h"
simon 2:227356c7d12c 50 * #include "TextLCD.h"
simon 5:a53b3e2d6f1e 51 *
wim 16:c276b75e6585 52 * // I2C Communication
wim 16:c276b75e6585 53 * I2C i2c_lcd(p28,p27); // SDA, SCL
wim 16:c276b75e6585 54 *
wim 16:c276b75e6585 55 * // SPI Communication
wim 16:c276b75e6585 56 * SPI spi_lcd(p5, NC, p7); // MOSI, MISO, SCLK
wim 16:c276b75e6585 57 *
wim 22:35742ec80c24 58 * //TextLCD lcd(p15, p16, p17, p18, p19, p20); // RS, E, D4-D7, LCDType=LCD16x2, BL=NC, E2=NC, LCDTCtrl=HD44780
wim 28:30fa94f7341c 59 * //TextLCD_SPI lcd(&spi_lcd, p8, TextLCD::LCD40x4); // SPI bus, 74595 expander, CS pin, LCD Type
wim 22:35742ec80c24 60 * TextLCD_I2C lcd(&i2c_lcd, 0x42, TextLCD::LCD20x4); // I2C bus, PCF8574 Slaveaddress, LCD Type
wim 21:9eb628d9e164 61 * //TextLCD_I2C lcd(&i2c_lcd, 0x42, TextLCD::LCD16x2, TextLCD::WS0010); // I2C bus, PCF8574 Slaveaddress, LCD Type, Device Type
wim 27:22d5086f6ba6 62 * //TextLCD_SPI_N lcd(&spi_lcd, p8, p9); // SPI bus, CS pin, RS pin, LCDType=LCD16x2, BL=NC, LCDTCtrl=ST7032_3V3
wim 28:30fa94f7341c 63 * //TextLCD_I2C_N lcd(&i2c_lcd, ST7032_SA, TextLCD::LCD16x2, NC, TextLCD::ST7032_3V3); // I2C bus, Slaveaddress, LCD Type, BL=NC, LCDTCtrl=ST7032_3V3
simon 5:a53b3e2d6f1e 64 *
simon 2:227356c7d12c 65 * int main() {
wim 16:c276b75e6585 66 * lcd.printf("Hello World!\n");
simon 2:227356c7d12c 67 * }
simon 2:227356c7d12c 68 * @endcode
simon 2:227356c7d12c 69 */
wim 8:03116f75b66e 70
wim 26:bd897a001012 71
wim 26:bd897a001012 72 //Pin Defines for I2C PCF8574/PCF8574A or MCP23008 and SPI 74595 bus expander interfaces
wim 13:24506ba22480 73 //LCD and serial portexpanders should be wired accordingly
wim 20:e0da005a777f 74 //
wim 26:bd897a001012 75 //Select Hardware module (one option only)
wim 31:ef31cd8a00d1 76 #define DEFAULT 1
wim 31:ef31cd8a00d1 77 #define ADAFRUIT 0
wim 26:bd897a001012 78 #define DFROBOT 0
wim 26:bd897a001012 79
wim 26:bd897a001012 80 #if (DEFAULT==1)
wim 29:a3663151aa65 81 //Definitions for default (WH) mapping between serial port expander pins and LCD controller
wim 26:bd897a001012 82 //This hardware supports the I2C bus expander (PCF8574/PCF8574A or MCP23008) and SPI bus expander (74595) interfaces
wim 29:a3663151aa65 83 //See https://mbed.org/cookbook/Text-LCD-Enhanced
wim 26:bd897a001012 84 //
wim 13:24506ba22480 85 //Note: LCD RW pin must be connected to GND
wim 15:b70ebfffb258 86 // E2 is used for LCD40x4 (second controller)
wim 26:bd897a001012 87 // BL may be used to control backlight
wim 15:b70ebfffb258 88 #define D_LCD_PIN_D4 0
wim 15:b70ebfffb258 89 #define D_LCD_PIN_D5 1
wim 15:b70ebfffb258 90 #define D_LCD_PIN_D6 2
wim 15:b70ebfffb258 91 #define D_LCD_PIN_D7 3
wim 15:b70ebfffb258 92 #define D_LCD_PIN_RS 4
wim 15:b70ebfffb258 93 #define D_LCD_PIN_E 5
wim 15:b70ebfffb258 94 #define D_LCD_PIN_E2 6
wim 15:b70ebfffb258 95 #define D_LCD_PIN_BL 7
wim 13:24506ba22480 96
wim 20:e0da005a777f 97 #define D_LCD_PIN_RW D_LCD_PIN_E2
wim 20:e0da005a777f 98
wim 26:bd897a001012 99 //Select I2C Portexpander type (one option only)
wim 26:bd897a001012 100 #define PCF8574 1
wim 26:bd897a001012 101 #define MCP23008 0
wim 26:bd897a001012 102 #endif
wim 20:e0da005a777f 103
wim 26:bd897a001012 104 #if (ADAFRUIT==1)
wim 29:a3663151aa65 105 //Definitions for Adafruit i2cspilcdbackpack mapping between serial port expander pins and LCD controller
wim 26:bd897a001012 106 //This hardware supports both an I2C expander (MCP23008) and an SPI expander (74595) selectable by a jumper.
wim 29:a3663151aa65 107 //See http://www.ladyada.net/products/i2cspilcdbackpack
wim 26:bd897a001012 108 //
wim 26:bd897a001012 109 //Note: LCD RW pin must be kept LOW
wim 26:bd897a001012 110 // E2 is not available on this hardware and so it does not support LCD40x4 (second controller)
wim 26:bd897a001012 111 // BL is used to control backlight
wim 26:bd897a001012 112 #define D_LCD_PIN_0 0
wim 26:bd897a001012 113 #define D_LCD_PIN_RS 1
wim 26:bd897a001012 114 #define D_LCD_PIN_E 2
wim 26:bd897a001012 115 #define D_LCD_PIN_D4 3
wim 26:bd897a001012 116 #define D_LCD_PIN_D5 4
wim 26:bd897a001012 117 #define D_LCD_PIN_D6 5
wim 26:bd897a001012 118 #define D_LCD_PIN_D7 6
wim 26:bd897a001012 119 #define D_LCD_PIN_BL 7
wim 26:bd897a001012 120
wim 26:bd897a001012 121 #define D_LCD_PIN_E2 D_LCD_PIN_0
wim 26:bd897a001012 122
wim 26:bd897a001012 123 //Force I2C portexpander type
wim 26:bd897a001012 124 #define PCF8574 0
wim 26:bd897a001012 125 #define MCP23008 1
wim 26:bd897a001012 126 #endif
wim 26:bd897a001012 127
wim 26:bd897a001012 128 #if (DFROBOT==1)
wim 29:a3663151aa65 129 //Definitions for DFROBOT LCD2004 Module mapping between serial port expander pins and LCD controller
wim 26:bd897a001012 130 //This hardware uses PCF8574 and is different from earlier/different Arduino I2C LCD displays
wim 29:a3663151aa65 131 //See http://arduino-info.wikispaces.com/LCD-Blue-I2C
wim 26:bd897a001012 132 //
wim 20:e0da005a777f 133 //Note: LCD RW pin must be kept LOW
wim 26:bd897a001012 134 // E2 is not available on default Arduino hardware and so it does not support LCD40x4 (second controller)
wim 33:900a94bc7585 135 // BL is used to control backlight, reverse logic: Low turns on Backlight. This is handled in setBacklight()
wim 20:e0da005a777f 136 #define D_LCD_PIN_RS 0
wim 20:e0da005a777f 137 #define D_LCD_PIN_RW 1
wim 20:e0da005a777f 138 #define D_LCD_PIN_E 2
wim 20:e0da005a777f 139 #define D_LCD_PIN_BL 3
wim 20:e0da005a777f 140 #define D_LCD_PIN_D4 4
wim 20:e0da005a777f 141 #define D_LCD_PIN_D5 5
wim 20:e0da005a777f 142 #define D_LCD_PIN_D6 6
wim 20:e0da005a777f 143 #define D_LCD_PIN_D7 7
wim 20:e0da005a777f 144
wim 20:e0da005a777f 145 #define D_LCD_PIN_E2 D_LCD_PIN_RW
wim 26:bd897a001012 146
wim 26:bd897a001012 147 //Force I2C portexpander type
wim 26:bd897a001012 148 #define PCF8574 1
wim 26:bd897a001012 149 #define MCP23008 0
wim 20:e0da005a777f 150 #endif
wim 13:24506ba22480 151
wim 26:bd897a001012 152 //Bitpattern Defines for I2C PCF8574/PCF8574A, MCP23008 and SPI 74595 Bus expanders
wim 13:24506ba22480 153 //
wim 13:24506ba22480 154 #define D_LCD_D4 (1<<D_LCD_PIN_D4)
wim 13:24506ba22480 155 #define D_LCD_D5 (1<<D_LCD_PIN_D5)
wim 13:24506ba22480 156 #define D_LCD_D6 (1<<D_LCD_PIN_D6)
wim 13:24506ba22480 157 #define D_LCD_D7 (1<<D_LCD_PIN_D7)
wim 13:24506ba22480 158 #define D_LCD_RS (1<<D_LCD_PIN_RS)
wim 13:24506ba22480 159 #define D_LCD_E (1<<D_LCD_PIN_E)
wim 13:24506ba22480 160 #define D_LCD_E2 (1<<D_LCD_PIN_E2)
wim 13:24506ba22480 161 #define D_LCD_BL (1<<D_LCD_PIN_BL)
wim 20:e0da005a777f 162 //#define D_LCD_RW (1<<D_LCD_PIN_RW)
wim 20:e0da005a777f 163
wim 20:e0da005a777f 164 #define D_LCD_BUS_MSK (D_LCD_D4 | D_LCD_D5 | D_LCD_D6 | D_LCD_D7)
wim 20:e0da005a777f 165 #define D_LCD_BUS_DEF 0x00
wim 13:24506ba22480 166
wim 26:bd897a001012 167 /* PCF8574/PCF8574A I2C portexpander slave address */
wim 30:033048611c01 168 #define PCF8574_SA0 0x40
wim 30:033048611c01 169 #define PCF8574_SA1 0x42
wim 30:033048611c01 170 #define PCF8574_SA2 0x44
wim 30:033048611c01 171 #define PCF8574_SA3 0x46
wim 30:033048611c01 172 #define PCF8574_SA4 0x48
wim 30:033048611c01 173 #define PCF8574_SA5 0x4A
wim 30:033048611c01 174 #define PCF8574_SA6 0x4C
wim 30:033048611c01 175 #define PCF8574_SA7 0x4E
wim 26:bd897a001012 176
wim 30:033048611c01 177 #define PCF8574A_SA0 0x70
wim 30:033048611c01 178 #define PCF8574A_SA1 0x72
wim 30:033048611c01 179 #define PCF8574A_SA2 0x74
wim 30:033048611c01 180 #define PCF8574A_SA3 0x76
wim 30:033048611c01 181 #define PCF8574A_SA4 0x78
wim 30:033048611c01 182 #define PCF8574A_SA5 0x7A
wim 30:033048611c01 183 #define PCF8574A_SA6 0x7C
wim 30:033048611c01 184 #define PCF8574A_SA7 0x7E
wim 26:bd897a001012 185
wim 26:bd897a001012 186 /* MCP23008 I2C portexpander slave address */
wim 30:033048611c01 187 #define MCP23008_SA0 0x40
wim 30:033048611c01 188 #define MCP23008_SA1 0x42
wim 30:033048611c01 189 #define MCP23008_SA2 0x44
wim 30:033048611c01 190 #define MCP23008_SA3 0x46
wim 30:033048611c01 191 #define MCP23008_SA4 0x48
wim 30:033048611c01 192 #define MCP23008_SA5 0x4A
wim 30:033048611c01 193 #define MCP23008_SA6 0x4C
wim 30:033048611c01 194 #define MCP23008_SA7 0x4E
wim 26:bd897a001012 195
wim 26:bd897a001012 196 /* MCP23008 I2C portexpander internal registers */
wim 30:033048611c01 197 #define IODIR 0x00
wim 30:033048611c01 198 #define IPOL 0x01
wim 30:033048611c01 199 #define GPINTEN 0x02
wim 30:033048611c01 200 #define DEFVAL 0x03
wim 30:033048611c01 201 #define INTCON 0x04
wim 30:033048611c01 202 #define IOCON 0x05
wim 30:033048611c01 203 #define GPPU 0x06
wim 30:033048611c01 204 #define INTF 0x07
wim 30:033048611c01 205 #define INTCAP 0x08
wim 30:033048611c01 206 #define GPIO 0x09
wim 30:033048611c01 207 #define OLAT 0x0A
wim 26:bd897a001012 208
wim 26:bd897a001012 209
wim 32:59c4b8f648d4 210 /* ST7032i I2C slave address */
wim 30:033048611c01 211 #define ST7032_SA 0x7C
wim 26:bd897a001012 212
wim 32:59c4b8f648d4 213 /* ST7036i I2C slave address */
wim 32:59c4b8f648d4 214 #define ST7036_SA0 0x78
wim 32:59c4b8f648d4 215 #define ST7036_SA1 0x7A
wim 32:59c4b8f648d4 216 #define ST7036_SA2 0x7C
wim 32:59c4b8f648d4 217 #define ST7036_SA3 0x7E
wim 32:59c4b8f648d4 218
wim 29:a3663151aa65 219 /* PCF21XX I2C slave address */
wim 30:033048611c01 220 #define PCF21XX_SA0 0x74
wim 30:033048611c01 221 #define PCF21XX_SA1 0x76
wim 30:033048611c01 222
wim 30:033048611c01 223 /* AIP31068 I2C slave address */
wim 30:033048611c01 224 #define AIP31068_SA 0x7C
wim 30:033048611c01 225
wim 32:59c4b8f648d4 226 /* SSD1803 I2C slave address */
wim 32:59c4b8f648d4 227 #define SSD1803_SA0 0x78
wim 32:59c4b8f648d4 228 #define SSD1803_SA1 0x7A
wim 32:59c4b8f648d4 229
wim 33:900a94bc7585 230 /* US2066/SSD1311 I2C slave address */
wim 32:59c4b8f648d4 231 #define US2066_SA0 0x78
wim 32:59c4b8f648d4 232 #define US2066_SA1 0x7A
wim 32:59c4b8f648d4 233
wim 33:900a94bc7585 234 /* AC780 I2C slave address */
wim 33:900a94bc7585 235 #define AC780_SA0 0x78
wim 33:900a94bc7585 236 #define AC780_SA1 0x7A
wim 33:900a94bc7585 237 #define AC780_SA2 0x7C
wim 33:900a94bc7585 238 #define AC780_SA3 0x7E
wim 32:59c4b8f648d4 239
wim 32:59c4b8f648d4 240 //Some native I2C controllers dont support ACK. Set define to '0' to allow code to proceed even without ACK
wim 32:59c4b8f648d4 241 //#define LCD_I2C_ACK 0
wim 32:59c4b8f648d4 242 #define LCD_I2C_ACK 1
wim 32:59c4b8f648d4 243
wim 30:033048611c01 244 /* LCD Type information on Rows, Columns and Variant. This information is encoded in
wim 30:033048611c01 245 * an int and used for the LCDType enumerators in order to simplify code maintenance */
wim 30:033048611c01 246 // Columns encoded in b7..b0
wim 30:033048611c01 247 #define LCD_T_COL_MSK 0x000000FF
wim 32:59c4b8f648d4 248 #define LCD_T_C6 0x00000006
wim 30:033048611c01 249 #define LCD_T_C8 0x00000008
wim 30:033048611c01 250 #define LCD_T_C10 0x0000000A
wim 30:033048611c01 251 #define LCD_T_C12 0x0000000C
wim 30:033048611c01 252 #define LCD_T_C16 0x00000010
wim 30:033048611c01 253 #define LCD_T_C20 0x00000014
wim 30:033048611c01 254 #define LCD_T_C24 0x00000018
wim 30:033048611c01 255 #define LCD_T_C32 0x00000020
wim 30:033048611c01 256 #define LCD_T_C40 0x00000028
wim 30:033048611c01 257
wim 30:033048611c01 258 // Rows encoded in b15..b8
wim 30:033048611c01 259 #define LCD_T_ROW_MSK 0x0000FF00
wim 30:033048611c01 260 #define LCD_T_R1 0x00000100
wim 30:033048611c01 261 #define LCD_T_R2 0x00000200
wim 30:033048611c01 262 #define LCD_T_R3 0x00000300
wim 30:033048611c01 263 #define LCD_T_R4 0x00000400
wim 30:033048611c01 264
wim 30:033048611c01 265 // Addressing mode encoded in b19..b16
wim 30:033048611c01 266 #define LCD_T_ADR_MSK 0x000F0000
wim 32:59c4b8f648d4 267 #define LCD_T_A 0x00000000 /*Mode A Default 1, 2 or 4 line display */
wim 32:59c4b8f648d4 268 #define LCD_T_B 0x00010000 /*Mode B, Alternate 8x2 (actually 16x1 display) */
wim 32:59c4b8f648d4 269 #define LCD_T_C 0x00020000 /*Mode C, Alternate 16x1 (actually 8x2 display) */
wim 32:59c4b8f648d4 270 #define LCD_T_D 0x00030000 /*Mode D, Alternate 3 or 4 line display (12x4, 20x4, 24x4) */
wim 32:59c4b8f648d4 271 #define LCD_T_D1 0x00040000 /*Mode D1, Alternate 3 out of 4 line display (12x3, 20x3, 24x3) */
wim 32:59c4b8f648d4 272 #define LCD_T_E 0x00050000 /*Mode E, 40x4 display (actually two 40x2) */
wim 32:59c4b8f648d4 273 #define LCD_T_F 0x00060000 /*Mode F, 16x3 display (actually 24x2) */
wim 32:59c4b8f648d4 274 #define LCD_T_G 0x00070000 /*Mode G, 16x3 display */
wim 30:033048611c01 275
wim 30:033048611c01 276 /* LCD Ctrl information on interface support and features. This information is encoded in
wim 30:033048611c01 277 * an int and used for the LCDCtrl enumerators in order to simplify code maintenance */
wim 30:033048611c01 278 // Interface encoded in b31..b24
wim 30:033048611c01 279 #define LCD_C_BUS_MSK 0xFF000000
wim 32:59c4b8f648d4 280 #define LCD_C_PAR 0x01000000 /*Parallel 4 or 8 bit data, E pin, RS pin, RW=GND */
wim 30:033048611c01 281 #define LCD_C_SPI3_9 0x02000000 /*SPI 3 line (MOSI, SCL, CS pins), 9 bits (RS + 8 Data) */
wim 30:033048611c01 282 #define LCD_C_SPI3_10 0x04000000 /*SPI 3 line (MOSI, SCL, CS pins), 10 bits (RS, RW + 8 Data) */
wim 32:59c4b8f648d4 283 #define LCD_C_SPI3_16 0x08000000 /*SPI 3 line (MOSI, SCL, CS pins), 16 bits (RS, RW + 8 Data) */
wim 32:59c4b8f648d4 284 #define LCD_C_SPI3_24 0x10000000 /*SPI 3 line (MOSI, SCL, CS pins), 24 bits (RS, RW + 8 Data) */
wim 32:59c4b8f648d4 285 #define LCD_C_SPI4 0x20000000 /*SPI 4 line (MOSI, SCL, CS, RS pin), RS pin + 8 Data */
wim 32:59c4b8f648d4 286 #define LCD_C_I2C 0x40000000 /*I2C (SDA, SCL pin), 8 control bits (Co, RS, RW) + 8 Data */
wim 30:033048611c01 287 // Features encoded in b23..b16
wim 30:033048611c01 288 #define LCD_C_FTR_MSK 0x00FF0000
wim 30:033048611c01 289 #define LCD_C_BST 0x00010000 /*Booster */
wim 32:59c4b8f648d4 290 #define LCD_C_CTR 0x00020000 /*Contrast Control */
wim 32:59c4b8f648d4 291 #define LCD_C_ICN 0x00040000 /*Icons */
wim 32:59c4b8f648d4 292 #define LCD_C_PDN 0x00080000 /*Power Down */
wim 32:59c4b8f648d4 293
wim 32:59c4b8f648d4 294
wim 33:900a94bc7585 295 // Contrast setting, 6 significant bits (only supported for controllers with extended features)
wim 32:59c4b8f648d4 296 // Voltage Multiplier setting, 2 or 3 significant bits (only supported for controllers with extended features)
wim 32:59c4b8f648d4 297 #define LCD_DEF_CONTRAST 0x20
wim 32:59c4b8f648d4 298
wim 33:900a94bc7585 299 //ST7032 EastRising ERC1602FS-4 display
wim 33:900a94bc7585 300 //Contrast setting 6 significant bits
wim 32:59c4b8f648d4 301 //Voltage Multiplier setting 3 significant bits
wim 32:59c4b8f648d4 302 #define LCD_ST7032_CONTRAST 0x18
wim 32:59c4b8f648d4 303 #define LCD_ST7032_RAB 0x04
wim 32:59c4b8f648d4 304
wim 33:900a94bc7585 305 //ST7036 EA DOGM1603 display
wim 33:900a94bc7585 306 //Contrast setting 6 significant bits
wim 33:900a94bc7585 307 //Voltage Multiplier setting 3 significant bits
wim 32:59c4b8f648d4 308 #define LCD_ST7036_CONTRAST 0x28
wim 32:59c4b8f648d4 309 #define LCD_ST7036_RAB 0x04
wim 32:59c4b8f648d4 310
wim 32:59c4b8f648d4 311 //SSD1803 EA DOGM204 display
wim 33:900a94bc7585 312 //Contrast setting 6 significant bits
wim 32:59c4b8f648d4 313 //Voltage Multiplier setting 3 significant bits
wim 32:59c4b8f648d4 314 #define LCD_SSD1_CONTRAST 0x28
wim 32:59c4b8f648d4 315 #define LCD_SSD1_RAB 0x06
wim 32:59c4b8f648d4 316
wim 33:900a94bc7585 317 //US2066/SSD1311 EastRising ER-OLEDM2002-4 display
wim 33:900a94bc7585 318 //Contrast setting 8 significant bits, use 6 for compatibility
wim 33:900a94bc7585 319 #define LCD_US20_CONTRAST 0x3F
wim 33:900a94bc7585 320 //#define LCD_US20_CONTRAST 0x1F
wim 32:59c4b8f648d4 321
wim 32:59c4b8f648d4 322 //PCF2113, PCF2119 display
wim 33:900a94bc7585 323 //Contrast setting 6 significant bits
wim 32:59c4b8f648d4 324 //Voltage Multiplier setting 2 significant bits
wim 32:59c4b8f648d4 325 #define LCD_PCF2_CONTRAST 0x20
wim 32:59c4b8f648d4 326 #define LCD_PCF2_S12 0x02
wim 32:59c4b8f648d4 327
wim 32:59c4b8f648d4 328 //PT6314 VFD display
wim 32:59c4b8f648d4 329 //Contrast setting 2 significant bits
wim 32:59c4b8f648d4 330 #define LCD_PT63_CONTRAST 0x00
wim 13:24506ba22480 331
wim 13:24506ba22480 332 /** Some sample User Defined Chars 5x7 dots */
wim 32:59c4b8f648d4 333 //extern const char udc_ae[]; //æ
wim 32:59c4b8f648d4 334 //extern const char udc_0e[]; //ø
wim 32:59c4b8f648d4 335 //extern const char udc_ao[]; //å
wim 32:59c4b8f648d4 336 //extern const char udc_AE[]; //Æ
wim 32:59c4b8f648d4 337 //extern const char udc_0E[]; //Ø
wim 32:59c4b8f648d4 338 //extern const char udc_Ao[]; //Å
wim 32:59c4b8f648d4 339 //extern const char udc_PO[]; //Padlock Open
wim 32:59c4b8f648d4 340 //extern const char udc_PC[]; //Padlock Closed
wim 32:59c4b8f648d4 341
wim 32:59c4b8f648d4 342 //extern const char udc_alpha[]; //alpha
wim 32:59c4b8f648d4 343 //extern const char udc_ohm[]; //ohm
wim 32:59c4b8f648d4 344 //extern const char udc_sigma[]; //sigma
wim 32:59c4b8f648d4 345 //extern const char udc_pi[]; //pi
wim 32:59c4b8f648d4 346 //extern const char udc_root[]; //root
wim 32:59c4b8f648d4 347
wim 11:9ec02df863a1 348
wim 30:033048611c01 349 extern const char udc_0[]; // |>
wim 30:033048611c01 350 extern const char udc_1[]; // <|
wim 30:033048611c01 351 extern const char udc_2[]; // |
wim 30:033048611c01 352 extern const char udc_3[]; // ||
wim 30:033048611c01 353 extern const char udc_4[]; // |||
wim 30:033048611c01 354 extern const char udc_5[]; // =
wim 30:033048611c01 355 extern const char udc_6[]; // checkerboard
wim 30:033048611c01 356 extern const char udc_7[]; // \
wim 11:9ec02df863a1 357
wim 30:033048611c01 358 extern const char udc_degr[]; // Degree symbol
wim 13:24506ba22480 359
wim 30:033048611c01 360 extern const char udc_TM_T[]; // Trademark T
wim 30:033048611c01 361 extern const char udc_TM_M[]; // Trademark M
wim 13:24506ba22480 362
wim 30:033048611c01 363 //extern const char udc_Bat_Hi[]; // Battery Full
wim 30:033048611c01 364 //extern const char udc_Bat_Ha[]; // Battery Half
wim 30:033048611c01 365 //extern const char udc_Bat_Lo[]; // Battery Low
wim 30:033048611c01 366 extern const char udc_Bat_Hi[]; // Battery Full
wim 30:033048611c01 367 extern const char udc_Bat_Ha[]; // Battery Half
wim 30:033048611c01 368 extern const char udc_Bat_Lo[]; // Battery Low
wim 30:033048611c01 369 extern const char udc_AC[]; // AC Power
wim 13:24506ba22480 370
wim 30:033048611c01 371 //extern const char udc_smiley[]; // Smiley
wim 30:033048611c01 372 //extern const char udc_droopy[]; // Droopey
wim 30:033048611c01 373 //extern const char udc_note[]; // Note
wim 18:bd65dc10f27f 374
wim 30:033048611c01 375 //extern const char udc_bar_1[]; // Bar 1
wim 30:033048611c01 376 //extern const char udc_bar_2[]; // Bar 11
wim 30:033048611c01 377 //extern const char udc_bar_3[]; // Bar 111
wim 30:033048611c01 378 //extern const char udc_bar_4[]; // Bar 1111
wim 30:033048611c01 379 //extern const char udc_bar_5[]; // Bar 11111
wim 13:24506ba22480 380
wim 30:033048611c01 381 //extern const char udc_ch_1[]; // Hor bars 4
wim 30:033048611c01 382 //extern const char udc_ch_2[]; // Hor bars 4 (inverted)
wim 30:033048611c01 383 //extern const char udc_ch_3[]; // Ver bars 3
wim 30:033048611c01 384 //extern const char udc_ch_4[]; // Ver bars 3 (inverted)
wim 30:033048611c01 385 //extern const char udc_ch_yr[]; // Year (kana)
wim 30:033048611c01 386 //extern const char udc_ch_mo[]; // Month (kana)
wim 30:033048611c01 387 //extern const char udc_ch_dy[]; // Day (kana)
wim 30:033048611c01 388 //extern const char udc_ch_mi[]; // minute (kana)
wim 32:59c4b8f648d4 389 extern const char udc_None[];
wim 32:59c4b8f648d4 390 extern const char udc_All[];
wim 11:9ec02df863a1 391
wim 11:9ec02df863a1 392 /** A TextLCD interface for driving 4-bit HD44780-based LCDs
wim 11:9ec02df863a1 393 *
wim 33:900a94bc7585 394 * @brief Currently supports 8x1, 8x2, 12x2, 12x3, 12x4, 16x1, 16x2, 16x3, 16x4, 20x2, 20x4, 24x2, 24x4, 40x2 and 40x4 panels
wim 27:22d5086f6ba6 395 * Interface options include direct mbed pins, I2C portexpander (PCF8474/PCF8574A or MCP23008) or SPI bus shiftregister (74595) and some native I2C or SPI devices
wim 11:9ec02df863a1 396 *
wim 11:9ec02df863a1 397 */
wim 21:9eb628d9e164 398 class TextLCD_Base : public Stream {
simon 1:ac48b187213c 399 public:
simon 1:ac48b187213c 400
simon 2:227356c7d12c 401 /** LCD panel format */
wim 33:900a94bc7585 402 // The commented out types exist but have not yet been tested with the library
simon 1:ac48b187213c 403 enum LCDType {
wim 32:59c4b8f648d4 404 // LCD6x1 = (LCD_T_A | LCD_T_C6 | LCD_T_R1), /**< 6x1 LCD panel */
wim 32:59c4b8f648d4 405 // LCD6x2 = (LCD_T_A | LCD_T_C6 | LCD_T_R2), /**< 6x2 LCD panel */
wim 30:033048611c01 406 LCD8x1 = (LCD_T_A | LCD_T_C8 | LCD_T_R1), /**< 8x1 LCD panel */
wim 30:033048611c01 407 LCD8x2 = (LCD_T_A | LCD_T_C8 | LCD_T_R2), /**< 8x2 LCD panel */
wim 30:033048611c01 408 LCD8x2B = (LCD_T_D | LCD_T_C8 | LCD_T_R2), /**< 8x2 LCD panel (actually 16x1) */
wim 30:033048611c01 409 // LCD12x1 = (LCD_T_A | LCD_T_C12 | LCD_T_R1), /**< 12x1 LCD panel */
wim 30:033048611c01 410 LCD12x2 = (LCD_T_A | LCD_T_C12 | LCD_T_R2), /**< 12x2 LCD panel */
wim 30:033048611c01 411 LCD12x3D = (LCD_T_D | LCD_T_C12 | LCD_T_R3), /**< 12x3 LCD panel, special mode PCF21XX */
wim 30:033048611c01 412 LCD12x3D1 = (LCD_T_D1 | LCD_T_C12 | LCD_T_R3), /**< 12x3 LCD panel, special mode PCF21XX */
wim 32:59c4b8f648d4 413 // LCD12x3G = (LCD_T_G | LCD_T_C12 | LCD_T_R3), /**< 12x3 LCD panel, special mode ST7036 */
wim 30:033048611c01 414 LCD12x4 = (LCD_T_A | LCD_T_C12 | LCD_T_R4), /**< 12x4 LCD panel */
wim 30:033048611c01 415 LCD12x4D = (LCD_T_B | LCD_T_C12 | LCD_T_R4), /**< 12x4 LCD panel, special mode PCF21XX */
wim 30:033048611c01 416 LCD16x1 = (LCD_T_A | LCD_T_C16 | LCD_T_R1), /**< 16x1 LCD panel */
wim 30:033048611c01 417 LCD16x1C = (LCD_T_C | LCD_T_C16 | LCD_T_R1), /**< 16x1 LCD panel (actually 8x2) */
wim 30:033048611c01 418 LCD16x2 = (LCD_T_A | LCD_T_C16 | LCD_T_R2), /**< 16x2 LCD panel (default) */
wim 30:033048611c01 419 // LCD16x2B = (LCD_T_B | LCD_T_C16 | LCD_T_R2), /**< 16x2 LCD panel, alternate addressing, wrong.. */
wim 32:59c4b8f648d4 420 LCD16x3D = (LCD_T_D | LCD_T_C16 | LCD_T_R3), /**< 16x3 LCD panel, special mode SSD1803 */
wim 32:59c4b8f648d4 421 // LCD16x3D1 = (LCD_T_D1 | LCD_T_C16 | LCD_T_R3), /**< 16x3 LCD panel, special mode SSD1803 */
wim 32:59c4b8f648d4 422 LCD16x3F = (LCD_T_F | LCD_T_C16 | LCD_T_R3), /**< 16x3 LCD panel (actually 24x2) */
wim 32:59c4b8f648d4 423 LCD16x3G = (LCD_T_G | LCD_T_C16 | LCD_T_R3), /**< 16x3 LCD panel, special mode ST7036 */
wim 30:033048611c01 424 LCD16x4 = (LCD_T_A | LCD_T_C16 | LCD_T_R4), /**< 16x4 LCD panel */
wim 32:59c4b8f648d4 425 // LCD16x4D = (LCD_T_D | LCD_T_C16 | LCD_T_R4), /**< 16x4 LCD panel, special mode SSD1803 */
wim 30:033048611c01 426 // LCD20x1 = (LCD_T_A | LCD_T_C20 | LCD_T_R1), /**< 20x1 LCD panel */
wim 30:033048611c01 427 LCD20x2 = (LCD_T_A | LCD_T_C20 | LCD_T_R2), /**< 20x2 LCD panel */
wim 32:59c4b8f648d4 428 // LCD20x3 = (LCD_T_A | LCD_T_C20 | LCD_T_R3), /**< 20x3 LCD panel */
wim 32:59c4b8f648d4 429 // LCD20x3D = (LCD_T_D | LCD_T_C20 | LCD_T_R3), /**< 20x3 LCD panel, special mode SSD1803 */
wim 32:59c4b8f648d4 430 // LCD20x3D1 = (LCD_T_D1 | LCD_T_C20 | LCD_T_R3), /**< 20x3 LCD panel, special mode SSD1803 */
wim 30:033048611c01 431 LCD20x4 = (LCD_T_A | LCD_T_C20 | LCD_T_R4), /**< 20x4 LCD panel */
wim 32:59c4b8f648d4 432 LCD20x4D = (LCD_T_D | LCD_T_C20 | LCD_T_R4), /**< 20x4 LCD panel, special mode SSD1803 */
wim 30:033048611c01 433 LCD24x1 = (LCD_T_A | LCD_T_C24 | LCD_T_R1), /**< 24x1 LCD panel */
wim 30:033048611c01 434 LCD24x2 = (LCD_T_A | LCD_T_C24 | LCD_T_R2), /**< 24x2 LCD panel */
wim 32:59c4b8f648d4 435 // LCD24x3D = (LCD_T_D | LCD_T_C24 | LCD_T_R3), /**< 24x3 LCD panel */
wim 32:59c4b8f648d4 436 // LCD24x3D1 = (LCD_T_D | LCD_T_C24 | LCD_T_R3), /**< 24x3 LCD panel */
wim 30:033048611c01 437 LCD24x4D = (LCD_T_D | LCD_T_C24 | LCD_T_R4), /**< 24x4 LCD panel, special mode KS0078 */
wim 33:900a94bc7585 438 // LCD32x1 = (LCD_T_A | LCD_T_C32 | LCD_T_R1), /**< 32x1 LCD panel */
wim 33:900a94bc7585 439 // LCD32x1C = (LCD_T_C | LCD_T_C32 | LCD_T_R1), /**< 32x1 LCD panel (actually 16x2) */
wim 32:59c4b8f648d4 440 // LCD32x2 = (LCD_T_A | LCD_T_C32 | LCD_T_R2), /**< 32x2 LCD panel */
wim 32:59c4b8f648d4 441 // LCD32x4 = (LCD_T_A | LCD_T_C32 | LCD_T_R4), /**< 32x4 LCD panel */
wim 30:033048611c01 442 // LCD40x1 = (LCD_T_A | LCD_T_C40 | LCD_T_R1), /**< 40x1 LCD panel */
wim 33:900a94bc7585 443 // LCD40x1C = (LCD_T_C | LCD_T_C40 | LCD_T_R1), /**< 40x1 LCD panel (actually 20x2) */
wim 30:033048611c01 444 LCD40x2 = (LCD_T_A | LCD_T_C40 | LCD_T_R2), /**< 40x2 LCD panel */
wim 30:033048611c01 445 LCD40x4 = (LCD_T_E | LCD_T_C40 | LCD_T_R4) /**< 40x4 LCD panel, Two controller version */
wim 30:033048611c01 446 };
wim 30:033048611c01 447
wim 30:033048611c01 448
wim 30:033048611c01 449 /** LCD Controller Device */
wim 30:033048611c01 450 enum LCDCtrl {
wim 32:59c4b8f648d4 451 HD44780 = 0 | LCD_C_PAR, /**< HD44780 or full equivalent (default) */
wim 32:59c4b8f648d4 452 WS0010 = 1 | (LCD_C_PAR | LCD_C_SPI3_10 | LCD_C_BST), /**< WS0010 OLED Controller, 4/8 bit, SPI3 */
wim 32:59c4b8f648d4 453 ST7036_3V3 = 2 | (LCD_C_PAR | LCD_C_SPI4 | LCD_C_I2C | LCD_C_BST | LCD_C_CTR), /**< ST7036 3V3 with Booster, 4/8 bit, SPI4, I2C */
wim 32:59c4b8f648d4 454 ST7036_5V = 3 | (LCD_C_PAR | LCD_C_SPI4 | LCD_C_I2C | LCD_C_BST | LCD_C_CTR), /**< ST7036 5V no Booster, 4/8 bit, SPI4, I2C */
wim 32:59c4b8f648d4 455 ST7032_3V3 = 4 | (LCD_C_PAR | LCD_C_SPI4 | LCD_C_I2C | LCD_C_BST | LCD_C_CTR), /**< ST7032 3V3 with Booster, 4/8 bit, SPI4, I2C */
wim 32:59c4b8f648d4 456 ST7032_5V = 5 | (LCD_C_PAR | LCD_C_SPI4 | LCD_C_I2C | LCD_C_CTR), /**< ST7032 5V no Booster, 4/8 bit, SPI4, I2C */
wim 32:59c4b8f648d4 457 KS0078 = 6 | (LCD_C_PAR | LCD_C_SPI3_24), /**< KS0078 24x4 support, 4/8 bit, SPI3 */
wim 32:59c4b8f648d4 458 PCF2113_3V3 = 7 | (LCD_C_PAR | LCD_C_I2C | LCD_C_BST | LCD_C_CTR), /**< PCF2113 3V3 with Booster, 4/8 bit, I2C */
wim 32:59c4b8f648d4 459 PCF2116_3V3 = 8 | (LCD_C_PAR | LCD_C_I2C | LCD_C_BST), /**< PCF2116 3V3 with Booster, 4/8 bit, I2C */
wim 32:59c4b8f648d4 460 PCF2116_5V = 9 | (LCD_C_PAR | LCD_C_I2C), /**< PCF2116 5V no Booster, 4/8 bit, I2C */
wim 32:59c4b8f648d4 461 PCF2119_3V3 = 10 | (LCD_C_PAR | LCD_C_I2C | LCD_C_BST | LCD_C_CTR), /**< PCF2119 3V3 with Booster, 4/8 bit, I2C */
wim 32:59c4b8f648d4 462 // PCF2119_5V = 11 | (LCD_C_PAR | LCD_C_I2C), /**< PCF2119 5V no Booster, 4/8 bit, I2C */
wim 32:59c4b8f648d4 463 AIP31068 = 12 | (LCD_C_SPI3_9 | LCD_C_I2C | LCD_C_BST), /**< AIP31068 I2C, SPI3 */
wim 33:900a94bc7585 464 SSD1803_3V3 = 13 | (LCD_C_PAR | LCD_C_SPI3_24 | LCD_C_I2C | LCD_C_BST | LCD_C_CTR | LCD_C_PDN), /**< SSD1803 3V3 with Booster, 4/8 bit, I2C, SPI3 */
wim 33:900a94bc7585 465 // SSD1803_5V = 14 | (LCD_C_PAR | LCD_C_SPI3_24 | LCD_C_I2C | LCD_C_BST | LCD_C_CTR | LCD_C_PDN), /**< SSD1803 3V3 with Booster, 4/8 bit, I2C, SPI3 */
wim 33:900a94bc7585 466 US2066_3V3 = 15 | (LCD_C_PAR | LCD_C_SPI3_24 | LCD_C_I2C | LCD_C_CTR | LCD_C_PDN), /**< US2066/SSD1311 3V3, 4/8 bit, I2C, SPI3 */
wim 33:900a94bc7585 467 // PT6314 = 16 | (LCD_C_PAR | LCD_C_SPI3_16 | LCD_C_CTR | LCD_C_PDN), /**< PT6314 VFD, 4/8 bit, SPI3 */
wim 33:900a94bc7585 468 // AC780 = 17 | (LCD_C_PAR | LCD_C_SPI4 | LCD_C_I2C | LCD_C_PDN), /**< AC780 4/8 bit, SPI, I2C */
wim 33:900a94bc7585 469 // KS0066 = 18 | (LCD_C_PAR | LCD_C_SPI4 | LCD_C_I2C | LCD_C_PDN) /**< KS0066i == AC780 4/8 bit, SPI, I2C */
wim 30:033048611c01 470 };
wim 30:033048611c01 471
wim 30:033048611c01 472
wim 10:dd9b3a696acd 473 /** LCD Cursor control */
wim 10:dd9b3a696acd 474 enum LCDCursor {
wim 17:652ab113bc2e 475 CurOff_BlkOff = 0x00, /**< Cursor Off, Blinking Char Off */
wim 17:652ab113bc2e 476 CurOn_BlkOff = 0x02, /**< Cursor On, Blinking Char Off */
wim 17:652ab113bc2e 477 CurOff_BlkOn = 0x01, /**< Cursor Off, Blinking Char On */
wim 17:652ab113bc2e 478 CurOn_BlkOn = 0x03 /**< Cursor On, Blinking Char On */
wim 17:652ab113bc2e 479 };
wim 17:652ab113bc2e 480
wim 17:652ab113bc2e 481 /** LCD Display control */
wim 17:652ab113bc2e 482 enum LCDMode {
wim 17:652ab113bc2e 483 DispOff = 0x00, /**< Display Off */
wim 17:652ab113bc2e 484 DispOn = 0x04 /**< Display On */
wim 10:dd9b3a696acd 485 };
wim 10:dd9b3a696acd 486
wim 20:e0da005a777f 487 /** LCD Backlight control */
wim 20:e0da005a777f 488 enum LCDBacklight {
wim 20:e0da005a777f 489 LightOff, /**< Backlight Off */
wim 20:e0da005a777f 490 LightOn /**< Backlight On */
wim 20:e0da005a777f 491 };
wim 10:dd9b3a696acd 492
wim 33:900a94bc7585 493 /** LCD Blink control (UDC), supported for some Controllers */
wim 33:900a94bc7585 494 enum LCDBlink {
wim 33:900a94bc7585 495 BlinkOff, /**< Blink Off */
wim 33:900a94bc7585 496 BlinkOn /**< Blink On */
wim 33:900a94bc7585 497 };
wim 33:900a94bc7585 498
wim 33:900a94bc7585 499 /** LCD Orientation control, supported for some Controllers */
wim 33:900a94bc7585 500 enum LCDOrient {
wim 33:900a94bc7585 501 Top, /**< Top view */
wim 33:900a94bc7585 502 Bottom /**< Upside down view */
wim 33:900a94bc7585 503 };
wim 33:900a94bc7585 504
wim 33:900a94bc7585 505
simon 2:227356c7d12c 506 #if DOXYGEN_ONLY
simon 2:227356c7d12c 507 /** Write a character to the LCD
simon 2:227356c7d12c 508 *
simon 2:227356c7d12c 509 * @param c The character to write to the display
simon 2:227356c7d12c 510 */
simon 2:227356c7d12c 511 int putc(int c);
simon 2:227356c7d12c 512
simon 2:227356c7d12c 513 /** Write a formated string to the LCD
simon 2:227356c7d12c 514 *
simon 2:227356c7d12c 515 * @param format A printf-style format string, followed by the
simon 2:227356c7d12c 516 * variables to use in formating the string.
simon 2:227356c7d12c 517 */
simon 2:227356c7d12c 518 int printf(const char* format, ...);
simon 2:227356c7d12c 519 #endif
simon 2:227356c7d12c 520
wim 29:a3663151aa65 521 /** Locate cursor to a screen column and row
simon 2:227356c7d12c 522 *
simon 2:227356c7d12c 523 * @param column The horizontal position from the left, indexed from 0
simon 2:227356c7d12c 524 * @param row The vertical position from the top, indexed from 0
simon 2:227356c7d12c 525 */
simon 1:ac48b187213c 526 void locate(int column, int row);
simon 2:227356c7d12c 527
wim 10:dd9b3a696acd 528 /** Return the memoryaddress of screen column and row location
wim 10:dd9b3a696acd 529 *
wim 10:dd9b3a696acd 530 * @param column The horizontal position from the left, indexed from 0
wim 10:dd9b3a696acd 531 * @param row The vertical position from the top, indexed from 0
wim 10:dd9b3a696acd 532 * @param return The memoryaddress of screen column and row location
wim 10:dd9b3a696acd 533 */
wim 30:033048611c01 534 int getAddress(int column, int row);
wim 10:dd9b3a696acd 535
wim 10:dd9b3a696acd 536 /** Set the memoryaddress of screen column and row location
wim 10:dd9b3a696acd 537 *
wim 10:dd9b3a696acd 538 * @param column The horizontal position from the left, indexed from 0
wim 10:dd9b3a696acd 539 * @param row The vertical position from the top, indexed from 0
wim 10:dd9b3a696acd 540 */
wim 9:0893d986e717 541 void setAddress(int column, int row);
wim 9:0893d986e717 542
wim 22:35742ec80c24 543 /** Clear the screen and locate to 0,0
wim 22:35742ec80c24 544 */
simon 1:ac48b187213c 545 void cls();
simon 2:227356c7d12c 546
wim 10:dd9b3a696acd 547 /** Return the number of rows
wim 10:dd9b3a696acd 548 *
wim 10:dd9b3a696acd 549 * @param return The number of rows
wim 10:dd9b3a696acd 550 */
simon 1:ac48b187213c 551 int rows();
wim 10:dd9b3a696acd 552
wim 10:dd9b3a696acd 553 /** Return the number of columns
wim 10:dd9b3a696acd 554 *
wim 10:dd9b3a696acd 555 * @param return The number of columns
wim 10:dd9b3a696acd 556 */
wim 10:dd9b3a696acd 557 int columns();
simon 2:227356c7d12c 558
wim 11:9ec02df863a1 559 /** Set the Cursormode
wim 11:9ec02df863a1 560 *
wim 17:652ab113bc2e 561 * @param cursorMode The Cursor mode (CurOff_BlkOff, CurOn_BlkOff, CurOff_BlkOn, CurOn_BlkOn)
wim 11:9ec02df863a1 562 */
wim 17:652ab113bc2e 563 void setCursor(LCDCursor cursorMode);
wim 17:652ab113bc2e 564
wim 17:652ab113bc2e 565 /** Set the Displaymode
wim 17:652ab113bc2e 566 *
wim 17:652ab113bc2e 567 * @param displayMode The Display mode (DispOff, DispOn)
wim 17:652ab113bc2e 568 */
wim 21:9eb628d9e164 569 void setMode(LCDMode displayMode);
wim 11:9ec02df863a1 570
wim 20:e0da005a777f 571 /** Set the Backlight mode
wim 20:e0da005a777f 572 *
wim 21:9eb628d9e164 573 * @param backlightMode The Backlight mode (LightOff, LightOn)
wim 20:e0da005a777f 574 */
wim 21:9eb628d9e164 575 void setBacklight(LCDBacklight backlightMode);
wim 20:e0da005a777f 576
wim 33:900a94bc7585 577 /** Set User Defined Characters (UDC)
wim 11:9ec02df863a1 578 *
wim 11:9ec02df863a1 579 * @param unsigned char c The Index of the UDC (0..7)
wim 12:6bf9d9957d31 580 * @param char *udc_data The bitpatterns for the UDC (8 bytes of 5 significant bits)
wim 11:9ec02df863a1 581 */
wim 11:9ec02df863a1 582 void setUDC(unsigned char c, char *udc_data);
wim 11:9ec02df863a1 583
wim 33:900a94bc7585 584 /** Set UDC Blink
wim 33:900a94bc7585 585 * setUDCBlink method is supported by some compatible devices (eg SSD1803)
wim 33:900a94bc7585 586 *
wim 33:900a94bc7585 587 * @param blinkMode The Blink mode (BlinkOff, BlinkOn)
wim 33:900a94bc7585 588 */
wim 33:900a94bc7585 589 void setUDCBlink(LCDBlink blinkMode);
wim 33:900a94bc7585 590
wim 32:59c4b8f648d4 591 /** Set Contrast
wim 32:59c4b8f648d4 592 * setContrast method is supported by some compatible devices (eg ST7032i) that have onboard LCD voltage generation
wim 32:59c4b8f648d4 593 * Code imported from fork by JH1PJL
wim 32:59c4b8f648d4 594 *
wim 32:59c4b8f648d4 595 * @param unsigned char c contrast data (6 significant bits, valid range 0..63, Value 0 will disable the Vgen)
wim 32:59c4b8f648d4 596 * @return none
wim 32:59c4b8f648d4 597 */
wim 32:59c4b8f648d4 598 void setContrast(unsigned char c = LCD_DEF_CONTRAST);
wim 32:59c4b8f648d4 599
wim 32:59c4b8f648d4 600 /** Set Power
wim 32:59c4b8f648d4 601 * setPower method is supported by some compatible devices (eg SSD1803) that have power down modes
wim 32:59c4b8f648d4 602 *
wim 32:59c4b8f648d4 603 * @param bool powerOn Power on/off
wim 32:59c4b8f648d4 604 * @return none
wim 32:59c4b8f648d4 605 */
wim 32:59c4b8f648d4 606 void setPower(bool powerOn = true);
wim 32:59c4b8f648d4 607
wim 33:900a94bc7585 608 /** Set Orient
wim 33:900a94bc7585 609 * setOrient method is supported by some compatible devices (eg SSD1803, US2066) that have top/bottom view modes
wim 33:900a94bc7585 610 *
wim 33:900a94bc7585 611 * @param LCDOrient orient Orientation
wim 33:900a94bc7585 612 * @return none
wim 33:900a94bc7585 613 */
wim 33:900a94bc7585 614 void setOrient(LCDOrient orient = Top);
wim 33:900a94bc7585 615
wim 32:59c4b8f648d4 616
wim 29:a3663151aa65 617 //test
wim 30:033048611c01 618 // void _initCtrl();
wim 29:a3663151aa65 619
simon 1:ac48b187213c 620 protected:
wim 13:24506ba22480 621
wim 21:9eb628d9e164 622 /** LCD controller select, mainly used for LCD40x4
wim 21:9eb628d9e164 623 */
wim 19:c747b9e2e7b8 624 enum _LCDCtrl_Idx {
wim 15:b70ebfffb258 625 _LCDCtrl_0, /*< Primary */
wim 15:b70ebfffb258 626 _LCDCtrl_1, /*< Secondary */
wim 15:b70ebfffb258 627 };
wim 21:9eb628d9e164 628
wim 21:9eb628d9e164 629 /** Create a TextLCD_Base interface
wim 21:9eb628d9e164 630 * @brief Base class, can not be instantiated
wim 21:9eb628d9e164 631 *
wim 21:9eb628d9e164 632 * @param type Sets the panel size/addressing mode (default = LCD16x2)
wim 21:9eb628d9e164 633 * @param ctrl LCD controller (default = HD44780)
wim 21:9eb628d9e164 634 */
wim 21:9eb628d9e164 635 TextLCD_Base(LCDType type = LCD16x2, LCDCtrl ctrl = HD44780);
wim 15:b70ebfffb258 636
simon 1:ac48b187213c 637 // Stream implementation functions
simon 1:ac48b187213c 638 virtual int _putc(int value);
simon 1:ac48b187213c 639 virtual int _getc();
simon 1:ac48b187213c 640
wim 29:a3663151aa65 641 /** Low level method for LCD controller
wim 21:9eb628d9e164 642 */
wim 13:24506ba22480 643 void _init();
wim 29:a3663151aa65 644
wim 29:a3663151aa65 645 /** Low level initialisation method for LCD controller
wim 29:a3663151aa65 646 */
wim 30:033048611c01 647 void _initCtrl();
wim 29:a3663151aa65 648
wim 29:a3663151aa65 649 /** Low level character address set method
wim 29:a3663151aa65 650 */
wim 13:24506ba22480 651 int _address(int column, int row);
wim 29:a3663151aa65 652
wim 29:a3663151aa65 653 /** Low level cursor enable or disable method
wim 29:a3663151aa65 654 */
wim 21:9eb628d9e164 655 void _setCursor(LCDCursor show);
wim 29:a3663151aa65 656
wim 29:a3663151aa65 657 /** Low level method to store user defined characters for current controller
wim 29:a3663151aa65 658 */
wim 17:652ab113bc2e 659 void _setUDC(unsigned char c, char *udc_data);
wim 29:a3663151aa65 660
wim 29:a3663151aa65 661 /** Low level method to restore the cursortype and display mode for current controller
wim 29:a3663151aa65 662 */
wim 21:9eb628d9e164 663 void _setCursorAndDisplayMode(LCDMode displayMode, LCDCursor cursorType);
wim 13:24506ba22480 664
wim 29:a3663151aa65 665 /** Low level nibble write operation to LCD controller (serial or parallel)
wim 21:9eb628d9e164 666 */
wim 17:652ab113bc2e 667 void _writeNibble(int value);
wim 29:a3663151aa65 668
wim 29:a3663151aa65 669 /** Low level command byte write operation to LCD controller.
wim 29:a3663151aa65 670 * Methods resets the RS bit and provides the required timing for the command.
wim 29:a3663151aa65 671 */
wim 15:b70ebfffb258 672 void _writeCommand(int command);
wim 33:900a94bc7585 673
wim 29:a3663151aa65 674 /** Low level data byte write operation to LCD controller (serial or parallel).
wim 29:a3663151aa65 675 * Methods sets the RS bit and provides the required timing for the data.
wim 29:a3663151aa65 676 */
wim 15:b70ebfffb258 677 void _writeData(int data);
wim 15:b70ebfffb258 678
wim 29:a3663151aa65 679 /** Pure Virtual Low level writes to LCD Bus (serial or parallel)
wim 29:a3663151aa65 680 * Set the Enable pin.
wim 29:a3663151aa65 681 */
wim 29:a3663151aa65 682 virtual void _setEnable(bool value) = 0;
wim 29:a3663151aa65 683
wim 21:9eb628d9e164 684 /** Pure Virtual Low level writes to LCD Bus (serial or parallel)
wim 29:a3663151aa65 685 * Set the RS pin ( 0 = Command, 1 = Data).
wim 29:a3663151aa65 686 */
wim 21:9eb628d9e164 687 virtual void _setRS(bool value) = 0;
wim 29:a3663151aa65 688
wim 29:a3663151aa65 689 /** Pure Virtual Low level writes to LCD Bus (serial or parallel)
wim 29:a3663151aa65 690 * Set the BL pin (0 = Backlight Off, 1 = Backlight On).
wim 29:a3663151aa65 691 */
wim 21:9eb628d9e164 692 virtual void _setBL(bool value) = 0;
wim 29:a3663151aa65 693
wim 29:a3663151aa65 694 /** Pure Virtual Low level writes to LCD Bus (serial or parallel)
wim 29:a3663151aa65 695 * Set the databus value (4 bit).
wim 29:a3663151aa65 696 */
wim 21:9eb628d9e164 697 virtual void _setData(int value) = 0;
wim 13:24506ba22480 698
wim 29:a3663151aa65 699 /** Low level byte write operation to LCD controller (serial or parallel)
wim 29:a3663151aa65 700 * Depending on the RS pin this byte will be interpreted as data or command
wim 29:a3663151aa65 701 */
wim 29:a3663151aa65 702 virtual void _writeByte(int value);
wim 33:900a94bc7585 703
wim 13:24506ba22480 704 //Display type
simon 1:ac48b187213c 705 LCDType _type;
wim 30:033048611c01 706 int _nr_cols;
wim 30:033048611c01 707 int _nr_rows;
wim 30:033048611c01 708 int _addr_mode;
wim 30:033048611c01 709
wim 21:9eb628d9e164 710 //Display mode
wim 17:652ab113bc2e 711 LCDMode _currentMode;
wim 17:652ab113bc2e 712
wim 19:c747b9e2e7b8 713 //Controller type
wim 19:c747b9e2e7b8 714 LCDCtrl _ctrl;
wim 19:c747b9e2e7b8 715
wim 15:b70ebfffb258 716 //Controller select, mainly used for LCD40x4
wim 19:c747b9e2e7b8 717 _LCDCtrl_Idx _ctrl_idx;
wim 15:b70ebfffb258 718
wim 13:24506ba22480 719 // Cursor
simon 1:ac48b187213c 720 int _column;
simon 1:ac48b187213c 721 int _row;
wim 32:59c4b8f648d4 722 LCDCursor _currentCursor;
wim 32:59c4b8f648d4 723
wim 32:59c4b8f648d4 724 // Function mode saved to allow switch between Instruction sets after initialisation time
wim 32:59c4b8f648d4 725 // Icon, Booster mode and contrast saved to allow contrast change at later time
wim 32:59c4b8f648d4 726 // Only available for controllers with added features
wim 32:59c4b8f648d4 727 int _function, _function_1, _function_x;
wim 32:59c4b8f648d4 728 int _icon_power;
wim 32:59c4b8f648d4 729 int _contrast;
wim 32:59c4b8f648d4 730
simon 1:ac48b187213c 731 };
simon 1:ac48b187213c 732
wim 23:d47f226efb24 733 //--------- End TextLCD_Base -----------
wim 22:35742ec80c24 734
wim 22:35742ec80c24 735
wim 22:35742ec80c24 736
wim 23:d47f226efb24 737 //--------- Start TextLCD Bus -----------
wim 21:9eb628d9e164 738
wim 21:9eb628d9e164 739 /** Create a TextLCD interface for using regular mbed pins
wim 21:9eb628d9e164 740 *
wim 21:9eb628d9e164 741 */
wim 21:9eb628d9e164 742 class TextLCD : public TextLCD_Base {
wim 21:9eb628d9e164 743 public:
wim 21:9eb628d9e164 744 /** Create a TextLCD interface for using regular mbed pins
wim 21:9eb628d9e164 745 *
wim 21:9eb628d9e164 746 * @param rs Instruction/data control line
wim 21:9eb628d9e164 747 * @param e Enable line (clock)
wim 21:9eb628d9e164 748 * @param d4-d7 Data lines for using as a 4-bit interface
wim 21:9eb628d9e164 749 * @param type Sets the panel size/addressing mode (default = LCD16x2)
wim 21:9eb628d9e164 750 * @param bl Backlight control line (optional, default = NC)
wim 21:9eb628d9e164 751 * @param e2 Enable2 line (clock for second controller, LCD40x4 only)
wim 21:9eb628d9e164 752 * @param ctrl LCD controller (default = HD44780)
wim 21:9eb628d9e164 753 */
wim 21:9eb628d9e164 754 TextLCD(PinName rs, PinName e, PinName d4, PinName d5, PinName d6, PinName d7, LCDType type = LCD16x2, PinName bl = NC, PinName e2 = NC, LCDCtrl ctrl = HD44780);
wim 21:9eb628d9e164 755
wim 22:35742ec80c24 756 /** Destruct a TextLCD interface for using regular mbed pins
wim 22:35742ec80c24 757 *
wim 22:35742ec80c24 758 * @param none
wim 22:35742ec80c24 759 * @return none
wim 22:35742ec80c24 760 */
wim 22:35742ec80c24 761 virtual ~TextLCD();
wim 22:35742ec80c24 762
wim 21:9eb628d9e164 763 private:
wim 29:a3663151aa65 764
wim 29:a3663151aa65 765 /** Implementation of pure Virtual Low level writes to LCD Bus (parallel)
wim 29:a3663151aa65 766 * Set the Enable pin.
wim 29:a3663151aa65 767 */
wim 21:9eb628d9e164 768 virtual void _setEnable(bool value);
wim 29:a3663151aa65 769
wim 29:a3663151aa65 770 /** Implementation of pure Virtual Low level writes to LCD Bus (parallel)
wim 32:59c4b8f648d4 771 * Set the RS pin (0 = Command, 1 = Data).
wim 29:a3663151aa65 772 */
wim 21:9eb628d9e164 773 virtual void _setRS(bool value);
wim 29:a3663151aa65 774
wim 29:a3663151aa65 775 /** Implementation of pure Virtual Low level writes to LCD Bus (parallel)
wim 29:a3663151aa65 776 * Set the BL pin (0 = Backlight Off, 1 = Backlight On).
wim 29:a3663151aa65 777 */
wim 21:9eb628d9e164 778 virtual void _setBL(bool value);
wim 29:a3663151aa65 779
wim 29:a3663151aa65 780 /** Implementation of pure Virtual Low level writes to LCD Bus (parallel)
wim 29:a3663151aa65 781 * Set the databus value (4 bit).
wim 29:a3663151aa65 782 */
wim 21:9eb628d9e164 783 virtual void _setData(int value);
wim 21:9eb628d9e164 784
wim 29:a3663151aa65 785
wim 22:35742ec80c24 786 /** Regular mbed pins bus
wim 22:35742ec80c24 787 */
wim 22:35742ec80c24 788 DigitalOut _rs, _e;
wim 22:35742ec80c24 789 BusOut _d;
wim 22:35742ec80c24 790
wim 22:35742ec80c24 791 /** Optional Hardware pins for the Backlight and LCD40x4 device
wim 22:35742ec80c24 792 * Default PinName value is NC, must be used as pointer to avoid issues with mbed lib and DigitalOut pins
wim 22:35742ec80c24 793 */
wim 22:35742ec80c24 794 DigitalOut *_bl, *_e2;
wim 21:9eb628d9e164 795 };
wim 21:9eb628d9e164 796
wim 22:35742ec80c24 797
wim 23:d47f226efb24 798 //----------- End TextLCD ---------------
wim 21:9eb628d9e164 799
wim 21:9eb628d9e164 800
wim 23:d47f226efb24 801 //--------- Start TextLCD_I2C -----------
wim 22:35742ec80c24 802
wim 22:35742ec80c24 803
wim 26:bd897a001012 804 /** Create a TextLCD interface using an I2C PCF8574 (or PCF8574A) or MCP23008 portexpander
wim 21:9eb628d9e164 805 *
wim 21:9eb628d9e164 806 */
wim 21:9eb628d9e164 807 class TextLCD_I2C : public TextLCD_Base {
wim 21:9eb628d9e164 808 public:
wim 26:bd897a001012 809 /** Create a TextLCD interface using an I2C PCF8574 (or PCF8574A) or MCP23008 portexpander
wim 21:9eb628d9e164 810 *
wim 21:9eb628d9e164 811 * @param i2c I2C Bus
wim 26:bd897a001012 812 * @param deviceAddress I2C slave address (PCF8574 or PCF8574A, default = PCF8574_SA0 = 0x40)
wim 21:9eb628d9e164 813 * @param type Sets the panel size/addressing mode (default = LCD16x2)
wim 21:9eb628d9e164 814 * @param ctrl LCD controller (default = HD44780)
wim 21:9eb628d9e164 815 */
wim 26:bd897a001012 816 TextLCD_I2C(I2C *i2c, char deviceAddress = PCF8574_SA0, LCDType type = LCD16x2, LCDCtrl ctrl = HD44780);
wim 21:9eb628d9e164 817
wim 21:9eb628d9e164 818 private:
wim 29:a3663151aa65 819
wim 29:a3663151aa65 820 /** Implementation of pure Virtual Low level writes to LCD Bus (serial expander)
wim 29:a3663151aa65 821 * Set the Enable pin.
wim 29:a3663151aa65 822 */
wim 21:9eb628d9e164 823 virtual void _setEnable(bool value);
wim 29:a3663151aa65 824
wim 29:a3663151aa65 825 /** Implementation of pure Virtual Low level writes to LCD Bus (serial expander)
wim 32:59c4b8f648d4 826 * Set the RS pin (0 = Command, 1 = Data).
wim 29:a3663151aa65 827 */
wim 21:9eb628d9e164 828 virtual void _setRS(bool value);
wim 29:a3663151aa65 829
wim 29:a3663151aa65 830 /** Implementation of pure Virtual Low level writes to LCD Bus (serial expander)
wim 29:a3663151aa65 831 * Set the BL pin (0 = Backlight Off, 1 = Backlight On).
wim 29:a3663151aa65 832 */
wim 21:9eb628d9e164 833 virtual void _setBL(bool value);
wim 29:a3663151aa65 834
wim 29:a3663151aa65 835 /** Implementation of pure Virtual Low level writes to LCD Bus (serial expander)
wim 29:a3663151aa65 836 * Set the databus value (4 bit).
wim 29:a3663151aa65 837 */
wim 29:a3663151aa65 838 virtual void _setData(int value);
wim 30:033048611c01 839
wim 29:a3663151aa65 840 /** Write data to MCP23008 I2C portexpander
wim 29:a3663151aa65 841 * @param reg register to write
wim 29:a3663151aa65 842 * @param value data to write
wim 29:a3663151aa65 843 * @return none
wim 29:a3663151aa65 844 *
wim 29:a3663151aa65 845 */
wim 26:bd897a001012 846 void _write_register (int reg, int value);
wim 21:9eb628d9e164 847
wim 21:9eb628d9e164 848 //I2C bus
wim 21:9eb628d9e164 849 I2C *_i2c;
wim 21:9eb628d9e164 850 char _slaveAddress;
wim 21:9eb628d9e164 851
wim 21:9eb628d9e164 852 // Internal bus mirror value for serial bus only
wim 30:033048611c01 853 char _lcd_bus;
wim 21:9eb628d9e164 854 };
wim 21:9eb628d9e164 855
wim 23:d47f226efb24 856 //---------- End TextLCD_I2C ------------
wim 22:35742ec80c24 857
wim 22:35742ec80c24 858
wim 23:d47f226efb24 859 //--------- Start TextLCD_SPI -----------
wim 22:35742ec80c24 860
wim 21:9eb628d9e164 861 /** Create a TextLCD interface using an SPI 74595 portexpander
wim 21:9eb628d9e164 862 *
wim 21:9eb628d9e164 863 */
wim 21:9eb628d9e164 864 class TextLCD_SPI : public TextLCD_Base {
wim 21:9eb628d9e164 865 public:
wim 21:9eb628d9e164 866 /** Create a TextLCD interface using an SPI 74595 portexpander
wim 21:9eb628d9e164 867 *
wim 21:9eb628d9e164 868 * @param spi SPI Bus
wim 21:9eb628d9e164 869 * @param cs chip select pin (active low)
wim 21:9eb628d9e164 870 * @param type Sets the panel size/addressing mode (default = LCD16x2)
wim 21:9eb628d9e164 871 * @param ctrl LCD controller (default = HD44780)
wim 21:9eb628d9e164 872 */
wim 21:9eb628d9e164 873 TextLCD_SPI(SPI *spi, PinName cs, LCDType type = LCD16x2, LCDCtrl ctrl = HD44780);
wim 21:9eb628d9e164 874
wim 21:9eb628d9e164 875 private:
wim 29:a3663151aa65 876
wim 29:a3663151aa65 877 /** Implementation of pure Virtual Low level writes to LCD Bus (serial expander)
wim 29:a3663151aa65 878 * Set the Enable pin.
wim 29:a3663151aa65 879 */
wim 21:9eb628d9e164 880 virtual void _setEnable(bool value);
wim 29:a3663151aa65 881
wim 29:a3663151aa65 882 /** Implementation of pure Virtual Low level writes to LCD Bus (serial expander)
wim 32:59c4b8f648d4 883 * Set the RS pin (0 = Command, 1 = Data).
wim 29:a3663151aa65 884 */
wim 21:9eb628d9e164 885 virtual void _setRS(bool value);
wim 29:a3663151aa65 886
wim 29:a3663151aa65 887 /** Implementation of pure Virtual Low level writes to LCD Bus (serial expander)
wim 29:a3663151aa65 888 * Set the BL pin (0 = Backlight Off, 1 = Backlight On).
wim 29:a3663151aa65 889 */
wim 21:9eb628d9e164 890 virtual void _setBL(bool value);
wim 29:a3663151aa65 891
wim 29:a3663151aa65 892 /** Implementation of pure Virtual Low level writes to LCD Bus (serial expander)
wim 29:a3663151aa65 893 * Set the databus value (4 bit).
wim 29:a3663151aa65 894 */
wim 21:9eb628d9e164 895 virtual void _setData(int value);
wim 29:a3663151aa65 896
wim 29:a3663151aa65 897 /** Implementation of Low level writes to LCD Bus (serial expander)
wim 29:a3663151aa65 898 * Set the CS pin (0 = select, 1 = deselect).
wim 29:a3663151aa65 899 */
wim 21:9eb628d9e164 900 virtual void _setCS(bool value);
wim 21:9eb628d9e164 901
wim 29:a3663151aa65 902 ///** Low level writes to LCD serial bus only (serial expander)
wim 29:a3663151aa65 903 // */
wim 29:a3663151aa65 904 // void _writeBus();
wim 21:9eb628d9e164 905
wim 21:9eb628d9e164 906 // SPI bus
wim 21:9eb628d9e164 907 SPI *_spi;
wim 21:9eb628d9e164 908 DigitalOut _cs;
wim 21:9eb628d9e164 909
wim 21:9eb628d9e164 910 // Internal bus mirror value for serial bus only
wim 21:9eb628d9e164 911 char _lcd_bus;
wim 21:9eb628d9e164 912 };
wim 21:9eb628d9e164 913
wim 23:d47f226efb24 914 //---------- End TextLCD_SPI ------------
wim 21:9eb628d9e164 915
Sissors 24:fb3399713710 916
wim 26:bd897a001012 917 //--------- Start TextLCD_SPI_N -----------
Sissors 24:fb3399713710 918
wim 30:033048611c01 919 /** Create a TextLCD interface using a controller with native SPI4 interface
Sissors 24:fb3399713710 920 *
Sissors 24:fb3399713710 921 */
wim 25:6162b31128c9 922 class TextLCD_SPI_N : public TextLCD_Base {
Sissors 24:fb3399713710 923 public:
wim 30:033048611c01 924 /** Create a TextLCD interface using a controller with native SPI4 interface
Sissors 24:fb3399713710 925 *
Sissors 24:fb3399713710 926 * @param spi SPI Bus
Sissors 24:fb3399713710 927 * @param cs chip select pin (active low)
Sissors 24:fb3399713710 928 * @param rs Instruction/data control line
Sissors 24:fb3399713710 929 * @param type Sets the panel size/addressing mode (default = LCD16x2)
Sissors 24:fb3399713710 930 * @param bl Backlight control line (optional, default = NC)
wim 26:bd897a001012 931 * @param ctrl LCD controller (default = ST7032_3V3)
Sissors 24:fb3399713710 932 */
wim 26:bd897a001012 933 TextLCD_SPI_N(SPI *spi, PinName cs, PinName rs, LCDType type = LCD16x2, PinName bl = NC, LCDCtrl ctrl = ST7032_3V3);
wim 25:6162b31128c9 934 virtual ~TextLCD_SPI_N(void);
Sissors 24:fb3399713710 935
Sissors 24:fb3399713710 936 private:
wim 29:a3663151aa65 937
wim 29:a3663151aa65 938 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 29:a3663151aa65 939 * Set the Enable pin.
wim 29:a3663151aa65 940 */
Sissors 24:fb3399713710 941 virtual void _setEnable(bool value);
wim 29:a3663151aa65 942
wim 29:a3663151aa65 943 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 32:59c4b8f648d4 944 * Set the RS pin (0 = Command, 1 = Data).
wim 29:a3663151aa65 945 */
Sissors 24:fb3399713710 946 virtual void _setRS(bool value);
wim 29:a3663151aa65 947
wim 29:a3663151aa65 948 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 29:a3663151aa65 949 * Set the BL pin (0 = Backlight Off, 1 = Backlight On).
wim 29:a3663151aa65 950 */
Sissors 24:fb3399713710 951 virtual void _setBL(bool value);
wim 29:a3663151aa65 952
wim 29:a3663151aa65 953 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 29:a3663151aa65 954 * Set the databus value (4 bit).
wim 29:a3663151aa65 955 */
Sissors 24:fb3399713710 956 virtual void _setData(int value);
wim 29:a3663151aa65 957
wim 29:a3663151aa65 958 /** Low level writes to LCD serial bus only (serial native)
wim 29:a3663151aa65 959 */
Sissors 24:fb3399713710 960 virtual void _writeByte(int value);
Sissors 24:fb3399713710 961
Sissors 24:fb3399713710 962 // SPI bus
Sissors 24:fb3399713710 963 SPI *_spi;
Sissors 24:fb3399713710 964 DigitalOut _cs;
Sissors 24:fb3399713710 965 DigitalOut _rs;
wim 30:033048611c01 966
wim 30:033048611c01 967 //Backlight
Sissors 24:fb3399713710 968 DigitalOut *_bl;
Sissors 24:fb3399713710 969 };
Sissors 24:fb3399713710 970
wim 25:6162b31128c9 971 //---------- End TextLCD_SPI_N ------------
Sissors 24:fb3399713710 972
wim 26:bd897a001012 973
wim 32:59c4b8f648d4 974 #if(1)
wim 30:033048611c01 975 //Code checked out on logic analyser. Not yet tested on hardware..
wim 30:033048611c01 976
wim 30:033048611c01 977 //------- Start TextLCD_SPI_N_3_9 ---------
wim 30:033048611c01 978
wim 30:033048611c01 979 /** Create a TextLCD interface using a controller with native SPI3 9 bits interface
wim 30:033048611c01 980 * Note: current mbed libs only support SPI 9 bit mode for NXP platforms
wim 30:033048611c01 981 *
wim 30:033048611c01 982 */
wim 30:033048611c01 983 class TextLCD_SPI_N_3_9 : public TextLCD_Base {
wim 30:033048611c01 984 public:
wim 30:033048611c01 985 /** Create a TextLCD interface using a controller with native SPI3 9 bits interface
wim 30:033048611c01 986 * Note: current mbed libs only support SPI 9 bit mode for NXP platforms
wim 30:033048611c01 987 *
wim 30:033048611c01 988 * @param spi SPI Bus
wim 30:033048611c01 989 * @param cs chip select pin (active low)
wim 30:033048611c01 990 * @param type Sets the panel size/addressing mode (default = LCD16x2)
wim 30:033048611c01 991 * @param bl Backlight control line (optional, default = NC)
wim 30:033048611c01 992 * @param ctrl LCD controller (default = AIP31068)
wim 30:033048611c01 993 */
wim 30:033048611c01 994 TextLCD_SPI_N_3_9(SPI *spi, PinName cs, LCDType type = LCD16x2, PinName bl = NC, LCDCtrl ctrl = AIP31068);
wim 30:033048611c01 995 virtual ~TextLCD_SPI_N_3_9(void);
wim 30:033048611c01 996
wim 30:033048611c01 997 private:
wim 30:033048611c01 998
wim 30:033048611c01 999 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 30:033048611c01 1000 * Set the Enable pin.
wim 30:033048611c01 1001 */
wim 30:033048611c01 1002 virtual void _setEnable(bool value);
wim 30:033048611c01 1003
wim 30:033048611c01 1004 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 32:59c4b8f648d4 1005 * Set the RS pin (0 = Command, 1 = Data).
wim 32:59c4b8f648d4 1006 */
wim 32:59c4b8f648d4 1007 virtual void _setRS(bool value);
wim 32:59c4b8f648d4 1008
wim 32:59c4b8f648d4 1009 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 32:59c4b8f648d4 1010 * Set the BL pin (0 = Backlight Off, 1 = Backlight On).
wim 32:59c4b8f648d4 1011 */
wim 32:59c4b8f648d4 1012 virtual void _setBL(bool value);
wim 32:59c4b8f648d4 1013
wim 32:59c4b8f648d4 1014 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 32:59c4b8f648d4 1015 * Set the databus value (4 bit).
wim 32:59c4b8f648d4 1016 */
wim 32:59c4b8f648d4 1017 virtual void _setData(int value);
wim 32:59c4b8f648d4 1018
wim 32:59c4b8f648d4 1019 /** Low level writes to LCD serial bus only (serial native)
wim 32:59c4b8f648d4 1020 */
wim 32:59c4b8f648d4 1021 virtual void _writeByte(int value);
wim 32:59c4b8f648d4 1022
wim 32:59c4b8f648d4 1023 // SPI bus
wim 32:59c4b8f648d4 1024 SPI *_spi;
wim 32:59c4b8f648d4 1025 DigitalOut _cs;
wim 32:59c4b8f648d4 1026
wim 32:59c4b8f648d4 1027
wim 32:59c4b8f648d4 1028 // controlbyte to select between data and command. Internal value for serial bus only
wim 32:59c4b8f648d4 1029 char _controlbyte;
wim 32:59c4b8f648d4 1030
wim 32:59c4b8f648d4 1031 //Backlight
wim 32:59c4b8f648d4 1032 DigitalOut *_bl;
wim 32:59c4b8f648d4 1033 };
wim 32:59c4b8f648d4 1034
wim 32:59c4b8f648d4 1035 //-------- End TextLCD_SPI_N_3_9 ----------
wim 32:59c4b8f648d4 1036 #endif
wim 32:59c4b8f648d4 1037
wim 32:59c4b8f648d4 1038
wim 32:59c4b8f648d4 1039 #if(1)
wim 32:59c4b8f648d4 1040 //------- Start TextLCD_SPI_N_3_10 ---------
wim 32:59c4b8f648d4 1041
wim 32:59c4b8f648d4 1042 /** Create a TextLCD interface using a controller with native SPI3 10 bits interface
wim 32:59c4b8f648d4 1043 * Note: current mbed libs only support SPI 10 bit mode for NXP platforms
wim 32:59c4b8f648d4 1044 *
wim 32:59c4b8f648d4 1045 */
wim 32:59c4b8f648d4 1046 class TextLCD_SPI_N_3_10 : public TextLCD_Base {
wim 32:59c4b8f648d4 1047 public:
wim 32:59c4b8f648d4 1048 /** Create a TextLCD interface using a controller with native SPI3 10 bits interface
wim 32:59c4b8f648d4 1049 * Note: current mbed libs only support SPI 10 bit mode for NXP platforms
wim 32:59c4b8f648d4 1050 *
wim 32:59c4b8f648d4 1051 * @param spi SPI Bus
wim 32:59c4b8f648d4 1052 * @param cs chip select pin (active low)
wim 32:59c4b8f648d4 1053 * @param type Sets the panel size/addressing mode (default = LCD16x2)
wim 32:59c4b8f648d4 1054 * @param bl Backlight control line (optional, default = NC)
wim 32:59c4b8f648d4 1055 * @param ctrl LCD controller (default = AIP31068)
wim 32:59c4b8f648d4 1056 */
wim 32:59c4b8f648d4 1057 TextLCD_SPI_N_3_10(SPI *spi, PinName cs, LCDType type = LCD16x2, PinName bl = NC, LCDCtrl ctrl = AIP31068);
wim 32:59c4b8f648d4 1058 virtual ~TextLCD_SPI_N_3_10(void);
wim 32:59c4b8f648d4 1059
wim 32:59c4b8f648d4 1060 private:
wim 32:59c4b8f648d4 1061
wim 32:59c4b8f648d4 1062 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 32:59c4b8f648d4 1063 * Set the Enable pin.
wim 32:59c4b8f648d4 1064 */
wim 32:59c4b8f648d4 1065 virtual void _setEnable(bool value);
wim 32:59c4b8f648d4 1066
wim 32:59c4b8f648d4 1067 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 32:59c4b8f648d4 1068 * Set the RS pin (0 = Command, 1 = Data).
wim 32:59c4b8f648d4 1069 */
wim 32:59c4b8f648d4 1070 virtual void _setRS(bool value);
wim 32:59c4b8f648d4 1071
wim 32:59c4b8f648d4 1072 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 32:59c4b8f648d4 1073 * Set the BL pin (0 = Backlight Off, 1 = Backlight On).
wim 32:59c4b8f648d4 1074 */
wim 32:59c4b8f648d4 1075 virtual void _setBL(bool value);
wim 32:59c4b8f648d4 1076
wim 32:59c4b8f648d4 1077 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 32:59c4b8f648d4 1078 * Set the databus value (4 bit).
wim 32:59c4b8f648d4 1079 */
wim 32:59c4b8f648d4 1080 virtual void _setData(int value);
wim 32:59c4b8f648d4 1081
wim 32:59c4b8f648d4 1082 /** Low level writes to LCD serial bus only (serial native)
wim 32:59c4b8f648d4 1083 */
wim 32:59c4b8f648d4 1084 virtual void _writeByte(int value);
wim 32:59c4b8f648d4 1085
wim 32:59c4b8f648d4 1086 // SPI bus
wim 32:59c4b8f648d4 1087 SPI *_spi;
wim 32:59c4b8f648d4 1088 DigitalOut _cs;
wim 32:59c4b8f648d4 1089
wim 32:59c4b8f648d4 1090
wim 32:59c4b8f648d4 1091 // controlbyte to select between data and command. Internal value for serial bus only
wim 32:59c4b8f648d4 1092 char _controlbyte;
wim 32:59c4b8f648d4 1093
wim 32:59c4b8f648d4 1094 //Backlight
wim 32:59c4b8f648d4 1095 DigitalOut *_bl;
wim 32:59c4b8f648d4 1096 };
wim 32:59c4b8f648d4 1097
wim 32:59c4b8f648d4 1098 //-------- End TextLCD_SPI_N_3_10 ----------
wim 32:59c4b8f648d4 1099 #endif
wim 32:59c4b8f648d4 1100
wim 32:59c4b8f648d4 1101 #if(0)
wim 32:59c4b8f648d4 1102 //Code not yet checked out on logic analyser. Not yet tested on hardware..
wim 32:59c4b8f648d4 1103
wim 32:59c4b8f648d4 1104 //------- Start TextLCD_SPI_N_3_16 ---------
wim 32:59c4b8f648d4 1105
wim 32:59c4b8f648d4 1106 /** Create a TextLCD interface using a controller with native SPI3 16 bits interface
wim 32:59c4b8f648d4 1107 *
wim 32:59c4b8f648d4 1108 */
wim 32:59c4b8f648d4 1109 class TextLCD_SPI_N_3_16 : public TextLCD_Base {
wim 32:59c4b8f648d4 1110 public:
wim 32:59c4b8f648d4 1111 /** Create a TextLCD interface using a controller with native SPI3 16 bits interface
wim 32:59c4b8f648d4 1112 *
wim 32:59c4b8f648d4 1113 * @param spi SPI Bus
wim 32:59c4b8f648d4 1114 * @param cs chip select pin (active low)
wim 32:59c4b8f648d4 1115 * @param type Sets the panel size/addressing mode (default = LCD16x2)
wim 32:59c4b8f648d4 1116 * @param bl Backlight control line (optional, default = NC)
wim 32:59c4b8f648d4 1117 * @param ctrl LCD controller (default = PT6314)
wim 32:59c4b8f648d4 1118 */
wim 32:59c4b8f648d4 1119 TextLCD_SPI_N_3_16(SPI *spi, PinName cs, LCDType type = LCD16x2, PinName bl = NC, LCDCtrl ctrl = PT6314);
wim 32:59c4b8f648d4 1120 virtual ~TextLCD_SPI_N_3_16(void);
wim 32:59c4b8f648d4 1121
wim 32:59c4b8f648d4 1122 private:
wim 32:59c4b8f648d4 1123
wim 32:59c4b8f648d4 1124 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 32:59c4b8f648d4 1125 * Set the Enable pin.
wim 32:59c4b8f648d4 1126 */
wim 32:59c4b8f648d4 1127 virtual void _setEnable(bool value);
wim 32:59c4b8f648d4 1128
wim 32:59c4b8f648d4 1129 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 32:59c4b8f648d4 1130 * Set the RS pin (0 = Command, 1 = Data).
wim 30:033048611c01 1131 */
wim 30:033048611c01 1132 virtual void _setRS(bool value);
wim 30:033048611c01 1133
wim 30:033048611c01 1134 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 30:033048611c01 1135 * Set the BL pin (0 = Backlight Off, 1 = Backlight On).
wim 30:033048611c01 1136 */
wim 30:033048611c01 1137 virtual void _setBL(bool value);
wim 30:033048611c01 1138
wim 30:033048611c01 1139 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 30:033048611c01 1140 * Set the databus value (4 bit).
wim 30:033048611c01 1141 */
wim 30:033048611c01 1142 virtual void _setData(int value);
wim 30:033048611c01 1143
wim 30:033048611c01 1144 /** Low level writes to LCD serial bus only (serial native)
wim 30:033048611c01 1145 */
wim 30:033048611c01 1146 virtual void _writeByte(int value);
wim 30:033048611c01 1147
wim 30:033048611c01 1148 // SPI bus
wim 30:033048611c01 1149 SPI *_spi;
wim 30:033048611c01 1150 DigitalOut _cs;
wim 30:033048611c01 1151
wim 30:033048611c01 1152 // controlbyte to select between data and command. Internal value for serial bus only
wim 30:033048611c01 1153 char _controlbyte;
wim 30:033048611c01 1154
wim 30:033048611c01 1155 //Backlight
wim 30:033048611c01 1156 DigitalOut *_bl;
wim 30:033048611c01 1157 };
wim 30:033048611c01 1158
wim 32:59c4b8f648d4 1159 //-------- End TextLCD_SPI_N_3_16 ----------
wim 30:033048611c01 1160 #endif
wim 30:033048611c01 1161
wim 32:59c4b8f648d4 1162 #if(1)
wim 32:59c4b8f648d4 1163 //------- Start TextLCD_SPI_N_3_24 ---------
wim 30:033048611c01 1164
wim 32:59c4b8f648d4 1165 /** Create a TextLCD interface using a controller with native SPI3 24 bits interface
wim 32:59c4b8f648d4 1166 * Note: lib uses SPI 8 bit mode
wim 30:033048611c01 1167 *
wim 30:033048611c01 1168 */
wim 32:59c4b8f648d4 1169 class TextLCD_SPI_N_3_24 : public TextLCD_Base {
wim 30:033048611c01 1170 public:
wim 32:59c4b8f648d4 1171 /** Create a TextLCD interface using a controller with native SPI3 24 bits interface
wim 32:59c4b8f648d4 1172 * Note: lib uses SPI 8 bit mode
wim 30:033048611c01 1173 *
wim 30:033048611c01 1174 * @param spi SPI Bus
wim 30:033048611c01 1175 * @param cs chip select pin (active low)
wim 30:033048611c01 1176 * @param type Sets the panel size/addressing mode (default = LCD16x2)
wim 30:033048611c01 1177 * @param bl Backlight control line (optional, default = NC)
wim 32:59c4b8f648d4 1178 * @param ctrl LCD controller (default = SSD1803)
wim 30:033048611c01 1179 */
wim 32:59c4b8f648d4 1180 TextLCD_SPI_N_3_24(SPI *spi, PinName cs, LCDType type = LCD16x2, PinName bl = NC, LCDCtrl ctrl = SSD1803_3V3);
wim 32:59c4b8f648d4 1181 virtual ~TextLCD_SPI_N_3_24(void);
wim 30:033048611c01 1182
wim 30:033048611c01 1183 private:
wim 30:033048611c01 1184
wim 30:033048611c01 1185 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 30:033048611c01 1186 * Set the Enable pin.
wim 30:033048611c01 1187 */
wim 30:033048611c01 1188 virtual void _setEnable(bool value);
wim 30:033048611c01 1189
wim 30:033048611c01 1190 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 32:59c4b8f648d4 1191 * Set the RS pin (0 = Command, 1 = Data).
wim 30:033048611c01 1192 */
wim 30:033048611c01 1193 virtual void _setRS(bool value);
wim 30:033048611c01 1194
wim 30:033048611c01 1195 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 30:033048611c01 1196 * Set the BL pin (0 = Backlight Off, 1 = Backlight On).
wim 30:033048611c01 1197 */
wim 30:033048611c01 1198 virtual void _setBL(bool value);
wim 30:033048611c01 1199
wim 30:033048611c01 1200 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 30:033048611c01 1201 * Set the databus value (4 bit).
wim 30:033048611c01 1202 */
wim 30:033048611c01 1203 virtual void _setData(int value);
wim 30:033048611c01 1204
wim 30:033048611c01 1205 /** Low level writes to LCD serial bus only (serial native)
wim 30:033048611c01 1206 */
wim 30:033048611c01 1207 virtual void _writeByte(int value);
wim 30:033048611c01 1208
wim 30:033048611c01 1209 // SPI bus
wim 30:033048611c01 1210 SPI *_spi;
wim 30:033048611c01 1211 DigitalOut _cs;
wim 30:033048611c01 1212
wim 30:033048611c01 1213 // controlbyte to select between data and command. Internal value for serial bus only
wim 30:033048611c01 1214 char _controlbyte;
wim 30:033048611c01 1215
wim 30:033048611c01 1216 //Backlight
wim 30:033048611c01 1217 DigitalOut *_bl;
wim 30:033048611c01 1218 };
wim 30:033048611c01 1219
wim 32:59c4b8f648d4 1220 //-------- End TextLCD_SPI_N_3_24 ----------
wim 30:033048611c01 1221 #endif
wim 30:033048611c01 1222
wim 30:033048611c01 1223
wim 26:bd897a001012 1224 //--------- Start TextLCD_I2C_N -----------
wim 26:bd897a001012 1225
wim 26:bd897a001012 1226 /** Create a TextLCD interface using a controller with native I2C interface
wim 26:bd897a001012 1227 *
wim 26:bd897a001012 1228 */
wim 26:bd897a001012 1229 class TextLCD_I2C_N : public TextLCD_Base {
wim 26:bd897a001012 1230 public:
wim 26:bd897a001012 1231 /** Create a TextLCD interface using a controller with native I2C interface
wim 26:bd897a001012 1232 *
wim 26:bd897a001012 1233 * @param i2c I2C Bus
wim 28:30fa94f7341c 1234 * @param deviceAddress I2C slave address (default = ST7032_SA = 0x7C)
wim 26:bd897a001012 1235 * @param type Sets the panel size/addressing mode (default = LCD16x2)
wim 28:30fa94f7341c 1236 * @param bl Backlight control line (optional, default = NC)
wim 26:bd897a001012 1237 * @param ctrl LCD controller (default = ST7032_3V3)
wim 26:bd897a001012 1238 */
wim 28:30fa94f7341c 1239 TextLCD_I2C_N(I2C *i2c, char deviceAddress = ST7032_SA, LCDType type = LCD16x2, PinName bl = NC, LCDCtrl ctrl = ST7032_3V3);
wim 26:bd897a001012 1240 virtual ~TextLCD_I2C_N(void);
wim 26:bd897a001012 1241
wim 26:bd897a001012 1242 private:
wim 29:a3663151aa65 1243
wim 29:a3663151aa65 1244 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 29:a3663151aa65 1245 * Set the Enable pin.
wim 29:a3663151aa65 1246 */
wim 26:bd897a001012 1247 virtual void _setEnable(bool value);
wim 29:a3663151aa65 1248
wim 29:a3663151aa65 1249 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 29:a3663151aa65 1250 * Set the RS pin ( 0 = Command, 1 = Data).
wim 29:a3663151aa65 1251 */
wim 26:bd897a001012 1252 virtual void _setRS(bool value);
wim 29:a3663151aa65 1253
wim 29:a3663151aa65 1254 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 29:a3663151aa65 1255 * Set the BL pin (0 = Backlight Off, 1 = Backlight On).
wim 29:a3663151aa65 1256 */
wim 26:bd897a001012 1257 virtual void _setBL(bool value);
wim 29:a3663151aa65 1258
wim 29:a3663151aa65 1259 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 29:a3663151aa65 1260 * Set the databus value (4 bit).
wim 29:a3663151aa65 1261 */
wim 26:bd897a001012 1262 virtual void _setData(int value);
wim 29:a3663151aa65 1263
wim 29:a3663151aa65 1264 /** Low level writes to LCD serial bus only (serial native)
wim 29:a3663151aa65 1265 */
wim 26:bd897a001012 1266 virtual void _writeByte(int value);
wim 26:bd897a001012 1267
wim 26:bd897a001012 1268 //I2C bus
wim 26:bd897a001012 1269 I2C *_i2c;
wim 26:bd897a001012 1270 char _slaveAddress;
wim 26:bd897a001012 1271
wim 28:30fa94f7341c 1272 // controlbyte to select between data and command. Internal value for serial bus only
wim 28:30fa94f7341c 1273 char _controlbyte;
wim 28:30fa94f7341c 1274
wim 30:033048611c01 1275 //Backlight
wim 33:900a94bc7585 1276 DigitalOut *_bl;
wim 33:900a94bc7585 1277
wim 26:bd897a001012 1278 };
wim 26:bd897a001012 1279
wim 26:bd897a001012 1280 //---------- End TextLCD_I2C_N ------------
wim 26:bd897a001012 1281
wim 26:bd897a001012 1282
simon 1:ac48b187213c 1283 #endif