1
TextLCD.h@29:a3663151aa65, 2014-06-17 (annotated)
- Committer:
- wim
- Date:
- Tue Jun 17 17:41:47 2014 +0000
- Revision:
- 29:a3663151aa65
- Parent:
- 28:30fa94f7341c
- Child:
- 30:033048611c01
Tested with PCF2116
Who changed what in which revision?
User | Revision | Line number | New 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 | 29:a3663151aa65 | 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 |
simon | 1:ac48b187213c | 14 | * |
simon | 1:ac48b187213c | 15 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
simon | 1:ac48b187213c | 16 | * of this software and associated documentation files (the "Software"), to deal |
simon | 1:ac48b187213c | 17 | * in the Software without restriction, including without limitation the rights |
simon | 1:ac48b187213c | 18 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
simon | 1:ac48b187213c | 19 | * copies of the Software, and to permit persons to whom the Software is |
simon | 1:ac48b187213c | 20 | * furnished to do so, subject to the following conditions: |
simon | 2:227356c7d12c | 21 | * |
simon | 1:ac48b187213c | 22 | * The above copyright notice and this permission notice shall be included in |
simon | 1:ac48b187213c | 23 | * all copies or substantial portions of the Software. |
simon | 2:227356c7d12c | 24 | * |
simon | 1:ac48b187213c | 25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
simon | 1:ac48b187213c | 26 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
simon | 1:ac48b187213c | 27 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
simon | 1:ac48b187213c | 28 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
simon | 1:ac48b187213c | 29 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
simon | 1:ac48b187213c | 30 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
simon | 1:ac48b187213c | 31 | * THE SOFTWARE. |
simon | 1:ac48b187213c | 32 | */ |
simon | 1:ac48b187213c | 33 | |
simon | 1:ac48b187213c | 34 | #ifndef MBED_TEXTLCD_H |
simon | 1:ac48b187213c | 35 | #define MBED_TEXTLCD_H |
simon | 1:ac48b187213c | 36 | |
simon | 1:ac48b187213c | 37 | #include "mbed.h" |
simon | 2:227356c7d12c | 38 | |
simon | 5:a53b3e2d6f1e | 39 | /** A TextLCD interface for driving 4-bit HD44780-based LCDs |
simon | 2:227356c7d12c | 40 | * |
wim | 16:c276b75e6585 | 41 | * Currently supports 8x1, 8x2, 12x4, 16x1, 16x2, 16x4, 20x2, 20x4, 24x2, 24x4, 40x2 and 40x4 panels |
wim | 27:22d5086f6ba6 | 42 | * Interface options include direct mbed pins, I2C portexpander (PCF8474/PCF8574A or MCP23008) or SPI bus shiftregister (74595). |
wim | 27:22d5086f6ba6 | 43 | * 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 | 44 | * |
simon | 2:227356c7d12c | 45 | * @code |
simon | 2:227356c7d12c | 46 | * #include "mbed.h" |
simon | 2:227356c7d12c | 47 | * #include "TextLCD.h" |
simon | 5:a53b3e2d6f1e | 48 | * |
wim | 16:c276b75e6585 | 49 | * // I2C Communication |
wim | 16:c276b75e6585 | 50 | * I2C i2c_lcd(p28,p27); // SDA, SCL |
wim | 16:c276b75e6585 | 51 | * |
wim | 16:c276b75e6585 | 52 | * // SPI Communication |
wim | 16:c276b75e6585 | 53 | * SPI spi_lcd(p5, NC, p7); // MOSI, MISO, SCLK |
wim | 16:c276b75e6585 | 54 | * |
wim | 22:35742ec80c24 | 55 | * //TextLCD lcd(p15, p16, p17, p18, p19, p20); // RS, E, D4-D7, LCDType=LCD16x2, BL=NC, E2=NC, LCDTCtrl=HD44780 |
wim | 28:30fa94f7341c | 56 | * //TextLCD_SPI lcd(&spi_lcd, p8, TextLCD::LCD40x4); // SPI bus, 74595 expander, CS pin, LCD Type |
wim | 22:35742ec80c24 | 57 | * TextLCD_I2C lcd(&i2c_lcd, 0x42, TextLCD::LCD20x4); // I2C bus, PCF8574 Slaveaddress, LCD Type |
wim | 21:9eb628d9e164 | 58 | * //TextLCD_I2C lcd(&i2c_lcd, 0x42, TextLCD::LCD16x2, TextLCD::WS0010); // I2C bus, PCF8574 Slaveaddress, LCD Type, Device Type |
wim | 27:22d5086f6ba6 | 59 | * //TextLCD_SPI_N lcd(&spi_lcd, p8, p9); // SPI bus, CS pin, RS pin, LCDType=LCD16x2, BL=NC, LCDTCtrl=ST7032_3V3 |
wim | 28:30fa94f7341c | 60 | * //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 | 61 | * |
simon | 2:227356c7d12c | 62 | * int main() { |
wim | 16:c276b75e6585 | 63 | * lcd.printf("Hello World!\n"); |
simon | 2:227356c7d12c | 64 | * } |
simon | 2:227356c7d12c | 65 | * @endcode |
simon | 2:227356c7d12c | 66 | */ |
wim | 8:03116f75b66e | 67 | |
wim | 26:bd897a001012 | 68 | |
wim | 26:bd897a001012 | 69 | //Pin Defines for I2C PCF8574/PCF8574A or MCP23008 and SPI 74595 bus expander interfaces |
wim | 13:24506ba22480 | 70 | //LCD and serial portexpanders should be wired accordingly |
wim | 20:e0da005a777f | 71 | // |
wim | 26:bd897a001012 | 72 | //Select Hardware module (one option only) |
wim | 29:a3663151aa65 | 73 | #define DEFAULT 0 |
wim | 29:a3663151aa65 | 74 | #define ADAFRUIT 1 |
wim | 26:bd897a001012 | 75 | #define DFROBOT 0 |
wim | 26:bd897a001012 | 76 | |
wim | 26:bd897a001012 | 77 | |
wim | 26:bd897a001012 | 78 | #if (DEFAULT==1) |
wim | 29:a3663151aa65 | 79 | //Definitions for default (WH) mapping between serial port expander pins and LCD controller |
wim | 26:bd897a001012 | 80 | //This hardware supports the I2C bus expander (PCF8574/PCF8574A or MCP23008) and SPI bus expander (74595) interfaces |
wim | 29:a3663151aa65 | 81 | //See https://mbed.org/cookbook/Text-LCD-Enhanced |
wim | 26:bd897a001012 | 82 | // |
wim | 13:24506ba22480 | 83 | //Note: LCD RW pin must be connected to GND |
wim | 15:b70ebfffb258 | 84 | // E2 is used for LCD40x4 (second controller) |
wim | 26:bd897a001012 | 85 | // BL may be used to control backlight |
wim | 15:b70ebfffb258 | 86 | #define D_LCD_PIN_D4 0 |
wim | 15:b70ebfffb258 | 87 | #define D_LCD_PIN_D5 1 |
wim | 15:b70ebfffb258 | 88 | #define D_LCD_PIN_D6 2 |
wim | 15:b70ebfffb258 | 89 | #define D_LCD_PIN_D7 3 |
wim | 15:b70ebfffb258 | 90 | #define D_LCD_PIN_RS 4 |
wim | 15:b70ebfffb258 | 91 | #define D_LCD_PIN_E 5 |
wim | 15:b70ebfffb258 | 92 | #define D_LCD_PIN_E2 6 |
wim | 15:b70ebfffb258 | 93 | #define D_LCD_PIN_BL 7 |
wim | 13:24506ba22480 | 94 | |
wim | 20:e0da005a777f | 95 | #define D_LCD_PIN_RW D_LCD_PIN_E2 |
wim | 20:e0da005a777f | 96 | |
wim | 26:bd897a001012 | 97 | //Select I2C Portexpander type (one option only) |
wim | 26:bd897a001012 | 98 | #define PCF8574 1 |
wim | 26:bd897a001012 | 99 | #define MCP23008 0 |
wim | 26:bd897a001012 | 100 | #endif |
wim | 20:e0da005a777f | 101 | |
wim | 26:bd897a001012 | 102 | #if (ADAFRUIT==1) |
wim | 29:a3663151aa65 | 103 | //Definitions for Adafruit i2cspilcdbackpack mapping between serial port expander pins and LCD controller |
wim | 26:bd897a001012 | 104 | //This hardware supports both an I2C expander (MCP23008) and an SPI expander (74595) selectable by a jumper. |
wim | 29:a3663151aa65 | 105 | //See http://www.ladyada.net/products/i2cspilcdbackpack |
wim | 26:bd897a001012 | 106 | // |
wim | 26:bd897a001012 | 107 | //Note: LCD RW pin must be kept LOW |
wim | 26:bd897a001012 | 108 | // E2 is not available on this hardware and so it does not support LCD40x4 (second controller) |
wim | 26:bd897a001012 | 109 | // BL is used to control backlight |
wim | 26:bd897a001012 | 110 | #define D_LCD_PIN_0 0 |
wim | 26:bd897a001012 | 111 | #define D_LCD_PIN_RS 1 |
wim | 26:bd897a001012 | 112 | #define D_LCD_PIN_E 2 |
wim | 26:bd897a001012 | 113 | #define D_LCD_PIN_D4 3 |
wim | 26:bd897a001012 | 114 | #define D_LCD_PIN_D5 4 |
wim | 26:bd897a001012 | 115 | #define D_LCD_PIN_D6 5 |
wim | 26:bd897a001012 | 116 | #define D_LCD_PIN_D7 6 |
wim | 26:bd897a001012 | 117 | #define D_LCD_PIN_BL 7 |
wim | 26:bd897a001012 | 118 | |
wim | 26:bd897a001012 | 119 | #define D_LCD_PIN_E2 D_LCD_PIN_0 |
wim | 26:bd897a001012 | 120 | |
wim | 26:bd897a001012 | 121 | //Force I2C portexpander type |
wim | 26:bd897a001012 | 122 | #define PCF8574 0 |
wim | 26:bd897a001012 | 123 | #define MCP23008 1 |
wim | 26:bd897a001012 | 124 | #endif |
wim | 26:bd897a001012 | 125 | |
wim | 26:bd897a001012 | 126 | #if (DFROBOT==1) |
wim | 29:a3663151aa65 | 127 | //Definitions for DFROBOT LCD2004 Module mapping between serial port expander pins and LCD controller |
wim | 26:bd897a001012 | 128 | //This hardware uses PCF8574 and is different from earlier/different Arduino I2C LCD displays |
wim | 29:a3663151aa65 | 129 | //See http://arduino-info.wikispaces.com/LCD-Blue-I2C |
wim | 26:bd897a001012 | 130 | // |
wim | 20:e0da005a777f | 131 | //Note: LCD RW pin must be kept LOW |
wim | 26:bd897a001012 | 132 | // E2 is not available on default Arduino hardware and so it does not support LCD40x4 (second controller) |
wim | 20:e0da005a777f | 133 | // BL is used to control backlight |
wim | 20:e0da005a777f | 134 | #define D_LCD_PIN_RS 0 |
wim | 20:e0da005a777f | 135 | #define D_LCD_PIN_RW 1 |
wim | 20:e0da005a777f | 136 | #define D_LCD_PIN_E 2 |
wim | 20:e0da005a777f | 137 | #define D_LCD_PIN_BL 3 |
wim | 20:e0da005a777f | 138 | #define D_LCD_PIN_D4 4 |
wim | 20:e0da005a777f | 139 | #define D_LCD_PIN_D5 5 |
wim | 20:e0da005a777f | 140 | #define D_LCD_PIN_D6 6 |
wim | 20:e0da005a777f | 141 | #define D_LCD_PIN_D7 7 |
wim | 20:e0da005a777f | 142 | |
wim | 20:e0da005a777f | 143 | #define D_LCD_PIN_E2 D_LCD_PIN_RW |
wim | 26:bd897a001012 | 144 | |
wim | 26:bd897a001012 | 145 | //Force I2C portexpander type |
wim | 26:bd897a001012 | 146 | #define PCF8574 1 |
wim | 26:bd897a001012 | 147 | #define MCP23008 0 |
wim | 20:e0da005a777f | 148 | #endif |
wim | 13:24506ba22480 | 149 | |
wim | 26:bd897a001012 | 150 | //Bitpattern Defines for I2C PCF8574/PCF8574A, MCP23008 and SPI 74595 Bus expanders |
wim | 13:24506ba22480 | 151 | // |
wim | 13:24506ba22480 | 152 | #define D_LCD_D4 (1<<D_LCD_PIN_D4) |
wim | 13:24506ba22480 | 153 | #define D_LCD_D5 (1<<D_LCD_PIN_D5) |
wim | 13:24506ba22480 | 154 | #define D_LCD_D6 (1<<D_LCD_PIN_D6) |
wim | 13:24506ba22480 | 155 | #define D_LCD_D7 (1<<D_LCD_PIN_D7) |
wim | 13:24506ba22480 | 156 | #define D_LCD_RS (1<<D_LCD_PIN_RS) |
wim | 13:24506ba22480 | 157 | #define D_LCD_E (1<<D_LCD_PIN_E) |
wim | 13:24506ba22480 | 158 | #define D_LCD_E2 (1<<D_LCD_PIN_E2) |
wim | 13:24506ba22480 | 159 | #define D_LCD_BL (1<<D_LCD_PIN_BL) |
wim | 20:e0da005a777f | 160 | //#define D_LCD_RW (1<<D_LCD_PIN_RW) |
wim | 20:e0da005a777f | 161 | |
wim | 20:e0da005a777f | 162 | #define D_LCD_BUS_MSK (D_LCD_D4 | D_LCD_D5 | D_LCD_D6 | D_LCD_D7) |
wim | 20:e0da005a777f | 163 | #define D_LCD_BUS_DEF 0x00 |
wim | 13:24506ba22480 | 164 | |
wim | 26:bd897a001012 | 165 | /* PCF8574/PCF8574A I2C portexpander slave address */ |
wim | 26:bd897a001012 | 166 | #define PCF8574_SA0 0x40 |
wim | 26:bd897a001012 | 167 | #define PCF8574_SA1 0x42 |
wim | 26:bd897a001012 | 168 | #define PCF8574_SA2 0x44 |
wim | 26:bd897a001012 | 169 | #define PCF8574_SA3 0x46 |
wim | 26:bd897a001012 | 170 | #define PCF8574_SA4 0x48 |
wim | 26:bd897a001012 | 171 | #define PCF8574_SA5 0x4A |
wim | 26:bd897a001012 | 172 | #define PCF8574_SA6 0x4C |
wim | 26:bd897a001012 | 173 | #define PCF8574_SA7 0x4E |
wim | 26:bd897a001012 | 174 | |
wim | 26:bd897a001012 | 175 | #define PCF8574A_SA0 0x70 |
wim | 26:bd897a001012 | 176 | #define PCF8574A_SA1 0x72 |
wim | 26:bd897a001012 | 177 | #define PCF8574A_SA2 0x74 |
wim | 26:bd897a001012 | 178 | #define PCF8574A_SA3 0x76 |
wim | 26:bd897a001012 | 179 | #define PCF8574A_SA4 0x78 |
wim | 26:bd897a001012 | 180 | #define PCF8574A_SA5 0x7A |
wim | 26:bd897a001012 | 181 | #define PCF8574A_SA6 0x7C |
wim | 26:bd897a001012 | 182 | #define PCF8574A_SA7 0x7E |
wim | 26:bd897a001012 | 183 | |
wim | 26:bd897a001012 | 184 | /* MCP23008 I2C portexpander slave address */ |
wim | 26:bd897a001012 | 185 | #define MCP23008_SA0 0x40 |
wim | 26:bd897a001012 | 186 | #define MCP23008_SA1 0x42 |
wim | 26:bd897a001012 | 187 | #define MCP23008_SA2 0x44 |
wim | 26:bd897a001012 | 188 | #define MCP23008_SA3 0x46 |
wim | 26:bd897a001012 | 189 | #define MCP23008_SA4 0x48 |
wim | 26:bd897a001012 | 190 | #define MCP23008_SA5 0x4A |
wim | 26:bd897a001012 | 191 | #define MCP23008_SA6 0x4C |
wim | 26:bd897a001012 | 192 | #define MCP23008_SA7 0x4E |
wim | 26:bd897a001012 | 193 | |
wim | 26:bd897a001012 | 194 | |
wim | 26:bd897a001012 | 195 | /* MCP23008 I2C portexpander internal registers */ |
wim | 26:bd897a001012 | 196 | #define IODIR 0x00 |
wim | 26:bd897a001012 | 197 | #define IPOL 0x01 |
wim | 26:bd897a001012 | 198 | #define GPINTEN 0x02 |
wim | 26:bd897a001012 | 199 | #define DEFVAL 0x03 |
wim | 26:bd897a001012 | 200 | #define INTCON 0x04 |
wim | 26:bd897a001012 | 201 | #define IOCON 0x05 |
wim | 26:bd897a001012 | 202 | #define GPPU 0x06 |
wim | 26:bd897a001012 | 203 | #define INTF 0x07 |
wim | 26:bd897a001012 | 204 | #define INTCAP 0x08 |
wim | 26:bd897a001012 | 205 | #define GPIO 0x09 |
wim | 26:bd897a001012 | 206 | #define OLAT 0x0A |
wim | 26:bd897a001012 | 207 | |
wim | 26:bd897a001012 | 208 | |
wim | 26:bd897a001012 | 209 | /* ST7032I I2C slave address */ |
wim | 26:bd897a001012 | 210 | #define ST7032_SA 0x7C |
wim | 26:bd897a001012 | 211 | |
wim | 29:a3663151aa65 | 212 | /* PCF21XX I2C slave address */ |
wim | 29:a3663151aa65 | 213 | #define PCF21XX_SA0 0x74 |
wim | 29:a3663151aa65 | 214 | #define PCF21XX_SA1 0x76 |
wim | 13:24506ba22480 | 215 | |
wim | 13:24506ba22480 | 216 | /** Some sample User Defined Chars 5x7 dots */ |
wim | 11:9ec02df863a1 | 217 | const char udc_ae[] = {0x00, 0x00, 0x1B, 0x05, 0x1F, 0x14, 0x1F, 0x00}; //æ |
wim | 11:9ec02df863a1 | 218 | const char udc_0e[] = {0x00, 0x00, 0x0E, 0x13, 0x15, 0x19, 0x0E, 0x00}; //ø |
wim | 11:9ec02df863a1 | 219 | const char udc_ao[] = {0x0E, 0x0A, 0x0E, 0x01, 0x0F, 0x11, 0x0F, 0x00}; //å |
wim | 11:9ec02df863a1 | 220 | const char udc_AE[] = {0x0F, 0x14, 0x14, 0x1F, 0x14, 0x14, 0x17, 0x00}; //Æ |
wim | 11:9ec02df863a1 | 221 | const char udc_0E[] = {0x0E, 0x13, 0x15, 0x15, 0x15, 0x19, 0x0E, 0x00}; //Ø |
wim | 18:bd65dc10f27f | 222 | const char udc_Ao[] = {0x0E, 0x0A, 0x0E, 0x11, 0x1F, 0x11, 0x11, 0x00}; //Å |
wim | 18:bd65dc10f27f | 223 | const char udc_PO[] = {0x04, 0x0A, 0x0A, 0x1F, 0x1B, 0x1B, 0x1F, 0x00}; //Padlock Open |
wim | 18:bd65dc10f27f | 224 | const char udc_PC[] = {0x1C, 0x10, 0x08, 0x1F, 0x1B, 0x1B, 0x1F, 0x00}; //Padlock Closed |
wim | 11:9ec02df863a1 | 225 | |
wim | 11:9ec02df863a1 | 226 | const char udc_0[] = {0x18, 0x14, 0x12, 0x11, 0x12, 0x14, 0x18, 0x00}; // |> |
wim | 11:9ec02df863a1 | 227 | const char udc_1[] = {0x03, 0x05, 0x09, 0x11, 0x09, 0x05, 0x03, 0x00}; // <| |
wim | 11:9ec02df863a1 | 228 | const char udc_2[] = {0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00}; // | |
wim | 11:9ec02df863a1 | 229 | const char udc_3[] = {0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x00}; // || |
wim | 11:9ec02df863a1 | 230 | const char udc_4[] = {0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x00}; // ||| |
wim | 11:9ec02df863a1 | 231 | const char udc_5[] = {0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x00}; // = |
wim | 11:9ec02df863a1 | 232 | const char udc_6[] = {0x15, 0x0a, 0x15, 0x0a, 0x15, 0x0a, 0x15, 0x00}; // checkerboard |
wim | 11:9ec02df863a1 | 233 | const char udc_7[] = {0x10, 0x08, 0x04, 0x02, 0x01, 0x00, 0x10, 0x00}; // \ |
wim | 11:9ec02df863a1 | 234 | |
wim | 13:24506ba22480 | 235 | const char udc_degr[] = {0x06, 0x09, 0x09, 0x06, 0x00, 0x00, 0x00, 0x00}; // Degree symbol |
wim | 13:24506ba22480 | 236 | |
wim | 13:24506ba22480 | 237 | const char udc_TM_T[] = {0x1F, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00}; // Trademark T |
wim | 13:24506ba22480 | 238 | const char udc_TM_M[] = {0x11, 0x1B, 0x15, 0x11, 0x00, 0x00, 0x00, 0x00}; // Trademark M |
wim | 13:24506ba22480 | 239 | |
wim | 13:24506ba22480 | 240 | //const char udc_Bat_Hi[] = {0x0E, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x00}; // Battery Full |
wim | 13:24506ba22480 | 241 | //const char udc_Bat_Ha[] = {0x0E, 0x11, 0x13, 0x17, 0x1F, 0x1F, 0x1F, 0x00}; // Battery Half |
wim | 13:24506ba22480 | 242 | //const char udc_Bat_Lo[] = {0x0E, 0x11, 0x11, 0x11, 0x11, 0x11, 0x1F, 0x00}; // Battery Low |
wim | 13:24506ba22480 | 243 | const char udc_Bat_Hi[] = {0x0E, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x00}; // Battery Full |
wim | 13:24506ba22480 | 244 | const char udc_Bat_Ha[] = {0x0E, 0x11, 0x11, 0x1F, 0x1F, 0x1F, 0x1F, 0x00}; // Battery Half |
wim | 13:24506ba22480 | 245 | const char udc_Bat_Lo[] = {0x0E, 0x11, 0x11, 0x11, 0x11, 0x1F, 0x1F, 0x00}; // Battery Low |
wim | 18:bd65dc10f27f | 246 | const char udc_AC[] = {0x0A, 0x0A, 0x1F, 0x11, 0x0E, 0x04, 0x04, 0x00}; // AC Power |
wim | 13:24506ba22480 | 247 | |
wim | 18:bd65dc10f27f | 248 | //const char udc_smiley[] = {0x00, 0x0A, 0x00, 0x04, 0x11, 0x0E, 0x00, 0x00}; // Smiley |
wim | 18:bd65dc10f27f | 249 | //const char udc_droopy[] = {0x00, 0x0A, 0x00, 0x04, 0x00, 0x0E, 0x11, 0x00}; // Droopey |
wim | 18:bd65dc10f27f | 250 | //const char udc_note[] = {0x01, 0x03, 0x05, 0x09, 0x0B, 0x1B, 0x18, 0x00}; // Note |
wim | 18:bd65dc10f27f | 251 | |
wim | 18:bd65dc10f27f | 252 | //const char udc_bar_1[] = {0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00}; // Bar 1 |
wim | 18:bd65dc10f27f | 253 | //const char udc_bar_2[] = {0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00}; // Bar 11 |
wim | 18:bd65dc10f27f | 254 | //const char udc_bar_3[] = {0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x00}; // Bar 111 |
wim | 18:bd65dc10f27f | 255 | //const char udc_bar_4[] = {0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x00}; // Bar 1111 |
wim | 18:bd65dc10f27f | 256 | //const char udc_bar_5[] = {0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x00}; // Bar 11111 |
wim | 13:24506ba22480 | 257 | |
wim | 28:30fa94f7341c | 258 | //const char udc_ch_1[] = {0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00}; // Hor bars 4 |
wim | 28:30fa94f7341c | 259 | //const char udc_ch_2[] = {0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1f}; // Hor bars 4 (inverted) |
wim | 28:30fa94f7341c | 260 | //const char udc_ch_3[] = {0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15}; // Ver bars 3 |
wim | 28:30fa94f7341c | 261 | //const char udc_ch_4[] = {0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a}; // Ver bars 3 (inverted) |
wim | 29:a3663151aa65 | 262 | //const char udc_ch_yr[] = {0x08, 0x0f, 0x12, 0x0f, 0x0a, 0x1f, 0x02, 0x02}; // Year (kana) |
wim | 29:a3663151aa65 | 263 | //const char udc_ch_mo[] = {0x0f, 0x09, 0x0f, 0x09, 0x0f, 0x09, 0x09, 0x13}; // Month (kana) |
wim | 29:a3663151aa65 | 264 | //const char udc_ch_dy[] = {0x1f, 0x11, 0x11, 0x1f, 0x11, 0x11, 0x11, 0x1F}; // Day (kana) |
wim | 29:a3663151aa65 | 265 | //const char udc_ch_mi[] = {0x0C, 0x0a, 0x11, 0x1f, 0x09, 0x09, 0x09, 0x13}; // minute (kana) |
wim | 28:30fa94f7341c | 266 | |
wim | 11:9ec02df863a1 | 267 | |
wim | 11:9ec02df863a1 | 268 | /** A TextLCD interface for driving 4-bit HD44780-based LCDs |
wim | 11:9ec02df863a1 | 269 | * |
wim | 22:35742ec80c24 | 270 | * @brief Currently supports 8x1, 8x2, 12x2, 12x4, 16x1, 16x2, 16x4, 20x2, 20x4, 24x2, 24x4, 40x2 and 40x4 panels |
wim | 27:22d5086f6ba6 | 271 | * 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 | 272 | * |
wim | 11:9ec02df863a1 | 273 | */ |
wim | 21:9eb628d9e164 | 274 | class TextLCD_Base : public Stream { |
simon | 1:ac48b187213c | 275 | public: |
simon | 1:ac48b187213c | 276 | |
simon | 2:227356c7d12c | 277 | /** LCD panel format */ |
simon | 1:ac48b187213c | 278 | enum LCDType { |
wim | 8:03116f75b66e | 279 | LCD8x1, /**< 8x1 LCD panel */ |
wim | 13:24506ba22480 | 280 | LCD8x2, /**< 8x2 LCD panel */ |
wim | 18:bd65dc10f27f | 281 | LCD8x2B, /**< 8x2 LCD panel (actually 16x1) */ |
wim | 29:a3663151aa65 | 282 | // LCD12x1, /**< 12x1 LCD panel */ |
wim | 29:a3663151aa65 | 283 | // LCD12x1B, /**< 12x1 LCD panel, special mode PCF21XX */ |
wim | 15:b70ebfffb258 | 284 | LCD12x2, /**< 12x2 LCD panel */ |
wim | 29:a3663151aa65 | 285 | LCD12x3B, /**< 12x3 LCD panel, special mode PCF21XX */ |
wim | 15:b70ebfffb258 | 286 | LCD12x4, /**< 12x4 LCD panel */ |
wim | 29:a3663151aa65 | 287 | LCD12x4B, /**< 12x4 LCD panel, special mode PCF21XX */ |
wim | 13:24506ba22480 | 288 | LCD16x1, /**< 16x1 LCD panel (actually 8x2) */ |
wim | 8:03116f75b66e | 289 | LCD16x2, /**< 16x2 LCD panel (default) */ |
wim | 8:03116f75b66e | 290 | LCD16x2B, /**< 16x2 LCD panel alternate addressing */ |
wim | 29:a3663151aa65 | 291 | // LCD16x3B, /**< 16x3 LCD panel, special mode ST7036 */ |
wim | 8:03116f75b66e | 292 | LCD16x4, /**< 16x4 LCD panel */ |
wim | 29:a3663151aa65 | 293 | // LCD20x1, /**< 20x1 LCD panel */ |
wim | 8:03116f75b66e | 294 | LCD20x2, /**< 20x2 LCD panel */ |
wim | 8:03116f75b66e | 295 | LCD20x4, /**< 20x4 LCD panel */ |
wim | 29:a3663151aa65 | 296 | LCD24x4B, /**< 24x4 LCD panel, special mode KS0078 */ |
wim | 29:a3663151aa65 | 297 | LCD24x1, /**< 24x1 LCD panel */ |
wim | 9:0893d986e717 | 298 | LCD24x2, /**< 24x2 LCD panel */ |
wim | 15:b70ebfffb258 | 299 | LCD40x2, /**< 40x2 LCD panel */ |
wim | 15:b70ebfffb258 | 300 | LCD40x4 /**< 40x4 LCD panel, Two controller version */ |
simon | 1:ac48b187213c | 301 | }; |
simon | 1:ac48b187213c | 302 | |
wim | 19:c747b9e2e7b8 | 303 | /** LCD Controller Device */ |
wim | 19:c747b9e2e7b8 | 304 | enum LCDCtrl { |
wim | 29:a3663151aa65 | 305 | HD44780, /**< HD44780 (default) */ |
wim | 29:a3663151aa65 | 306 | WS0010, /**< WS0010 OLED Controller, 4/8 bit */ |
wim | 29:a3663151aa65 | 307 | ST7036, /**< ST7036 3V3 with Booster, 4/8 bit, SPI */ |
wim | 29:a3663151aa65 | 308 | ST7032_3V3, /**< ST7032 3V3 with Booster, 4/8 bit, SPI, I2C */ |
wim | 29:a3663151aa65 | 309 | ST7032_5V, /**< ST7032 5V no Booster, 4/8 bit, SPI, I2C */ |
wim | 29:a3663151aa65 | 310 | KS0078, /**< KS0078 24x3 support */ |
wim | 29:a3663151aa65 | 311 | PCF21XX_3V3, /**< PCF21XX 3V3 with Booster, 4/8 bit, I2C */ |
wim | 29:a3663151aa65 | 312 | // PCF21XX_5V /**< PCF21XX 5V no Booster, 4/8 bit, I2C */ |
wim | 19:c747b9e2e7b8 | 313 | }; |
wim | 19:c747b9e2e7b8 | 314 | |
wim | 19:c747b9e2e7b8 | 315 | |
wim | 10:dd9b3a696acd | 316 | /** LCD Cursor control */ |
wim | 10:dd9b3a696acd | 317 | enum LCDCursor { |
wim | 17:652ab113bc2e | 318 | CurOff_BlkOff = 0x00, /**< Cursor Off, Blinking Char Off */ |
wim | 17:652ab113bc2e | 319 | CurOn_BlkOff = 0x02, /**< Cursor On, Blinking Char Off */ |
wim | 17:652ab113bc2e | 320 | CurOff_BlkOn = 0x01, /**< Cursor Off, Blinking Char On */ |
wim | 17:652ab113bc2e | 321 | CurOn_BlkOn = 0x03 /**< Cursor On, Blinking Char On */ |
wim | 17:652ab113bc2e | 322 | }; |
wim | 17:652ab113bc2e | 323 | |
wim | 17:652ab113bc2e | 324 | |
wim | 17:652ab113bc2e | 325 | /** LCD Display control */ |
wim | 17:652ab113bc2e | 326 | enum LCDMode { |
wim | 17:652ab113bc2e | 327 | DispOff = 0x00, /**< Display Off */ |
wim | 17:652ab113bc2e | 328 | DispOn = 0x04 /**< Display On */ |
wim | 10:dd9b3a696acd | 329 | }; |
wim | 10:dd9b3a696acd | 330 | |
wim | 20:e0da005a777f | 331 | /** LCD Backlight control */ |
wim | 20:e0da005a777f | 332 | enum LCDBacklight { |
wim | 20:e0da005a777f | 333 | LightOff, /**< Backlight Off */ |
wim | 20:e0da005a777f | 334 | LightOn /**< Backlight On */ |
wim | 20:e0da005a777f | 335 | }; |
wim | 10:dd9b3a696acd | 336 | |
simon | 2:227356c7d12c | 337 | |
simon | 2:227356c7d12c | 338 | #if DOXYGEN_ONLY |
simon | 2:227356c7d12c | 339 | /** Write a character to the LCD |
simon | 2:227356c7d12c | 340 | * |
simon | 2:227356c7d12c | 341 | * @param c The character to write to the display |
simon | 2:227356c7d12c | 342 | */ |
simon | 2:227356c7d12c | 343 | int putc(int c); |
simon | 2:227356c7d12c | 344 | |
simon | 2:227356c7d12c | 345 | /** Write a formated string to the LCD |
simon | 2:227356c7d12c | 346 | * |
simon | 2:227356c7d12c | 347 | * @param format A printf-style format string, followed by the |
simon | 2:227356c7d12c | 348 | * variables to use in formating the string. |
simon | 2:227356c7d12c | 349 | */ |
simon | 2:227356c7d12c | 350 | int printf(const char* format, ...); |
simon | 2:227356c7d12c | 351 | #endif |
simon | 2:227356c7d12c | 352 | |
wim | 29:a3663151aa65 | 353 | /** Locate cursor to a screen column and row |
simon | 2:227356c7d12c | 354 | * |
simon | 2:227356c7d12c | 355 | * @param column The horizontal position from the left, indexed from 0 |
simon | 2:227356c7d12c | 356 | * @param row The vertical position from the top, indexed from 0 |
simon | 2:227356c7d12c | 357 | */ |
simon | 1:ac48b187213c | 358 | void locate(int column, int row); |
simon | 2:227356c7d12c | 359 | |
wim | 10:dd9b3a696acd | 360 | |
wim | 10:dd9b3a696acd | 361 | /** Return the memoryaddress of screen column and row location |
wim | 10:dd9b3a696acd | 362 | * |
wim | 10:dd9b3a696acd | 363 | * @param column The horizontal position from the left, indexed from 0 |
wim | 10:dd9b3a696acd | 364 | * @param row The vertical position from the top, indexed from 0 |
wim | 10:dd9b3a696acd | 365 | * @param return The memoryaddress of screen column and row location |
wim | 10:dd9b3a696acd | 366 | */ |
wim | 9:0893d986e717 | 367 | int getAddress(int column, int row); |
wim | 10:dd9b3a696acd | 368 | |
wim | 10:dd9b3a696acd | 369 | |
wim | 10:dd9b3a696acd | 370 | /** Set the memoryaddress of screen column and row location |
wim | 10:dd9b3a696acd | 371 | * |
wim | 10:dd9b3a696acd | 372 | * @param column The horizontal position from the left, indexed from 0 |
wim | 10:dd9b3a696acd | 373 | * @param row The vertical position from the top, indexed from 0 |
wim | 10:dd9b3a696acd | 374 | */ |
wim | 9:0893d986e717 | 375 | void setAddress(int column, int row); |
wim | 9:0893d986e717 | 376 | |
wim | 10:dd9b3a696acd | 377 | |
wim | 22:35742ec80c24 | 378 | /** Clear the screen and locate to 0,0 |
wim | 22:35742ec80c24 | 379 | */ |
simon | 1:ac48b187213c | 380 | void cls(); |
simon | 2:227356c7d12c | 381 | |
wim | 10:dd9b3a696acd | 382 | /** Return the number of rows |
wim | 10:dd9b3a696acd | 383 | * |
wim | 10:dd9b3a696acd | 384 | * @param return The number of rows |
wim | 10:dd9b3a696acd | 385 | */ |
simon | 1:ac48b187213c | 386 | int rows(); |
wim | 10:dd9b3a696acd | 387 | |
wim | 10:dd9b3a696acd | 388 | /** Return the number of columns |
wim | 10:dd9b3a696acd | 389 | * |
wim | 10:dd9b3a696acd | 390 | * @param return The number of columns |
wim | 10:dd9b3a696acd | 391 | */ |
wim | 10:dd9b3a696acd | 392 | int columns(); |
simon | 2:227356c7d12c | 393 | |
wim | 11:9ec02df863a1 | 394 | /** Set the Cursormode |
wim | 11:9ec02df863a1 | 395 | * |
wim | 17:652ab113bc2e | 396 | * @param cursorMode The Cursor mode (CurOff_BlkOff, CurOn_BlkOff, CurOff_BlkOn, CurOn_BlkOn) |
wim | 11:9ec02df863a1 | 397 | */ |
wim | 17:652ab113bc2e | 398 | void setCursor(LCDCursor cursorMode); |
wim | 17:652ab113bc2e | 399 | |
wim | 17:652ab113bc2e | 400 | |
wim | 17:652ab113bc2e | 401 | /** Set the Displaymode |
wim | 17:652ab113bc2e | 402 | * |
wim | 17:652ab113bc2e | 403 | * @param displayMode The Display mode (DispOff, DispOn) |
wim | 17:652ab113bc2e | 404 | */ |
wim | 21:9eb628d9e164 | 405 | void setMode(LCDMode displayMode); |
wim | 11:9ec02df863a1 | 406 | |
wim | 20:e0da005a777f | 407 | /** Set the Backlight mode |
wim | 20:e0da005a777f | 408 | * |
wim | 21:9eb628d9e164 | 409 | * @param backlightMode The Backlight mode (LightOff, LightOn) |
wim | 20:e0da005a777f | 410 | */ |
wim | 21:9eb628d9e164 | 411 | void setBacklight(LCDBacklight backlightMode); |
wim | 20:e0da005a777f | 412 | |
wim | 11:9ec02df863a1 | 413 | |
wim | 11:9ec02df863a1 | 414 | /** Set User Defined Characters |
wim | 11:9ec02df863a1 | 415 | * |
wim | 11:9ec02df863a1 | 416 | * @param unsigned char c The Index of the UDC (0..7) |
wim | 12:6bf9d9957d31 | 417 | * @param char *udc_data The bitpatterns for the UDC (8 bytes of 5 significant bits) |
wim | 11:9ec02df863a1 | 418 | */ |
wim | 11:9ec02df863a1 | 419 | void setUDC(unsigned char c, char *udc_data); |
wim | 11:9ec02df863a1 | 420 | |
wim | 29:a3663151aa65 | 421 | //test |
wim | 29:a3663151aa65 | 422 | void _initCtrl(); |
wim | 29:a3663151aa65 | 423 | |
simon | 1:ac48b187213c | 424 | protected: |
wim | 13:24506ba22480 | 425 | |
wim | 21:9eb628d9e164 | 426 | /** LCD controller select, mainly used for LCD40x4 |
wim | 21:9eb628d9e164 | 427 | */ |
wim | 19:c747b9e2e7b8 | 428 | enum _LCDCtrl_Idx { |
wim | 15:b70ebfffb258 | 429 | _LCDCtrl_0, /*< Primary */ |
wim | 15:b70ebfffb258 | 430 | _LCDCtrl_1, /*< Secondary */ |
wim | 15:b70ebfffb258 | 431 | }; |
wim | 21:9eb628d9e164 | 432 | |
wim | 21:9eb628d9e164 | 433 | /** Create a TextLCD_Base interface |
wim | 21:9eb628d9e164 | 434 | * @brief Base class, can not be instantiated |
wim | 21:9eb628d9e164 | 435 | * |
wim | 21:9eb628d9e164 | 436 | * @param type Sets the panel size/addressing mode (default = LCD16x2) |
wim | 21:9eb628d9e164 | 437 | * @param ctrl LCD controller (default = HD44780) |
wim | 21:9eb628d9e164 | 438 | */ |
wim | 21:9eb628d9e164 | 439 | TextLCD_Base(LCDType type = LCD16x2, LCDCtrl ctrl = HD44780); |
wim | 21:9eb628d9e164 | 440 | |
wim | 15:b70ebfffb258 | 441 | |
simon | 1:ac48b187213c | 442 | // Stream implementation functions |
simon | 1:ac48b187213c | 443 | virtual int _putc(int value); |
simon | 1:ac48b187213c | 444 | virtual int _getc(); |
simon | 1:ac48b187213c | 445 | |
wim | 29:a3663151aa65 | 446 | /** Low level method for LCD controller |
wim | 21:9eb628d9e164 | 447 | */ |
wim | 13:24506ba22480 | 448 | void _init(); |
wim | 29:a3663151aa65 | 449 | |
wim | 29:a3663151aa65 | 450 | /** Low level initialisation method for LCD controller |
wim | 29:a3663151aa65 | 451 | */ |
wim | 29:a3663151aa65 | 452 | // void _initCtrl(); |
wim | 29:a3663151aa65 | 453 | |
wim | 29:a3663151aa65 | 454 | /** Low level character address set method |
wim | 29:a3663151aa65 | 455 | */ |
wim | 13:24506ba22480 | 456 | int _address(int column, int row); |
wim | 29:a3663151aa65 | 457 | |
wim | 29:a3663151aa65 | 458 | /** Low level cursor enable or disable method |
wim | 29:a3663151aa65 | 459 | */ |
wim | 21:9eb628d9e164 | 460 | void _setCursor(LCDCursor show); |
wim | 29:a3663151aa65 | 461 | |
wim | 29:a3663151aa65 | 462 | /** Low level method to store user defined characters for current controller |
wim | 29:a3663151aa65 | 463 | */ |
wim | 17:652ab113bc2e | 464 | void _setUDC(unsigned char c, char *udc_data); |
wim | 29:a3663151aa65 | 465 | |
wim | 29:a3663151aa65 | 466 | /** Low level method to restore the cursortype and display mode for current controller |
wim | 29:a3663151aa65 | 467 | */ |
wim | 21:9eb628d9e164 | 468 | void _setCursorAndDisplayMode(LCDMode displayMode, LCDCursor cursorType); |
wim | 13:24506ba22480 | 469 | |
wim | 29:a3663151aa65 | 470 | |
wim | 29:a3663151aa65 | 471 | /** Low level nibble write operation to LCD controller (serial or parallel) |
wim | 21:9eb628d9e164 | 472 | */ |
wim | 17:652ab113bc2e | 473 | void _writeNibble(int value); |
wim | 29:a3663151aa65 | 474 | |
wim | 29:a3663151aa65 | 475 | /** Low level command byte write operation to LCD controller. |
wim | 29:a3663151aa65 | 476 | * Methods resets the RS bit and provides the required timing for the command. |
wim | 29:a3663151aa65 | 477 | */ |
wim | 15:b70ebfffb258 | 478 | void _writeCommand(int command); |
wim | 29:a3663151aa65 | 479 | |
wim | 29:a3663151aa65 | 480 | /** Low level data byte write operation to LCD controller (serial or parallel). |
wim | 29:a3663151aa65 | 481 | * Methods sets the RS bit and provides the required timing for the data. |
wim | 29:a3663151aa65 | 482 | */ |
wim | 15:b70ebfffb258 | 483 | void _writeData(int data); |
wim | 15:b70ebfffb258 | 484 | |
wim | 29:a3663151aa65 | 485 | |
wim | 29:a3663151aa65 | 486 | /** Pure Virtual Low level writes to LCD Bus (serial or parallel) |
wim | 29:a3663151aa65 | 487 | * Set the Enable pin. |
wim | 29:a3663151aa65 | 488 | */ |
wim | 29:a3663151aa65 | 489 | virtual void _setEnable(bool value) = 0; |
wim | 29:a3663151aa65 | 490 | |
wim | 21:9eb628d9e164 | 491 | /** Pure Virtual Low level writes to LCD Bus (serial or parallel) |
wim | 29:a3663151aa65 | 492 | * Set the RS pin ( 0 = Command, 1 = Data). |
wim | 29:a3663151aa65 | 493 | */ |
wim | 21:9eb628d9e164 | 494 | virtual void _setRS(bool value) = 0; |
wim | 29:a3663151aa65 | 495 | |
wim | 29:a3663151aa65 | 496 | /** Pure Virtual Low level writes to LCD Bus (serial or parallel) |
wim | 29:a3663151aa65 | 497 | * Set the BL pin (0 = Backlight Off, 1 = Backlight On). |
wim | 29:a3663151aa65 | 498 | */ |
wim | 21:9eb628d9e164 | 499 | virtual void _setBL(bool value) = 0; |
wim | 29:a3663151aa65 | 500 | |
wim | 29:a3663151aa65 | 501 | /** Pure Virtual Low level writes to LCD Bus (serial or parallel) |
wim | 29:a3663151aa65 | 502 | * Set the databus value (4 bit). |
wim | 29:a3663151aa65 | 503 | */ |
wim | 21:9eb628d9e164 | 504 | virtual void _setData(int value) = 0; |
wim | 13:24506ba22480 | 505 | |
wim | 29:a3663151aa65 | 506 | /** Low level byte write operation to LCD controller (serial or parallel) |
wim | 29:a3663151aa65 | 507 | * Depending on the RS pin this byte will be interpreted as data or command |
wim | 29:a3663151aa65 | 508 | */ |
wim | 29:a3663151aa65 | 509 | virtual void _writeByte(int value); |
wim | 13:24506ba22480 | 510 | |
wim | 13:24506ba22480 | 511 | //Display type |
simon | 1:ac48b187213c | 512 | LCDType _type; |
simon | 1:ac48b187213c | 513 | |
wim | 21:9eb628d9e164 | 514 | //Display mode |
wim | 17:652ab113bc2e | 515 | LCDMode _currentMode; |
wim | 17:652ab113bc2e | 516 | |
wim | 19:c747b9e2e7b8 | 517 | //Controller type |
wim | 19:c747b9e2e7b8 | 518 | LCDCtrl _ctrl; |
wim | 19:c747b9e2e7b8 | 519 | |
wim | 15:b70ebfffb258 | 520 | //Controller select, mainly used for LCD40x4 |
wim | 19:c747b9e2e7b8 | 521 | _LCDCtrl_Idx _ctrl_idx; |
wim | 15:b70ebfffb258 | 522 | |
wim | 13:24506ba22480 | 523 | // Cursor |
simon | 1:ac48b187213c | 524 | int _column; |
simon | 1:ac48b187213c | 525 | int _row; |
wim | 15:b70ebfffb258 | 526 | LCDCursor _currentCursor; |
simon | 1:ac48b187213c | 527 | }; |
simon | 1:ac48b187213c | 528 | |
wim | 23:d47f226efb24 | 529 | //--------- End TextLCD_Base ----------- |
wim | 22:35742ec80c24 | 530 | |
wim | 22:35742ec80c24 | 531 | |
wim | 22:35742ec80c24 | 532 | |
wim | 23:d47f226efb24 | 533 | //--------- Start TextLCD Bus ----------- |
wim | 21:9eb628d9e164 | 534 | |
wim | 21:9eb628d9e164 | 535 | /** Create a TextLCD interface for using regular mbed pins |
wim | 21:9eb628d9e164 | 536 | * |
wim | 21:9eb628d9e164 | 537 | */ |
wim | 21:9eb628d9e164 | 538 | class TextLCD : public TextLCD_Base { |
wim | 21:9eb628d9e164 | 539 | public: |
wim | 21:9eb628d9e164 | 540 | /** Create a TextLCD interface for using regular mbed pins |
wim | 21:9eb628d9e164 | 541 | * |
wim | 21:9eb628d9e164 | 542 | * @param rs Instruction/data control line |
wim | 21:9eb628d9e164 | 543 | * @param e Enable line (clock) |
wim | 21:9eb628d9e164 | 544 | * @param d4-d7 Data lines for using as a 4-bit interface |
wim | 21:9eb628d9e164 | 545 | * @param type Sets the panel size/addressing mode (default = LCD16x2) |
wim | 21:9eb628d9e164 | 546 | * @param bl Backlight control line (optional, default = NC) |
wim | 21:9eb628d9e164 | 547 | * @param e2 Enable2 line (clock for second controller, LCD40x4 only) |
wim | 21:9eb628d9e164 | 548 | * @param ctrl LCD controller (default = HD44780) |
wim | 21:9eb628d9e164 | 549 | */ |
wim | 21:9eb628d9e164 | 550 | 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 | 551 | |
wim | 22:35742ec80c24 | 552 | |
wim | 22:35742ec80c24 | 553 | /** Destruct a TextLCD interface for using regular mbed pins |
wim | 22:35742ec80c24 | 554 | * |
wim | 22:35742ec80c24 | 555 | * @param none |
wim | 22:35742ec80c24 | 556 | * @return none |
wim | 22:35742ec80c24 | 557 | */ |
wim | 22:35742ec80c24 | 558 | virtual ~TextLCD(); |
wim | 22:35742ec80c24 | 559 | |
wim | 21:9eb628d9e164 | 560 | private: |
wim | 29:a3663151aa65 | 561 | |
wim | 29:a3663151aa65 | 562 | /** Implementation of pure Virtual Low level writes to LCD Bus (parallel) |
wim | 29:a3663151aa65 | 563 | * Set the Enable pin. |
wim | 29:a3663151aa65 | 564 | */ |
wim | 21:9eb628d9e164 | 565 | virtual void _setEnable(bool value); |
wim | 29:a3663151aa65 | 566 | |
wim | 29:a3663151aa65 | 567 | /** Implementation of pure Virtual Low level writes to LCD Bus (parallel) |
wim | 29:a3663151aa65 | 568 | * Set the RS pin ( 0 = Command, 1 = Data). |
wim | 29:a3663151aa65 | 569 | */ |
wim | 21:9eb628d9e164 | 570 | virtual void _setRS(bool value); |
wim | 29:a3663151aa65 | 571 | |
wim | 29:a3663151aa65 | 572 | /** Implementation of pure Virtual Low level writes to LCD Bus (parallel) |
wim | 29:a3663151aa65 | 573 | * Set the BL pin (0 = Backlight Off, 1 = Backlight On). |
wim | 29:a3663151aa65 | 574 | */ |
wim | 21:9eb628d9e164 | 575 | virtual void _setBL(bool value); |
wim | 29:a3663151aa65 | 576 | |
wim | 29:a3663151aa65 | 577 | /** Implementation of pure Virtual Low level writes to LCD Bus (parallel) |
wim | 29:a3663151aa65 | 578 | * Set the databus value (4 bit). |
wim | 29:a3663151aa65 | 579 | */ |
wim | 21:9eb628d9e164 | 580 | virtual void _setData(int value); |
wim | 21:9eb628d9e164 | 581 | |
wim | 29:a3663151aa65 | 582 | |
wim | 22:35742ec80c24 | 583 | /** Regular mbed pins bus |
wim | 22:35742ec80c24 | 584 | */ |
wim | 22:35742ec80c24 | 585 | DigitalOut _rs, _e; |
wim | 22:35742ec80c24 | 586 | BusOut _d; |
wim | 22:35742ec80c24 | 587 | |
wim | 22:35742ec80c24 | 588 | /** Optional Hardware pins for the Backlight and LCD40x4 device |
wim | 22:35742ec80c24 | 589 | * Default PinName value is NC, must be used as pointer to avoid issues with mbed lib and DigitalOut pins |
wim | 22:35742ec80c24 | 590 | */ |
wim | 22:35742ec80c24 | 591 | DigitalOut *_bl, *_e2; |
wim | 21:9eb628d9e164 | 592 | }; |
wim | 21:9eb628d9e164 | 593 | |
wim | 22:35742ec80c24 | 594 | |
wim | 23:d47f226efb24 | 595 | //----------- End TextLCD --------------- |
wim | 21:9eb628d9e164 | 596 | |
wim | 21:9eb628d9e164 | 597 | |
wim | 23:d47f226efb24 | 598 | //--------- Start TextLCD_I2C ----------- |
wim | 22:35742ec80c24 | 599 | |
wim | 22:35742ec80c24 | 600 | |
wim | 26:bd897a001012 | 601 | /** Create a TextLCD interface using an I2C PCF8574 (or PCF8574A) or MCP23008 portexpander |
wim | 21:9eb628d9e164 | 602 | * |
wim | 21:9eb628d9e164 | 603 | */ |
wim | 21:9eb628d9e164 | 604 | class TextLCD_I2C : public TextLCD_Base { |
wim | 21:9eb628d9e164 | 605 | public: |
wim | 26:bd897a001012 | 606 | /** Create a TextLCD interface using an I2C PCF8574 (or PCF8574A) or MCP23008 portexpander |
wim | 21:9eb628d9e164 | 607 | * |
wim | 21:9eb628d9e164 | 608 | * @param i2c I2C Bus |
wim | 26:bd897a001012 | 609 | * @param deviceAddress I2C slave address (PCF8574 or PCF8574A, default = PCF8574_SA0 = 0x40) |
wim | 21:9eb628d9e164 | 610 | * @param type Sets the panel size/addressing mode (default = LCD16x2) |
wim | 21:9eb628d9e164 | 611 | * @param ctrl LCD controller (default = HD44780) |
wim | 21:9eb628d9e164 | 612 | */ |
wim | 26:bd897a001012 | 613 | TextLCD_I2C(I2C *i2c, char deviceAddress = PCF8574_SA0, LCDType type = LCD16x2, LCDCtrl ctrl = HD44780); |
wim | 21:9eb628d9e164 | 614 | |
wim | 21:9eb628d9e164 | 615 | private: |
wim | 29:a3663151aa65 | 616 | |
wim | 29:a3663151aa65 | 617 | /** Implementation of pure Virtual Low level writes to LCD Bus (serial expander) |
wim | 29:a3663151aa65 | 618 | * Set the Enable pin. |
wim | 29:a3663151aa65 | 619 | */ |
wim | 21:9eb628d9e164 | 620 | virtual void _setEnable(bool value); |
wim | 29:a3663151aa65 | 621 | |
wim | 29:a3663151aa65 | 622 | /** Implementation of pure Virtual Low level writes to LCD Bus (serial expander) |
wim | 29:a3663151aa65 | 623 | * Set the RS pin ( 0 = Command, 1 = Data). |
wim | 29:a3663151aa65 | 624 | */ |
wim | 21:9eb628d9e164 | 625 | virtual void _setRS(bool value); |
wim | 29:a3663151aa65 | 626 | |
wim | 29:a3663151aa65 | 627 | /** Implementation of pure Virtual Low level writes to LCD Bus (serial expander) |
wim | 29:a3663151aa65 | 628 | * Set the BL pin (0 = Backlight Off, 1 = Backlight On). |
wim | 29:a3663151aa65 | 629 | */ |
wim | 21:9eb628d9e164 | 630 | virtual void _setBL(bool value); |
wim | 29:a3663151aa65 | 631 | |
wim | 29:a3663151aa65 | 632 | /** Implementation of pure Virtual Low level writes to LCD Bus (serial expander) |
wim | 29:a3663151aa65 | 633 | * Set the databus value (4 bit). |
wim | 29:a3663151aa65 | 634 | */ |
wim | 29:a3663151aa65 | 635 | virtual void _setData(int value); |
wim | 29:a3663151aa65 | 636 | |
wim | 29:a3663151aa65 | 637 | |
wim | 29:a3663151aa65 | 638 | /** Write data to MCP23008 I2C portexpander |
wim | 29:a3663151aa65 | 639 | * @param reg register to write |
wim | 29:a3663151aa65 | 640 | * @param value data to write |
wim | 29:a3663151aa65 | 641 | * @return none |
wim | 29:a3663151aa65 | 642 | * |
wim | 29:a3663151aa65 | 643 | */ |
wim | 26:bd897a001012 | 644 | void _write_register (int reg, int value); |
wim | 21:9eb628d9e164 | 645 | |
wim | 21:9eb628d9e164 | 646 | //I2C bus |
wim | 21:9eb628d9e164 | 647 | I2C *_i2c; |
wim | 21:9eb628d9e164 | 648 | char _slaveAddress; |
wim | 21:9eb628d9e164 | 649 | |
wim | 21:9eb628d9e164 | 650 | // Internal bus mirror value for serial bus only |
wim | 21:9eb628d9e164 | 651 | char _lcd_bus; |
wim | 21:9eb628d9e164 | 652 | |
wim | 21:9eb628d9e164 | 653 | }; |
wim | 21:9eb628d9e164 | 654 | |
wim | 21:9eb628d9e164 | 655 | |
wim | 23:d47f226efb24 | 656 | //---------- End TextLCD_I2C ------------ |
wim | 22:35742ec80c24 | 657 | |
wim | 22:35742ec80c24 | 658 | |
wim | 22:35742ec80c24 | 659 | |
wim | 23:d47f226efb24 | 660 | //--------- Start TextLCD_SPI ----------- |
wim | 22:35742ec80c24 | 661 | |
wim | 21:9eb628d9e164 | 662 | |
wim | 21:9eb628d9e164 | 663 | /** Create a TextLCD interface using an SPI 74595 portexpander |
wim | 21:9eb628d9e164 | 664 | * |
wim | 21:9eb628d9e164 | 665 | */ |
wim | 21:9eb628d9e164 | 666 | class TextLCD_SPI : public TextLCD_Base { |
wim | 21:9eb628d9e164 | 667 | public: |
wim | 21:9eb628d9e164 | 668 | /** Create a TextLCD interface using an SPI 74595 portexpander |
wim | 21:9eb628d9e164 | 669 | * |
wim | 21:9eb628d9e164 | 670 | * @param spi SPI Bus |
wim | 21:9eb628d9e164 | 671 | * @param cs chip select pin (active low) |
wim | 21:9eb628d9e164 | 672 | * @param type Sets the panel size/addressing mode (default = LCD16x2) |
wim | 21:9eb628d9e164 | 673 | * @param ctrl LCD controller (default = HD44780) |
wim | 21:9eb628d9e164 | 674 | */ |
wim | 21:9eb628d9e164 | 675 | TextLCD_SPI(SPI *spi, PinName cs, LCDType type = LCD16x2, LCDCtrl ctrl = HD44780); |
wim | 21:9eb628d9e164 | 676 | |
wim | 21:9eb628d9e164 | 677 | |
wim | 21:9eb628d9e164 | 678 | private: |
wim | 29:a3663151aa65 | 679 | |
wim | 29:a3663151aa65 | 680 | /** Implementation of pure Virtual Low level writes to LCD Bus (serial expander) |
wim | 29:a3663151aa65 | 681 | * Set the Enable pin. |
wim | 29:a3663151aa65 | 682 | */ |
wim | 21:9eb628d9e164 | 683 | virtual void _setEnable(bool value); |
wim | 29:a3663151aa65 | 684 | |
wim | 29:a3663151aa65 | 685 | /** Implementation of pure Virtual Low level writes to LCD Bus (serial expander) |
wim | 29:a3663151aa65 | 686 | * Set the RS pin ( 0 = Command, 1 = Data). |
wim | 29:a3663151aa65 | 687 | */ |
wim | 21:9eb628d9e164 | 688 | virtual void _setRS(bool value); |
wim | 29:a3663151aa65 | 689 | |
wim | 29:a3663151aa65 | 690 | /** Implementation of pure Virtual Low level writes to LCD Bus (serial expander) |
wim | 29:a3663151aa65 | 691 | * Set the BL pin (0 = Backlight Off, 1 = Backlight On). |
wim | 29:a3663151aa65 | 692 | */ |
wim | 21:9eb628d9e164 | 693 | virtual void _setBL(bool value); |
wim | 29:a3663151aa65 | 694 | |
wim | 29:a3663151aa65 | 695 | /** Implementation of pure Virtual Low level writes to LCD Bus (serial expander) |
wim | 29:a3663151aa65 | 696 | * Set the databus value (4 bit). |
wim | 29:a3663151aa65 | 697 | */ |
wim | 21:9eb628d9e164 | 698 | virtual void _setData(int value); |
wim | 29:a3663151aa65 | 699 | |
wim | 29:a3663151aa65 | 700 | /** Implementation of Low level writes to LCD Bus (serial expander) |
wim | 29:a3663151aa65 | 701 | * Set the CS pin (0 = select, 1 = deselect). |
wim | 29:a3663151aa65 | 702 | */ |
wim | 21:9eb628d9e164 | 703 | virtual void _setCS(bool value); |
wim | 21:9eb628d9e164 | 704 | |
wim | 29:a3663151aa65 | 705 | ///** Low level writes to LCD serial bus only (serial expander) |
wim | 29:a3663151aa65 | 706 | // */ |
wim | 29:a3663151aa65 | 707 | // void _writeBus(); |
wim | 21:9eb628d9e164 | 708 | |
wim | 21:9eb628d9e164 | 709 | // SPI bus |
wim | 21:9eb628d9e164 | 710 | SPI *_spi; |
wim | 21:9eb628d9e164 | 711 | DigitalOut _cs; |
wim | 21:9eb628d9e164 | 712 | |
wim | 21:9eb628d9e164 | 713 | // Internal bus mirror value for serial bus only |
wim | 21:9eb628d9e164 | 714 | char _lcd_bus; |
wim | 21:9eb628d9e164 | 715 | |
wim | 21:9eb628d9e164 | 716 | }; |
wim | 21:9eb628d9e164 | 717 | |
wim | 23:d47f226efb24 | 718 | //---------- End TextLCD_SPI ------------ |
wim | 21:9eb628d9e164 | 719 | |
Sissors | 24:fb3399713710 | 720 | |
Sissors | 24:fb3399713710 | 721 | |
wim | 26:bd897a001012 | 722 | //--------- Start TextLCD_SPI_N ----------- |
Sissors | 24:fb3399713710 | 723 | |
wim | 25:6162b31128c9 | 724 | /** Create a TextLCD interface using a controller with native SPI interface |
Sissors | 24:fb3399713710 | 725 | * |
Sissors | 24:fb3399713710 | 726 | */ |
wim | 25:6162b31128c9 | 727 | class TextLCD_SPI_N : public TextLCD_Base { |
Sissors | 24:fb3399713710 | 728 | public: |
wim | 25:6162b31128c9 | 729 | /** Create a TextLCD interface using a controller with native SPI interface |
Sissors | 24:fb3399713710 | 730 | * |
Sissors | 24:fb3399713710 | 731 | * @param spi SPI Bus |
Sissors | 24:fb3399713710 | 732 | * @param cs chip select pin (active low) |
Sissors | 24:fb3399713710 | 733 | * @param rs Instruction/data control line |
Sissors | 24:fb3399713710 | 734 | * @param type Sets the panel size/addressing mode (default = LCD16x2) |
Sissors | 24:fb3399713710 | 735 | * @param bl Backlight control line (optional, default = NC) |
wim | 26:bd897a001012 | 736 | * @param ctrl LCD controller (default = ST7032_3V3) |
Sissors | 24:fb3399713710 | 737 | */ |
wim | 26:bd897a001012 | 738 | TextLCD_SPI_N(SPI *spi, PinName cs, PinName rs, LCDType type = LCD16x2, PinName bl = NC, LCDCtrl ctrl = ST7032_3V3); |
wim | 25:6162b31128c9 | 739 | virtual ~TextLCD_SPI_N(void); |
Sissors | 24:fb3399713710 | 740 | |
Sissors | 24:fb3399713710 | 741 | private: |
wim | 29:a3663151aa65 | 742 | |
wim | 29:a3663151aa65 | 743 | /** Implementation of pure Virtual Low level writes to LCD Bus (serial native) |
wim | 29:a3663151aa65 | 744 | * Set the Enable pin. |
wim | 29:a3663151aa65 | 745 | */ |
Sissors | 24:fb3399713710 | 746 | virtual void _setEnable(bool value); |
wim | 29:a3663151aa65 | 747 | |
wim | 29:a3663151aa65 | 748 | /** Implementation of pure Virtual Low level writes to LCD Bus (serial native) |
wim | 29:a3663151aa65 | 749 | * Set the RS pin ( 0 = Command, 1 = Data). |
wim | 29:a3663151aa65 | 750 | */ |
Sissors | 24:fb3399713710 | 751 | virtual void _setRS(bool value); |
wim | 29:a3663151aa65 | 752 | |
wim | 29:a3663151aa65 | 753 | /** Implementation of pure Virtual Low level writes to LCD Bus (serial native) |
wim | 29:a3663151aa65 | 754 | * Set the BL pin (0 = Backlight Off, 1 = Backlight On). |
wim | 29:a3663151aa65 | 755 | */ |
Sissors | 24:fb3399713710 | 756 | virtual void _setBL(bool value); |
wim | 29:a3663151aa65 | 757 | |
wim | 29:a3663151aa65 | 758 | /** Implementation of pure Virtual Low level writes to LCD Bus (serial native) |
wim | 29:a3663151aa65 | 759 | * Set the databus value (4 bit). |
wim | 29:a3663151aa65 | 760 | */ |
Sissors | 24:fb3399713710 | 761 | virtual void _setData(int value); |
wim | 29:a3663151aa65 | 762 | |
wim | 29:a3663151aa65 | 763 | /** Low level writes to LCD serial bus only (serial native) |
wim | 29:a3663151aa65 | 764 | */ |
Sissors | 24:fb3399713710 | 765 | virtual void _writeByte(int value); |
wim | 29:a3663151aa65 | 766 | |
Sissors | 24:fb3399713710 | 767 | |
Sissors | 24:fb3399713710 | 768 | // SPI bus |
Sissors | 24:fb3399713710 | 769 | SPI *_spi; |
Sissors | 24:fb3399713710 | 770 | DigitalOut _cs; |
Sissors | 24:fb3399713710 | 771 | DigitalOut _rs; |
Sissors | 24:fb3399713710 | 772 | DigitalOut *_bl; |
Sissors | 24:fb3399713710 | 773 | |
Sissors | 24:fb3399713710 | 774 | }; |
Sissors | 24:fb3399713710 | 775 | |
wim | 25:6162b31128c9 | 776 | //---------- End TextLCD_SPI_N ------------ |
Sissors | 24:fb3399713710 | 777 | |
wim | 26:bd897a001012 | 778 | |
wim | 26:bd897a001012 | 779 | //--------- Start TextLCD_I2C_N ----------- |
wim | 26:bd897a001012 | 780 | |
wim | 26:bd897a001012 | 781 | /** Create a TextLCD interface using a controller with native I2C interface |
wim | 26:bd897a001012 | 782 | * |
wim | 26:bd897a001012 | 783 | */ |
wim | 26:bd897a001012 | 784 | class TextLCD_I2C_N : public TextLCD_Base { |
wim | 26:bd897a001012 | 785 | public: |
wim | 26:bd897a001012 | 786 | /** Create a TextLCD interface using a controller with native I2C interface |
wim | 26:bd897a001012 | 787 | * |
wim | 26:bd897a001012 | 788 | * @param i2c I2C Bus |
wim | 28:30fa94f7341c | 789 | * @param deviceAddress I2C slave address (default = ST7032_SA = 0x7C) |
wim | 26:bd897a001012 | 790 | * @param type Sets the panel size/addressing mode (default = LCD16x2) |
wim | 28:30fa94f7341c | 791 | * @param bl Backlight control line (optional, default = NC) |
wim | 26:bd897a001012 | 792 | * @param ctrl LCD controller (default = ST7032_3V3) |
wim | 26:bd897a001012 | 793 | */ |
wim | 28:30fa94f7341c | 794 | TextLCD_I2C_N(I2C *i2c, char deviceAddress = ST7032_SA, LCDType type = LCD16x2, PinName bl = NC, LCDCtrl ctrl = ST7032_3V3); |
wim | 26:bd897a001012 | 795 | virtual ~TextLCD_I2C_N(void); |
wim | 26:bd897a001012 | 796 | |
wim | 26:bd897a001012 | 797 | private: |
wim | 29:a3663151aa65 | 798 | |
wim | 29:a3663151aa65 | 799 | /** Implementation of pure Virtual Low level writes to LCD Bus (serial native) |
wim | 29:a3663151aa65 | 800 | * Set the Enable pin. |
wim | 29:a3663151aa65 | 801 | */ |
wim | 26:bd897a001012 | 802 | virtual void _setEnable(bool value); |
wim | 29:a3663151aa65 | 803 | |
wim | 29:a3663151aa65 | 804 | /** Implementation of pure Virtual Low level writes to LCD Bus (serial native) |
wim | 29:a3663151aa65 | 805 | * Set the RS pin ( 0 = Command, 1 = Data). |
wim | 29:a3663151aa65 | 806 | */ |
wim | 26:bd897a001012 | 807 | virtual void _setRS(bool value); |
wim | 29:a3663151aa65 | 808 | |
wim | 29:a3663151aa65 | 809 | /** Implementation of pure Virtual Low level writes to LCD Bus (serial native) |
wim | 29:a3663151aa65 | 810 | * Set the BL pin (0 = Backlight Off, 1 = Backlight On). |
wim | 29:a3663151aa65 | 811 | */ |
wim | 26:bd897a001012 | 812 | virtual void _setBL(bool value); |
wim | 29:a3663151aa65 | 813 | |
wim | 29:a3663151aa65 | 814 | /** Implementation of pure Virtual Low level writes to LCD Bus (serial native) |
wim | 29:a3663151aa65 | 815 | * Set the databus value (4 bit). |
wim | 29:a3663151aa65 | 816 | */ |
wim | 26:bd897a001012 | 817 | virtual void _setData(int value); |
wim | 29:a3663151aa65 | 818 | |
wim | 29:a3663151aa65 | 819 | /** Low level writes to LCD serial bus only (serial native) |
wim | 29:a3663151aa65 | 820 | */ |
wim | 26:bd897a001012 | 821 | virtual void _writeByte(int value); |
wim | 26:bd897a001012 | 822 | |
wim | 29:a3663151aa65 | 823 | |
wim | 26:bd897a001012 | 824 | //I2C bus |
wim | 26:bd897a001012 | 825 | I2C *_i2c; |
wim | 26:bd897a001012 | 826 | char _slaveAddress; |
wim | 26:bd897a001012 | 827 | |
wim | 28:30fa94f7341c | 828 | // controlbyte to select between data and command. Internal value for serial bus only |
wim | 28:30fa94f7341c | 829 | char _controlbyte; |
wim | 28:30fa94f7341c | 830 | |
wim | 28:30fa94f7341c | 831 | DigitalOut *_bl; |
wim | 26:bd897a001012 | 832 | }; |
wim | 26:bd897a001012 | 833 | |
wim | 26:bd897a001012 | 834 | //---------- End TextLCD_I2C_N ------------ |
wim | 26:bd897a001012 | 835 | |
wim | 26:bd897a001012 | 836 | |
simon | 1:ac48b187213c | 837 | #endif |