Wim Huiskamp / TextLCD

Committer:
wim
Date:
Sun Mar 29 13:08:03 2015 +0000
Revision:
37:ce348c002929
Parent:
36:9f5f86dfd44a
Child:
38:cbe275b0b647
Cleaned up low level command and data write operations to improve speed of I2C expander versions (PCF8574 and MCP23008). Added initial support for controllers with alternative fonttables.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wim 37:ce348c002929 1 /* mbed TextLCD Library, for LCDs based on HD44780 controllers
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 34:e5a0dcb43ecc 15 * 2014, v13: WH, Added support for controllers US2066/SSD1311 (OLED), added setUDCBlink() method for supported devices (eg SSD1803), fixed issue in setPower()
wim 34:e5a0dcb43ecc 16 * 2014, v14: WH, Added support for PT6314 (VFD), added setOrient() method for supported devices (eg SSD1803, US2066), added Double Height lines for supported devices,
wim 34:e5a0dcb43ecc 17 * added 16 UDCs for supported devices (eg PCF2103), moved UDC defines to TextLCD_UDC file, added TextLCD_Config.h for feature and footprint settings.
wim 35:311be6444a39 18 * 2014, v15: WH, Added AC780 support, added I2C expander modules, fixed setBacklight() for inverted logic modules. Fixed bug in LCD_SPI_N define
wim 36:9f5f86dfd44a 19 * 2014, v16: WH, Added ST7070 and KS0073 support, added setIcon(), clrIcon() and setInvert() method for supported devices
wim 37:ce348c002929 20 * 2015, v17: WH, Clean up low-level _writeCommand() and _writeData(), Added support for alternative fonttables (eg PCF21XX), Added ST7066_ACM controller for ACM1602 module
simon 1:ac48b187213c 21 *
simon 1:ac48b187213c 22 * Permission is hereby granted, free of charge, to any person obtaining a copy
simon 1:ac48b187213c 23 * of this software and associated documentation files (the "Software"), to deal
simon 1:ac48b187213c 24 * in the Software without restriction, including without limitation the rights
simon 1:ac48b187213c 25 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
simon 1:ac48b187213c 26 * copies of the Software, and to permit persons to whom the Software is
simon 1:ac48b187213c 27 * furnished to do so, subject to the following conditions:
simon 2:227356c7d12c 28 *
simon 1:ac48b187213c 29 * The above copyright notice and this permission notice shall be included in
simon 1:ac48b187213c 30 * all copies or substantial portions of the Software.
simon 2:227356c7d12c 31 *
simon 1:ac48b187213c 32 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
simon 1:ac48b187213c 33 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
simon 1:ac48b187213c 34 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
simon 1:ac48b187213c 35 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
simon 1:ac48b187213c 36 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
simon 1:ac48b187213c 37 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
simon 1:ac48b187213c 38 * THE SOFTWARE.
simon 1:ac48b187213c 39 */
simon 1:ac48b187213c 40
simon 1:ac48b187213c 41 #ifndef MBED_TEXTLCD_H
simon 1:ac48b187213c 42 #define MBED_TEXTLCD_H
simon 1:ac48b187213c 43
simon 1:ac48b187213c 44 #include "mbed.h"
wim 34:e5a0dcb43ecc 45 #include "TextLCD_Config.h"
wim 34:e5a0dcb43ecc 46 #include "TextLCD_UDC.h"
simon 2:227356c7d12c 47
simon 5:a53b3e2d6f1e 48 /** A TextLCD interface for driving 4-bit HD44780-based LCDs
simon 2:227356c7d12c 49 *
wim 34:e5a0dcb43ecc 50 * Currently supports 8x1, 8x2, 12x3, 12x4, 16x1, 16x2, 16x3, 16x4, 20x2, 20x4, 24x1, 24x2, 24x4, 40x2 and 40x4 panels.
wim 27:22d5086f6ba6 51 * Interface options include direct mbed pins, I2C portexpander (PCF8474/PCF8574A or MCP23008) or SPI bus shiftregister (74595).
wim 34:e5a0dcb43ecc 52 * Supports some controllers with native I2C or SPI interface. Supports some controllers that provide internal DC/DC converters for VLCD or VLED.
wim 34:e5a0dcb43ecc 53 * Supports some controllers that feature programmable contrast control, powerdown, blinking UDCs and/or top/down orientation modes.
simon 2:227356c7d12c 54 *
simon 2:227356c7d12c 55 * @code
simon 2:227356c7d12c 56 * #include "mbed.h"
simon 2:227356c7d12c 57 * #include "TextLCD.h"
simon 5:a53b3e2d6f1e 58 *
wim 16:c276b75e6585 59 * // I2C Communication
wim 16:c276b75e6585 60 * I2C i2c_lcd(p28,p27); // SDA, SCL
wim 16:c276b75e6585 61 *
wim 16:c276b75e6585 62 * // SPI Communication
wim 16:c276b75e6585 63 * SPI spi_lcd(p5, NC, p7); // MOSI, MISO, SCLK
wim 16:c276b75e6585 64 *
wim 22:35742ec80c24 65 * //TextLCD lcd(p15, p16, p17, p18, p19, p20); // RS, E, D4-D7, LCDType=LCD16x2, BL=NC, E2=NC, LCDTCtrl=HD44780
wim 28:30fa94f7341c 66 * //TextLCD_SPI lcd(&spi_lcd, p8, TextLCD::LCD40x4); // SPI bus, 74595 expander, CS pin, LCD Type
wim 34:e5a0dcb43ecc 67 * TextLCD_I2C lcd(&i2c_lcd, 0x42, TextLCD::LCD20x4); // I2C bus, PCF8574 Slaveaddress, LCD Type
wim 34:e5a0dcb43ecc 68 * //TextLCD_I2C lcd(&i2c_lcd, 0x42, TextLCD::LCD16x2, TextLCD::WS0010); // I2C bus, PCF8574 Slaveaddress, LCD Type, Device Type (OLED)
wim 27:22d5086f6ba6 69 * //TextLCD_SPI_N lcd(&spi_lcd, p8, p9); // SPI bus, CS pin, RS pin, LCDType=LCD16x2, BL=NC, LCDTCtrl=ST7032_3V3
wim 34:e5a0dcb43ecc 70 * //TextLCD_I2C_N lcd(&i2c_lcd, ST7032_SA, TextLCD::LCD16x2, NC, TextLCD::ST7032_3V3); // I2C bus, Slaveaddress, LCD Type, BL=NC, LCDTCtrl=ST7032_3V3
wim 34:e5a0dcb43ecc 71 * //TextLCD_SPI_N_3_24 lcd(&spi_lcd, p8, TextLCD::LCD20x4D, NC, TextLCD::SSD1803_3V3); // SPI bus, CS pin, LCDType=LCD20x4D, BL=NC, LCDTCtrl=SSD1803
wim 34:e5a0dcb43ecc 72 * //TextLCD_SPI_N_3_24 lcd(&spi_lcd, p8, TextLCD::LCD20x2, NC, TextLCD::US2066_3V3); // SPI bus, CS pin, LCDType=LCD20x2, BL=NC, LCDTCtrl=US2066 (OLED)
wim 34:e5a0dcb43ecc 73 *
simon 2:227356c7d12c 74 * int main() {
wim 16:c276b75e6585 75 * lcd.printf("Hello World!\n");
simon 2:227356c7d12c 76 * }
simon 2:227356c7d12c 77 * @endcode
simon 2:227356c7d12c 78 */
wim 8:03116f75b66e 79
wim 34:e5a0dcb43ecc 80 //The TextLCD_Config.h file selects hardware interface options to reduce memory footprint
wim 34:e5a0dcb43ecc 81 //and provides Pin Defines for I2C PCF8574/PCF8574A or MCP23008 and SPI 74595 bus expander interfaces.
wim 34:e5a0dcb43ecc 82 //The LCD and serial portexpanders should be wired accordingly.
wim 32:59c4b8f648d4 83
wim 30:033048611c01 84 /* LCD Type information on Rows, Columns and Variant. This information is encoded in
wim 30:033048611c01 85 * an int and used for the LCDType enumerators in order to simplify code maintenance */
wim 30:033048611c01 86 // Columns encoded in b7..b0
wim 30:033048611c01 87 #define LCD_T_COL_MSK 0x000000FF
wim 32:59c4b8f648d4 88 #define LCD_T_C6 0x00000006
wim 30:033048611c01 89 #define LCD_T_C8 0x00000008
wim 30:033048611c01 90 #define LCD_T_C10 0x0000000A
wim 30:033048611c01 91 #define LCD_T_C12 0x0000000C
wim 30:033048611c01 92 #define LCD_T_C16 0x00000010
wim 30:033048611c01 93 #define LCD_T_C20 0x00000014
wim 30:033048611c01 94 #define LCD_T_C24 0x00000018
wim 30:033048611c01 95 #define LCD_T_C32 0x00000020
wim 30:033048611c01 96 #define LCD_T_C40 0x00000028
wim 30:033048611c01 97
wim 30:033048611c01 98 // Rows encoded in b15..b8
wim 30:033048611c01 99 #define LCD_T_ROW_MSK 0x0000FF00
wim 30:033048611c01 100 #define LCD_T_R1 0x00000100
wim 30:033048611c01 101 #define LCD_T_R2 0x00000200
wim 30:033048611c01 102 #define LCD_T_R3 0x00000300
wim 30:033048611c01 103 #define LCD_T_R4 0x00000400
wim 30:033048611c01 104
wim 30:033048611c01 105 // Addressing mode encoded in b19..b16
wim 30:033048611c01 106 #define LCD_T_ADR_MSK 0x000F0000
wim 32:59c4b8f648d4 107 #define LCD_T_A 0x00000000 /*Mode A Default 1, 2 or 4 line display */
wim 32:59c4b8f648d4 108 #define LCD_T_B 0x00010000 /*Mode B, Alternate 8x2 (actually 16x1 display) */
wim 32:59c4b8f648d4 109 #define LCD_T_C 0x00020000 /*Mode C, Alternate 16x1 (actually 8x2 display) */
wim 32:59c4b8f648d4 110 #define LCD_T_D 0x00030000 /*Mode D, Alternate 3 or 4 line display (12x4, 20x4, 24x4) */
wim 32:59c4b8f648d4 111 #define LCD_T_D1 0x00040000 /*Mode D1, Alternate 3 out of 4 line display (12x3, 20x3, 24x3) */
wim 32:59c4b8f648d4 112 #define LCD_T_E 0x00050000 /*Mode E, 40x4 display (actually two 40x2) */
wim 32:59c4b8f648d4 113 #define LCD_T_F 0x00060000 /*Mode F, 16x3 display (actually 24x2) */
wim 32:59c4b8f648d4 114 #define LCD_T_G 0x00070000 /*Mode G, 16x3 display */
wim 30:033048611c01 115
wim 30:033048611c01 116 /* LCD Ctrl information on interface support and features. This information is encoded in
wim 30:033048611c01 117 * an int and used for the LCDCtrl enumerators in order to simplify code maintenance */
wim 30:033048611c01 118 // Interface encoded in b31..b24
wim 30:033048611c01 119 #define LCD_C_BUS_MSK 0xFF000000
wim 32:59c4b8f648d4 120 #define LCD_C_PAR 0x01000000 /*Parallel 4 or 8 bit data, E pin, RS pin, RW=GND */
wim 36:9f5f86dfd44a 121 #define LCD_C_SPI3_8 0x02000000 /*SPI 3 line (MOSI, SCL, CS pins), 8 bits (Count Command initiates Data transfer) */
wim 36:9f5f86dfd44a 122 #define LCD_C_SPI3_9 0x04000000 /*SPI 3 line (MOSI, SCL, CS pins), 9 bits (RS + 8 Data) */
wim 36:9f5f86dfd44a 123 #define LCD_C_SPI3_10 0x08000000 /*SPI 3 line (MOSI, SCL, CS pins), 10 bits (RS, RW + 8 Data) */
wim 36:9f5f86dfd44a 124 #define LCD_C_SPI3_16 0x10000000 /*SPI 3 line (MOSI, SCL, CS pins), 16 bits (RS, RW + 8 Data) */
wim 36:9f5f86dfd44a 125 #define LCD_C_SPI3_24 0x20000000 /*SPI 3 line (MOSI, SCL, CS pins), 24 bits (RS, RW + 8 Data) */
wim 36:9f5f86dfd44a 126 #define LCD_C_SPI4 0x40000000 /*SPI 4 line (MOSI, SCL, CS, RS pin), RS pin + 8 Data */
wim 36:9f5f86dfd44a 127 #define LCD_C_I2C 0x80000000 /*I2C (SDA, SCL pin), 8 control bits (Co, RS, RW) + 8 Data */
wim 30:033048611c01 128 // Features encoded in b23..b16
wim 30:033048611c01 129 #define LCD_C_FTR_MSK 0x00FF0000
wim 30:033048611c01 130 #define LCD_C_BST 0x00010000 /*Booster */
wim 32:59c4b8f648d4 131 #define LCD_C_CTR 0x00020000 /*Contrast Control */
wim 32:59c4b8f648d4 132 #define LCD_C_ICN 0x00040000 /*Icons */
wim 32:59c4b8f648d4 133 #define LCD_C_PDN 0x00080000 /*Power Down */
wim 37:ce348c002929 134 // Fonttable encoded in b15..b12
wim 37:ce348c002929 135 #define LCD_C_FNT_MSK 0x0000F000
wim 37:ce348c002929 136 #define LCD_C_FT0 0x00000000 /*Default */
wim 37:ce348c002929 137 #define LCD_C_FT1 0x00001000 /*Font1 */
wim 37:ce348c002929 138 #define LCD_C_FT2 0x00002000 /*Font2 */
wim 32:59c4b8f648d4 139
wim 11:9ec02df863a1 140 /** A TextLCD interface for driving 4-bit HD44780-based LCDs
wim 11:9ec02df863a1 141 *
wim 33:900a94bc7585 142 * @brief Currently supports 8x1, 8x2, 12x2, 12x3, 12x4, 16x1, 16x2, 16x3, 16x4, 20x2, 20x4, 24x2, 24x4, 40x2 and 40x4 panels
wim 37:ce348c002929 143 * Interface options include direct mbed pins, I2C portexpander (PCF8474/PCF8574A or MCP23008) or
wim 37:ce348c002929 144 * SPI bus shiftregister (74595) or native I2C or SPI interfaces for some supported devices.
wim 11:9ec02df863a1 145 */
wim 21:9eb628d9e164 146 class TextLCD_Base : public Stream {
wim 37:ce348c002929 147 //class TextLCD_Base {
wim 35:311be6444a39 148
wim 37:ce348c002929 149 //Unfortunately the following #define selection breaks Doxygen !!!
wim 37:ce348c002929 150 //Add it manually when you want to disable the Stream inheritance
wim 35:311be6444a39 151 //#if (LCD_PRINTF == 1)
wim 35:311be6444a39 152 //class TextLCD_Base : public Stream {
wim 35:311be6444a39 153 //#else
wim 37:ce348c002929 154 //class TextLCD_Base {
wim 35:311be6444a39 155 //#endif
wim 35:311be6444a39 156
simon 1:ac48b187213c 157 public:
simon 1:ac48b187213c 158
simon 2:227356c7d12c 159 /** LCD panel format */
wim 33:900a94bc7585 160 // The commented out types exist but have not yet been tested with the library
simon 1:ac48b187213c 161 enum LCDType {
wim 32:59c4b8f648d4 162 // LCD6x1 = (LCD_T_A | LCD_T_C6 | LCD_T_R1), /**< 6x1 LCD panel */
wim 32:59c4b8f648d4 163 // LCD6x2 = (LCD_T_A | LCD_T_C6 | LCD_T_R2), /**< 6x2 LCD panel */
wim 30:033048611c01 164 LCD8x1 = (LCD_T_A | LCD_T_C8 | LCD_T_R1), /**< 8x1 LCD panel */
wim 30:033048611c01 165 LCD8x2 = (LCD_T_A | LCD_T_C8 | LCD_T_R2), /**< 8x2 LCD panel */
wim 30:033048611c01 166 LCD8x2B = (LCD_T_D | LCD_T_C8 | LCD_T_R2), /**< 8x2 LCD panel (actually 16x1) */
wim 34:e5a0dcb43ecc 167 LCD12x1 = (LCD_T_A | LCD_T_C12 | LCD_T_R1), /**< 12x1 LCD panel */
wim 30:033048611c01 168 LCD12x2 = (LCD_T_A | LCD_T_C12 | LCD_T_R2), /**< 12x2 LCD panel */
wim 36:9f5f86dfd44a 169 LCD12x3D = (LCD_T_D | LCD_T_C12 | LCD_T_R3), /**< 12x3 LCD panel, special mode PCF21XX, KS0073 */
wim 36:9f5f86dfd44a 170 LCD12x3D1 = (LCD_T_D1 | LCD_T_C12 | LCD_T_R3), /**< 12x3 LCD panel, special mode PCF21XX, KS0073 */
wim 32:59c4b8f648d4 171 // LCD12x3G = (LCD_T_G | LCD_T_C12 | LCD_T_R3), /**< 12x3 LCD panel, special mode ST7036 */
wim 30:033048611c01 172 LCD12x4 = (LCD_T_A | LCD_T_C12 | LCD_T_R4), /**< 12x4 LCD panel */
wim 36:9f5f86dfd44a 173 LCD12x4D = (LCD_T_B | LCD_T_C12 | LCD_T_R4), /**< 12x4 LCD panel, special mode PCF21XX, KS0073 */
wim 30:033048611c01 174 LCD16x1 = (LCD_T_A | LCD_T_C16 | LCD_T_R1), /**< 16x1 LCD panel */
wim 30:033048611c01 175 LCD16x1C = (LCD_T_C | LCD_T_C16 | LCD_T_R1), /**< 16x1 LCD panel (actually 8x2) */
wim 30:033048611c01 176 LCD16x2 = (LCD_T_A | LCD_T_C16 | LCD_T_R2), /**< 16x2 LCD panel (default) */
wim 30:033048611c01 177 // LCD16x2B = (LCD_T_B | LCD_T_C16 | LCD_T_R2), /**< 16x2 LCD panel, alternate addressing, wrong.. */
wim 32:59c4b8f648d4 178 LCD16x3D = (LCD_T_D | LCD_T_C16 | LCD_T_R3), /**< 16x3 LCD panel, special mode SSD1803 */
wim 32:59c4b8f648d4 179 // LCD16x3D1 = (LCD_T_D1 | LCD_T_C16 | LCD_T_R3), /**< 16x3 LCD panel, special mode SSD1803 */
wim 32:59c4b8f648d4 180 LCD16x3F = (LCD_T_F | LCD_T_C16 | LCD_T_R3), /**< 16x3 LCD panel (actually 24x2) */
wim 32:59c4b8f648d4 181 LCD16x3G = (LCD_T_G | LCD_T_C16 | LCD_T_R3), /**< 16x3 LCD panel, special mode ST7036 */
wim 30:033048611c01 182 LCD16x4 = (LCD_T_A | LCD_T_C16 | LCD_T_R4), /**< 16x4 LCD panel */
wim 32:59c4b8f648d4 183 // LCD16x4D = (LCD_T_D | LCD_T_C16 | LCD_T_R4), /**< 16x4 LCD panel, special mode SSD1803 */
wim 34:e5a0dcb43ecc 184 LCD20x1 = (LCD_T_A | LCD_T_C20 | LCD_T_R1), /**< 20x1 LCD panel */
wim 30:033048611c01 185 LCD20x2 = (LCD_T_A | LCD_T_C20 | LCD_T_R2), /**< 20x2 LCD panel */
wim 32:59c4b8f648d4 186 // LCD20x3 = (LCD_T_A | LCD_T_C20 | LCD_T_R3), /**< 20x3 LCD panel */
wim 32:59c4b8f648d4 187 // LCD20x3D = (LCD_T_D | LCD_T_C20 | LCD_T_R3), /**< 20x3 LCD panel, special mode SSD1803 */
wim 32:59c4b8f648d4 188 // LCD20x3D1 = (LCD_T_D1 | LCD_T_C20 | LCD_T_R3), /**< 20x3 LCD panel, special mode SSD1803 */
wim 30:033048611c01 189 LCD20x4 = (LCD_T_A | LCD_T_C20 | LCD_T_R4), /**< 20x4 LCD panel */
wim 32:59c4b8f648d4 190 LCD20x4D = (LCD_T_D | LCD_T_C20 | LCD_T_R4), /**< 20x4 LCD panel, special mode SSD1803 */
wim 30:033048611c01 191 LCD24x1 = (LCD_T_A | LCD_T_C24 | LCD_T_R1), /**< 24x1 LCD panel */
wim 30:033048611c01 192 LCD24x2 = (LCD_T_A | LCD_T_C24 | LCD_T_R2), /**< 24x2 LCD panel */
wim 32:59c4b8f648d4 193 // LCD24x3D = (LCD_T_D | LCD_T_C24 | LCD_T_R3), /**< 24x3 LCD panel */
wim 32:59c4b8f648d4 194 // LCD24x3D1 = (LCD_T_D | LCD_T_C24 | LCD_T_R3), /**< 24x3 LCD panel */
wim 30:033048611c01 195 LCD24x4D = (LCD_T_D | LCD_T_C24 | LCD_T_R4), /**< 24x4 LCD panel, special mode KS0078 */
wim 33:900a94bc7585 196 // LCD32x1 = (LCD_T_A | LCD_T_C32 | LCD_T_R1), /**< 32x1 LCD panel */
wim 33:900a94bc7585 197 // LCD32x1C = (LCD_T_C | LCD_T_C32 | LCD_T_R1), /**< 32x1 LCD panel (actually 16x2) */
wim 32:59c4b8f648d4 198 // LCD32x2 = (LCD_T_A | LCD_T_C32 | LCD_T_R2), /**< 32x2 LCD panel */
wim 32:59c4b8f648d4 199 // LCD32x4 = (LCD_T_A | LCD_T_C32 | LCD_T_R4), /**< 32x4 LCD panel */
wim 30:033048611c01 200 // LCD40x1 = (LCD_T_A | LCD_T_C40 | LCD_T_R1), /**< 40x1 LCD panel */
wim 33:900a94bc7585 201 // LCD40x1C = (LCD_T_C | LCD_T_C40 | LCD_T_R1), /**< 40x1 LCD panel (actually 20x2) */
wim 30:033048611c01 202 LCD40x2 = (LCD_T_A | LCD_T_C40 | LCD_T_R2), /**< 40x2 LCD panel */
wim 30:033048611c01 203 LCD40x4 = (LCD_T_E | LCD_T_C40 | LCD_T_R4) /**< 40x4 LCD panel, Two controller version */
wim 30:033048611c01 204 };
wim 30:033048611c01 205
wim 30:033048611c01 206
wim 30:033048611c01 207 /** LCD Controller Device */
wim 30:033048611c01 208 enum LCDCtrl {
wim 37:ce348c002929 209 HD44780 = 0 | LCD_C_PAR, /**< HD44780 or full equivalent (default) */
wim 37:ce348c002929 210 AC780 = 1 | (LCD_C_PAR | LCD_C_SPI4 | LCD_C_I2C | LCD_C_PDN), /**< AC780/KS0066i 4/8 bit, SPI, I2C */
wim 37:ce348c002929 211 AIP31068 = 2 | (LCD_C_SPI3_9 | LCD_C_I2C | LCD_C_BST), /**< AIP31068 I2C, SPI3 */
wim 37:ce348c002929 212 KS0073 = 3 | (LCD_C_PAR | LCD_C_SPI3_24 | LCD_C_PDN), /**< KS0073 4/8 bit, SPI3 */
wim 37:ce348c002929 213 KS0078 = 4 | (LCD_C_PAR | LCD_C_SPI3_24 | LCD_C_PDN), /**< KS0078 24x4 support, 4/8 bit, SPI3 */
wim 37:ce348c002929 214 PCF2103_3V3 = 5 | (LCD_C_PAR | LCD_C_I2C), /**< PCF2103 3V3 no Booster, 4/8 bit, I2C */
wim 37:ce348c002929 215 PCF2113_3V3 = 6 | (LCD_C_PAR | LCD_C_I2C | LCD_C_BST | LCD_C_CTR), /**< PCF2113 3V3 with Booster, 4/8 bit, I2C */
wim 37:ce348c002929 216 PCF2116_3V3 = 7 | (LCD_C_PAR | LCD_C_I2C | LCD_C_BST), /**< PCF2116 3V3 with Booster, 4/8 bit, I2C */
wim 37:ce348c002929 217 PCF2116_5V = 8 | (LCD_C_PAR | LCD_C_I2C), /**< PCF2116 5V no Booster, 4/8 bit, I2C */
wim 37:ce348c002929 218 PCF2116C_5V = 9 | (LCD_C_PAR | LCD_C_I2C | LCD_C_BST) | LCD_C_FT1, /**< PCF2116C 3V3 with Booster, 4/8 bit, I2C */
wim 37:ce348c002929 219 PCF2119_3V3 = 10 | (LCD_C_PAR | LCD_C_I2C | LCD_C_BST | LCD_C_CTR), /**< PCF2119 3V3 with Booster, 4/8 bit, I2C */
wim 37:ce348c002929 220 // PCF2119C_3V3 = 11 | (LCD_C_PAR | LCD_C_I2C | LCD_C_BST | LCD_C_CTR), LCD_C_FT1, /**< PCF2119K 3V3 with Booster, 4/8 bit, I2C */
wim 37:ce348c002929 221 // PCF2119_5V = 12 | (LCD_C_PAR | LCD_C_I2C), /**< PCF2119 5V no Booster, 4/8 bit, I2C */
wim 37:ce348c002929 222 PT6314 = 13 | (LCD_C_PAR | LCD_C_SPI3_16 | LCD_C_CTR), /**< PT6314 VFD, 4/8 bit, SPI3 */
wim 37:ce348c002929 223 SSD1803_3V3 = 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 37:ce348c002929 224 // SSD1803_5V = 15 | (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 37:ce348c002929 225 ST7032_3V3 = 16 | (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 37:ce348c002929 226 ST7032_5V = 17 | (LCD_C_PAR | LCD_C_SPI4 | LCD_C_I2C | LCD_C_CTR), /**< ST7032 5V no Booster, 4/8 bit, SPI4, I2C */
wim 37:ce348c002929 227 ST7036_3V3 = 18 | (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 37:ce348c002929 228 ST7036_5V = 19 | (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 37:ce348c002929 229 ST7066_ACM = 20 | (LCD_C_PAR | LCD_C_I2C), /**< ST7066 4/8 bit, I2C on ACM1602 using a PIC */
wim 37:ce348c002929 230 ST7070 = 21 | (LCD_C_PAR | LCD_C_SPI3_8 | LCD_C_SPI4), /**< ST7070 4/8 bit, SPI3 */
wim 37:ce348c002929 231 US2066_3V3 = 22 | (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 37:ce348c002929 232 WS0010 = 23 | (LCD_C_PAR | LCD_C_SPI3_10 | LCD_C_PDN) /**< WS0010/RS0010 OLED Controller, 4/8 bit, SPI3 */
wim 37:ce348c002929 233 // WS0012 = 24 | (LCD_C_PAR | LCD_C_SPI3_10 | LCD_C_I2C | LCD_C_PDN), /**< WS0012 4/8 bit, SPI, I2C */
wim 37:ce348c002929 234
wim 30:033048611c01 235 };
wim 30:033048611c01 236
wim 30:033048611c01 237
wim 10:dd9b3a696acd 238 /** LCD Cursor control */
wim 10:dd9b3a696acd 239 enum LCDCursor {
wim 17:652ab113bc2e 240 CurOff_BlkOff = 0x00, /**< Cursor Off, Blinking Char Off */
wim 17:652ab113bc2e 241 CurOn_BlkOff = 0x02, /**< Cursor On, Blinking Char Off */
wim 17:652ab113bc2e 242 CurOff_BlkOn = 0x01, /**< Cursor Off, Blinking Char On */
wim 17:652ab113bc2e 243 CurOn_BlkOn = 0x03 /**< Cursor On, Blinking Char On */
wim 17:652ab113bc2e 244 };
wim 17:652ab113bc2e 245
wim 17:652ab113bc2e 246 /** LCD Display control */
wim 17:652ab113bc2e 247 enum LCDMode {
wim 17:652ab113bc2e 248 DispOff = 0x00, /**< Display Off */
wim 17:652ab113bc2e 249 DispOn = 0x04 /**< Display On */
wim 10:dd9b3a696acd 250 };
wim 10:dd9b3a696acd 251
wim 20:e0da005a777f 252 /** LCD Backlight control */
wim 20:e0da005a777f 253 enum LCDBacklight {
wim 20:e0da005a777f 254 LightOff, /**< Backlight Off */
wim 20:e0da005a777f 255 LightOn /**< Backlight On */
wim 20:e0da005a777f 256 };
wim 10:dd9b3a696acd 257
wim 33:900a94bc7585 258 /** LCD Blink control (UDC), supported for some Controllers */
wim 33:900a94bc7585 259 enum LCDBlink {
wim 33:900a94bc7585 260 BlinkOff, /**< Blink Off */
wim 33:900a94bc7585 261 BlinkOn /**< Blink On */
wim 33:900a94bc7585 262 };
wim 33:900a94bc7585 263
wim 33:900a94bc7585 264 /** LCD Orientation control, supported for some Controllers */
wim 33:900a94bc7585 265 enum LCDOrient {
wim 33:900a94bc7585 266 Top, /**< Top view */
wim 33:900a94bc7585 267 Bottom /**< Upside down view */
wim 33:900a94bc7585 268 };
wim 33:900a94bc7585 269
wim 34:e5a0dcb43ecc 270 /** LCD BigFont control, supported for some Controllers */
wim 34:e5a0dcb43ecc 271 enum LCDBigFont {
wim 34:e5a0dcb43ecc 272 None, /**< no lines */
wim 34:e5a0dcb43ecc 273 TopLine, /**< 1+2 line */
wim 34:e5a0dcb43ecc 274 CenterLine, /**< 2+3 line */
wim 34:e5a0dcb43ecc 275 BottomLine, /**< 2+3 line or 3+4 line */
wim 34:e5a0dcb43ecc 276 TopBottomLine /**< 1+2 line and 3+4 line */
wim 34:e5a0dcb43ecc 277 };
wim 33:900a94bc7585 278
wim 34:e5a0dcb43ecc 279
wim 37:ce348c002929 280 /** Convert ASCII character code to the LCD fonttable code
wim 37:ce348c002929 281 *
wim 37:ce348c002929 282 * @param c The character to write to the display
wim 37:ce348c002929 283 * @return The character code for the specific fonttable of the controller
wim 37:ce348c002929 284 */
wim 37:ce348c002929 285 int ASCII_2_LCD (int c);
wim 37:ce348c002929 286
wim 37:ce348c002929 287
wim 34:e5a0dcb43ecc 288 #if(LCD_PRINTF != 1)
wim 34:e5a0dcb43ecc 289 /** Write a character to the LCD
wim 34:e5a0dcb43ecc 290 *
wim 34:e5a0dcb43ecc 291 * @param c The character to write to the display
wim 34:e5a0dcb43ecc 292 */
wim 34:e5a0dcb43ecc 293 int putc(int c);
wim 34:e5a0dcb43ecc 294
wim 34:e5a0dcb43ecc 295 /** Write a raw string to the LCD
wim 34:e5a0dcb43ecc 296 *
wim 34:e5a0dcb43ecc 297 * @param string text, may be followed by variables to emulate formatting the string.
wim 34:e5a0dcb43ecc 298 * However, printf formatting is NOT supported and variables will be ignored!
wim 34:e5a0dcb43ecc 299 */
wim 34:e5a0dcb43ecc 300 int printf(const char* text, ...);
wim 34:e5a0dcb43ecc 301 #else
simon 2:227356c7d12c 302 #if DOXYGEN_ONLY
simon 2:227356c7d12c 303 /** Write a character to the LCD
simon 2:227356c7d12c 304 *
simon 2:227356c7d12c 305 * @param c The character to write to the display
simon 2:227356c7d12c 306 */
simon 2:227356c7d12c 307 int putc(int c);
simon 2:227356c7d12c 308
wim 34:e5a0dcb43ecc 309 /** Write a formatted string to the LCD
simon 2:227356c7d12c 310 *
simon 2:227356c7d12c 311 * @param format A printf-style format string, followed by the
wim 34:e5a0dcb43ecc 312 * variables to use in formatting the string.
simon 2:227356c7d12c 313 */
wim 34:e5a0dcb43ecc 314 int printf(const char* format, ...);
simon 2:227356c7d12c 315 #endif
wim 34:e5a0dcb43ecc 316
wim 34:e5a0dcb43ecc 317 #endif
simon 2:227356c7d12c 318
wim 29:a3663151aa65 319 /** Locate cursor to a screen column and row
simon 2:227356c7d12c 320 *
simon 2:227356c7d12c 321 * @param column The horizontal position from the left, indexed from 0
simon 2:227356c7d12c 322 * @param row The vertical position from the top, indexed from 0
simon 2:227356c7d12c 323 */
simon 1:ac48b187213c 324 void locate(int column, int row);
simon 2:227356c7d12c 325
wim 10:dd9b3a696acd 326 /** Return the memoryaddress of screen column and row location
wim 10:dd9b3a696acd 327 *
wim 10:dd9b3a696acd 328 * @param column The horizontal position from the left, indexed from 0
wim 10:dd9b3a696acd 329 * @param row The vertical position from the top, indexed from 0
wim 36:9f5f86dfd44a 330 * @return The memoryaddress of screen column and row location
wim 10:dd9b3a696acd 331 */
wim 30:033048611c01 332 int getAddress(int column, int row);
wim 10:dd9b3a696acd 333
wim 10:dd9b3a696acd 334 /** Set the memoryaddress of screen column and row location
wim 10:dd9b3a696acd 335 *
wim 10:dd9b3a696acd 336 * @param column The horizontal position from the left, indexed from 0
wim 10:dd9b3a696acd 337 * @param row The vertical position from the top, indexed from 0
wim 10:dd9b3a696acd 338 */
wim 9:0893d986e717 339 void setAddress(int column, int row);
wim 9:0893d986e717 340
wim 22:35742ec80c24 341 /** Clear the screen and locate to 0,0
wim 22:35742ec80c24 342 */
simon 1:ac48b187213c 343 void cls();
simon 2:227356c7d12c 344
wim 10:dd9b3a696acd 345 /** Return the number of rows
wim 10:dd9b3a696acd 346 *
wim 36:9f5f86dfd44a 347 * @return The number of rows
wim 10:dd9b3a696acd 348 */
simon 1:ac48b187213c 349 int rows();
wim 10:dd9b3a696acd 350
wim 10:dd9b3a696acd 351 /** Return the number of columns
wim 10:dd9b3a696acd 352 *
wim 36:9f5f86dfd44a 353 * @return The number of columns
wim 10:dd9b3a696acd 354 */
wim 10:dd9b3a696acd 355 int columns();
simon 2:227356c7d12c 356
wim 11:9ec02df863a1 357 /** Set the Cursormode
wim 11:9ec02df863a1 358 *
wim 17:652ab113bc2e 359 * @param cursorMode The Cursor mode (CurOff_BlkOff, CurOn_BlkOff, CurOff_BlkOn, CurOn_BlkOn)
wim 11:9ec02df863a1 360 */
wim 17:652ab113bc2e 361 void setCursor(LCDCursor cursorMode);
wim 17:652ab113bc2e 362
wim 17:652ab113bc2e 363 /** Set the Displaymode
wim 17:652ab113bc2e 364 *
wim 17:652ab113bc2e 365 * @param displayMode The Display mode (DispOff, DispOn)
wim 17:652ab113bc2e 366 */
wim 21:9eb628d9e164 367 void setMode(LCDMode displayMode);
wim 11:9ec02df863a1 368
wim 20:e0da005a777f 369 /** Set the Backlight mode
wim 20:e0da005a777f 370 *
wim 21:9eb628d9e164 371 * @param backlightMode The Backlight mode (LightOff, LightOn)
wim 20:e0da005a777f 372 */
wim 21:9eb628d9e164 373 void setBacklight(LCDBacklight backlightMode);
wim 20:e0da005a777f 374
wim 33:900a94bc7585 375 /** Set User Defined Characters (UDC)
wim 11:9ec02df863a1 376 *
wim 34:e5a0dcb43ecc 377 * @param unsigned char c The Index of the UDC (0..7) for HD44780 clones and (0..15) for some more advanced controllers
wim 34:e5a0dcb43ecc 378 * @param char *udc_data The bitpatterns for the UDC (8 bytes of 5 significant bits for bitpattern and 3 bits for blinkmode (advanced types))
wim 11:9ec02df863a1 379 */
wim 11:9ec02df863a1 380 void setUDC(unsigned char c, char *udc_data);
wim 11:9ec02df863a1 381
wim 36:9f5f86dfd44a 382 /** Set UDC Blink and Icon blink
wim 33:900a94bc7585 383 * setUDCBlink method is supported by some compatible devices (eg SSD1803)
wim 33:900a94bc7585 384 *
wim 33:900a94bc7585 385 * @param blinkMode The Blink mode (BlinkOff, BlinkOn)
wim 33:900a94bc7585 386 */
wim 33:900a94bc7585 387 void setUDCBlink(LCDBlink blinkMode);
wim 33:900a94bc7585 388
wim 32:59c4b8f648d4 389 /** Set Contrast
wim 32:59c4b8f648d4 390 * setContrast method is supported by some compatible devices (eg ST7032i) that have onboard LCD voltage generation
wim 32:59c4b8f648d4 391 * Code imported from fork by JH1PJL
wim 32:59c4b8f648d4 392 *
wim 32:59c4b8f648d4 393 * @param unsigned char c contrast data (6 significant bits, valid range 0..63, Value 0 will disable the Vgen)
wim 32:59c4b8f648d4 394 * @return none
wim 32:59c4b8f648d4 395 */
wim 32:59c4b8f648d4 396 void setContrast(unsigned char c = LCD_DEF_CONTRAST);
wim 32:59c4b8f648d4 397
wim 32:59c4b8f648d4 398 /** Set Power
wim 32:59c4b8f648d4 399 * setPower method is supported by some compatible devices (eg SSD1803) that have power down modes
wim 32:59c4b8f648d4 400 *
wim 32:59c4b8f648d4 401 * @param bool powerOn Power on/off
wim 32:59c4b8f648d4 402 * @return none
wim 32:59c4b8f648d4 403 */
wim 32:59c4b8f648d4 404 void setPower(bool powerOn = true);
wim 32:59c4b8f648d4 405
wim 33:900a94bc7585 406 /** Set Orient
wim 33:900a94bc7585 407 * setOrient method is supported by some compatible devices (eg SSD1803, US2066) that have top/bottom view modes
wim 33:900a94bc7585 408 *
wim 33:900a94bc7585 409 * @param LCDOrient orient Orientation
wim 33:900a94bc7585 410 * @return none
wim 33:900a94bc7585 411 */
wim 33:900a94bc7585 412 void setOrient(LCDOrient orient = Top);
wim 33:900a94bc7585 413
wim 34:e5a0dcb43ecc 414 /** Set Big Font
wim 34:e5a0dcb43ecc 415 * setBigFont method is supported by some compatible devices (eg SSD1803, US2066)
wim 34:e5a0dcb43ecc 416 *
wim 34:e5a0dcb43ecc 417 * @param lines The selected Big Font lines (None, TopLine, CenterLine, BottomLine, TopBottomLine)
wim 34:e5a0dcb43ecc 418 * Double height characters can be shown on lines 1+2, 2+3, 3+4 or 1+2 and 3+4
wim 34:e5a0dcb43ecc 419 * Valid double height lines depend on the LCDs number of rows.
wim 34:e5a0dcb43ecc 420 */
wim 34:e5a0dcb43ecc 421 void setBigFont(LCDBigFont lines);
wim 32:59c4b8f648d4 422
wim 36:9f5f86dfd44a 423 /** Set Icons
wim 36:9f5f86dfd44a 424 *
wim 36:9f5f86dfd44a 425 * @param unsigned char idx The Index of the icon pattern (0..15) for KS0073 and similar controllers
wim 36:9f5f86dfd44a 426 * and Index (0..31) for PCF2103 and similar controllers
wim 36:9f5f86dfd44a 427 * @param unsigned char data The bitpattern for the icons (6 lsb for KS0073 bitpattern (5 lsb for KS0078) and 2 msb for blinkmode)
wim 36:9f5f86dfd44a 428 * The bitpattern for the PCF2103 icons is 5 lsb (UDC 0..2) and 5 lsb for blinkmode (UDC 4..6)
wim 36:9f5f86dfd44a 429 */
wim 36:9f5f86dfd44a 430 void setIcon(unsigned char idx, unsigned char data);
wim 36:9f5f86dfd44a 431
wim 36:9f5f86dfd44a 432 /** Clear Icons
wim 36:9f5f86dfd44a 433 *
wim 36:9f5f86dfd44a 434 * @param none
wim 36:9f5f86dfd44a 435 * @return none
wim 36:9f5f86dfd44a 436 */
wim 36:9f5f86dfd44a 437 //@TODO Add support for 40x4 dual controller
wim 36:9f5f86dfd44a 438 void clrIcon();
wim 36:9f5f86dfd44a 439
wim 36:9f5f86dfd44a 440 /** Set Invert
wim 36:9f5f86dfd44a 441 * setInvert method is supported by some compatible devices (eg KS0073) to swap between black and white
wim 36:9f5f86dfd44a 442 *
wim 36:9f5f86dfd44a 443 * @param bool invertOn Invert on/off
wim 36:9f5f86dfd44a 444 * @return none
wim 36:9f5f86dfd44a 445 */
wim 36:9f5f86dfd44a 446 //@TODO Add support for 40x4 dual controller
wim 36:9f5f86dfd44a 447 void setInvert(bool invertOn);
wim 36:9f5f86dfd44a 448
simon 1:ac48b187213c 449 protected:
wim 13:24506ba22480 450
wim 21:9eb628d9e164 451 /** LCD controller select, mainly used for LCD40x4
wim 21:9eb628d9e164 452 */
wim 19:c747b9e2e7b8 453 enum _LCDCtrl_Idx {
wim 15:b70ebfffb258 454 _LCDCtrl_0, /*< Primary */
wim 15:b70ebfffb258 455 _LCDCtrl_1, /*< Secondary */
wim 15:b70ebfffb258 456 };
wim 21:9eb628d9e164 457
wim 37:ce348c002929 458 /** LCD Datalength control to select between 4 or 8 bit data/commands, mainly used for native Serial interface */
wim 36:9f5f86dfd44a 459 enum _LCDDatalength {
wim 36:9f5f86dfd44a 460 _LCD_DL_4 = 0x00, /**< Datalength 4 bit */
wim 36:9f5f86dfd44a 461 _LCD_DL_8 = 0x10 /**< Datalength 8 bit */
wim 36:9f5f86dfd44a 462 };
wim 36:9f5f86dfd44a 463
wim 21:9eb628d9e164 464 /** Create a TextLCD_Base interface
wim 21:9eb628d9e164 465 * @brief Base class, can not be instantiated
wim 21:9eb628d9e164 466 *
wim 21:9eb628d9e164 467 * @param type Sets the panel size/addressing mode (default = LCD16x2)
wim 21:9eb628d9e164 468 * @param ctrl LCD controller (default = HD44780)
wim 21:9eb628d9e164 469 */
wim 21:9eb628d9e164 470 TextLCD_Base(LCDType type = LCD16x2, LCDCtrl ctrl = HD44780);
wim 15:b70ebfffb258 471
simon 1:ac48b187213c 472 // Stream implementation functions
simon 1:ac48b187213c 473 virtual int _putc(int value);
simon 1:ac48b187213c 474 virtual int _getc();
simon 1:ac48b187213c 475
wim 36:9f5f86dfd44a 476 /** Medium level initialisation method for LCD controller
wim 36:9f5f86dfd44a 477 * @param _LCDDatalength dl sets the datalength of data/commands
wim 36:9f5f86dfd44a 478 * @return none
wim 21:9eb628d9e164 479 */
wim 36:9f5f86dfd44a 480 void _init(_LCDDatalength dl = _LCD_DL_4);
wim 29:a3663151aa65 481
wim 29:a3663151aa65 482 /** Low level initialisation method for LCD controller
wim 36:9f5f86dfd44a 483 * Set number of lines, fonttype, no cursor etc
wim 36:9f5f86dfd44a 484 * The controller is accessed in 4-bit parallel mode either directly via mbed pins or through I2C or SPI expander.
wim 36:9f5f86dfd44a 485 * Some controllers also support native I2C or SPI interfaces.
wim 36:9f5f86dfd44a 486 *
wim 36:9f5f86dfd44a 487 * @param _LCDDatalength dl sets the 4 or 8 bit datalength of data/commands. Required for some native serial modes.
wim 36:9f5f86dfd44a 488 * @return none
wim 29:a3663151aa65 489 */
wim 36:9f5f86dfd44a 490 void _initCtrl(_LCDDatalength dl = _LCD_DL_4);
wim 29:a3663151aa65 491
wim 29:a3663151aa65 492 /** Low level character address set method
wim 29:a3663151aa65 493 */
wim 13:24506ba22480 494 int _address(int column, int row);
wim 29:a3663151aa65 495
wim 29:a3663151aa65 496 /** Low level cursor enable or disable method
wim 29:a3663151aa65 497 */
wim 21:9eb628d9e164 498 void _setCursor(LCDCursor show);
wim 29:a3663151aa65 499
wim 29:a3663151aa65 500 /** Low level method to store user defined characters for current controller
wim 34:e5a0dcb43ecc 501 *
wim 34:e5a0dcb43ecc 502 * @param unsigned char c The Index of the UDC (0..7) for HD44780 clones and (0..15) for some more advanced controllers
wim 34:e5a0dcb43ecc 503 * @param char *udc_data The bitpatterns for the UDC (8 bytes of 5 significant bits)
wim 29:a3663151aa65 504 */
wim 17:652ab113bc2e 505 void _setUDC(unsigned char c, char *udc_data);
wim 29:a3663151aa65 506
wim 29:a3663151aa65 507 /** Low level method to restore the cursortype and display mode for current controller
wim 29:a3663151aa65 508 */
wim 21:9eb628d9e164 509 void _setCursorAndDisplayMode(LCDMode displayMode, LCDCursor cursorType);
wim 13:24506ba22480 510
wim 29:a3663151aa65 511 /** Low level nibble write operation to LCD controller (serial or parallel)
wim 21:9eb628d9e164 512 */
wim 17:652ab113bc2e 513 void _writeNibble(int value);
wim 29:a3663151aa65 514
wim 29:a3663151aa65 515 /** Low level command byte write operation to LCD controller.
wim 29:a3663151aa65 516 * Methods resets the RS bit and provides the required timing for the command.
wim 29:a3663151aa65 517 */
wim 15:b70ebfffb258 518 void _writeCommand(int command);
wim 33:900a94bc7585 519
wim 29:a3663151aa65 520 /** Low level data byte write operation to LCD controller (serial or parallel).
wim 29:a3663151aa65 521 * Methods sets the RS bit and provides the required timing for the data.
wim 29:a3663151aa65 522 */
wim 15:b70ebfffb258 523 void _writeData(int data);
wim 15:b70ebfffb258 524
wim 29:a3663151aa65 525 /** Pure Virtual Low level writes to LCD Bus (serial or parallel)
wim 29:a3663151aa65 526 * Set the Enable pin.
wim 29:a3663151aa65 527 */
wim 29:a3663151aa65 528 virtual void _setEnable(bool value) = 0;
wim 29:a3663151aa65 529
wim 21:9eb628d9e164 530 /** Pure Virtual Low level writes to LCD Bus (serial or parallel)
wim 29:a3663151aa65 531 * Set the RS pin ( 0 = Command, 1 = Data).
wim 29:a3663151aa65 532 */
wim 21:9eb628d9e164 533 virtual void _setRS(bool value) = 0;
wim 29:a3663151aa65 534
wim 29:a3663151aa65 535 /** Pure Virtual Low level writes to LCD Bus (serial or parallel)
wim 29:a3663151aa65 536 * Set the BL pin (0 = Backlight Off, 1 = Backlight On).
wim 29:a3663151aa65 537 */
wim 21:9eb628d9e164 538 virtual void _setBL(bool value) = 0;
wim 29:a3663151aa65 539
wim 29:a3663151aa65 540 /** Pure Virtual Low level writes to LCD Bus (serial or parallel)
wim 29:a3663151aa65 541 * Set the databus value (4 bit).
wim 29:a3663151aa65 542 */
wim 21:9eb628d9e164 543 virtual void _setData(int value) = 0;
wim 13:24506ba22480 544
wim 29:a3663151aa65 545 /** Low level byte write operation to LCD controller (serial or parallel)
wim 29:a3663151aa65 546 * Depending on the RS pin this byte will be interpreted as data or command
wim 29:a3663151aa65 547 */
wim 29:a3663151aa65 548 virtual void _writeByte(int value);
wim 33:900a94bc7585 549
wim 13:24506ba22480 550 //Display type
wim 37:ce348c002929 551 LCDType _type; // Display type
wim 37:ce348c002929 552 int _nr_cols;
wim 30:033048611c01 553 int _nr_rows;
wim 37:ce348c002929 554 int _addr_mode; // Addressing mode of LCDType, defines relation between display row,col and controller memory address
wim 37:ce348c002929 555
wim 21:9eb628d9e164 556 //Display mode
wim 17:652ab113bc2e 557 LCDMode _currentMode;
wim 17:652ab113bc2e 558
wim 19:c747b9e2e7b8 559 //Controller type
wim 37:ce348c002929 560 LCDCtrl _ctrl; // Controller type
wim 37:ce348c002929 561 int _font; // ASCII character fonttable
wim 37:ce348c002929 562
wim 15:b70ebfffb258 563 //Controller select, mainly used for LCD40x4
wim 19:c747b9e2e7b8 564 _LCDCtrl_Idx _ctrl_idx;
wim 15:b70ebfffb258 565
wim 13:24506ba22480 566 // Cursor
simon 1:ac48b187213c 567 int _column;
simon 1:ac48b187213c 568 int _row;
wim 32:59c4b8f648d4 569 LCDCursor _currentCursor;
wim 32:59c4b8f648d4 570
wim 36:9f5f86dfd44a 571 // Function modes saved to allow switch between Instruction sets after initialisation time
wim 36:9f5f86dfd44a 572 int _function, _function_1, _function_x;
wim 36:9f5f86dfd44a 573
wim 32:59c4b8f648d4 574 // Icon, Booster mode and contrast saved to allow contrast change at later time
wim 32:59c4b8f648d4 575 // Only available for controllers with added features
wim 36:9f5f86dfd44a 576 int _icon_power, _contrast;
simon 1:ac48b187213c 577 };
simon 1:ac48b187213c 578
wim 23:d47f226efb24 579 //--------- End TextLCD_Base -----------
wim 22:35742ec80c24 580
wim 22:35742ec80c24 581
wim 23:d47f226efb24 582 //--------- Start TextLCD Bus -----------
wim 21:9eb628d9e164 583
wim 21:9eb628d9e164 584 /** Create a TextLCD interface for using regular mbed pins
wim 21:9eb628d9e164 585 *
wim 21:9eb628d9e164 586 */
wim 21:9eb628d9e164 587 class TextLCD : public TextLCD_Base {
wim 21:9eb628d9e164 588 public:
wim 21:9eb628d9e164 589 /** Create a TextLCD interface for using regular mbed pins
wim 21:9eb628d9e164 590 *
wim 21:9eb628d9e164 591 * @param rs Instruction/data control line
wim 21:9eb628d9e164 592 * @param e Enable line (clock)
wim 21:9eb628d9e164 593 * @param d4-d7 Data lines for using as a 4-bit interface
wim 21:9eb628d9e164 594 * @param type Sets the panel size/addressing mode (default = LCD16x2)
wim 21:9eb628d9e164 595 * @param bl Backlight control line (optional, default = NC)
wim 21:9eb628d9e164 596 * @param e2 Enable2 line (clock for second controller, LCD40x4 only)
wim 21:9eb628d9e164 597 * @param ctrl LCD controller (default = HD44780)
wim 21:9eb628d9e164 598 */
wim 21:9eb628d9e164 599 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 600
wim 22:35742ec80c24 601 /** Destruct a TextLCD interface for using regular mbed pins
wim 22:35742ec80c24 602 *
wim 22:35742ec80c24 603 * @param none
wim 22:35742ec80c24 604 * @return none
wim 22:35742ec80c24 605 */
wim 22:35742ec80c24 606 virtual ~TextLCD();
wim 22:35742ec80c24 607
wim 21:9eb628d9e164 608 private:
wim 29:a3663151aa65 609
wim 29:a3663151aa65 610 /** Implementation of pure Virtual Low level writes to LCD Bus (parallel)
wim 29:a3663151aa65 611 * Set the Enable pin.
wim 29:a3663151aa65 612 */
wim 21:9eb628d9e164 613 virtual void _setEnable(bool value);
wim 29:a3663151aa65 614
wim 29:a3663151aa65 615 /** Implementation of pure Virtual Low level writes to LCD Bus (parallel)
wim 32:59c4b8f648d4 616 * Set the RS pin (0 = Command, 1 = Data).
wim 29:a3663151aa65 617 */
wim 21:9eb628d9e164 618 virtual void _setRS(bool value);
wim 29:a3663151aa65 619
wim 29:a3663151aa65 620 /** Implementation of pure Virtual Low level writes to LCD Bus (parallel)
wim 29:a3663151aa65 621 * Set the BL pin (0 = Backlight Off, 1 = Backlight On).
wim 29:a3663151aa65 622 */
wim 21:9eb628d9e164 623 virtual void _setBL(bool value);
wim 29:a3663151aa65 624
wim 29:a3663151aa65 625 /** Implementation of pure Virtual Low level writes to LCD Bus (parallel)
wim 29:a3663151aa65 626 * Set the databus value (4 bit).
wim 29:a3663151aa65 627 */
wim 21:9eb628d9e164 628 virtual void _setData(int value);
wim 21:9eb628d9e164 629
wim 22:35742ec80c24 630 /** Regular mbed pins bus
wim 22:35742ec80c24 631 */
wim 22:35742ec80c24 632 DigitalOut _rs, _e;
wim 22:35742ec80c24 633 BusOut _d;
wim 22:35742ec80c24 634
wim 22:35742ec80c24 635 /** Optional Hardware pins for the Backlight and LCD40x4 device
wim 22:35742ec80c24 636 * Default PinName value is NC, must be used as pointer to avoid issues with mbed lib and DigitalOut pins
wim 22:35742ec80c24 637 */
wim 37:ce348c002929 638 DigitalOut *_bl, *_e2;
wim 21:9eb628d9e164 639 };
wim 21:9eb628d9e164 640
wim 23:d47f226efb24 641 //----------- End TextLCD ---------------
wim 21:9eb628d9e164 642
wim 21:9eb628d9e164 643
wim 23:d47f226efb24 644 //--------- Start TextLCD_I2C -----------
wim 34:e5a0dcb43ecc 645 #if(LCD_I2C == 1) /* I2C Expander PCF8574/MCP23008 */
wim 22:35742ec80c24 646
wim 26:bd897a001012 647 /** Create a TextLCD interface using an I2C PCF8574 (or PCF8574A) or MCP23008 portexpander
wim 21:9eb628d9e164 648 *
wim 21:9eb628d9e164 649 */
wim 21:9eb628d9e164 650 class TextLCD_I2C : public TextLCD_Base {
wim 21:9eb628d9e164 651 public:
wim 26:bd897a001012 652 /** Create a TextLCD interface using an I2C PCF8574 (or PCF8574A) or MCP23008 portexpander
wim 21:9eb628d9e164 653 *
wim 21:9eb628d9e164 654 * @param i2c I2C Bus
wim 37:ce348c002929 655 * @param deviceAddress I2C slave address (PCF8574 (or PCF8574A) or MCP23008 portexpander, default = PCF8574_SA0 = 0x40)
wim 21:9eb628d9e164 656 * @param type Sets the panel size/addressing mode (default = LCD16x2)
wim 21:9eb628d9e164 657 * @param ctrl LCD controller (default = HD44780)
wim 21:9eb628d9e164 658 */
wim 26:bd897a001012 659 TextLCD_I2C(I2C *i2c, char deviceAddress = PCF8574_SA0, LCDType type = LCD16x2, LCDCtrl ctrl = HD44780);
wim 21:9eb628d9e164 660
wim 21:9eb628d9e164 661 private:
wim 29:a3663151aa65 662
wim 37:ce348c002929 663 /** Place the Enable bit in the databus shadowvalue
wim 37:ce348c002929 664 * Used for mbed I2C portexpander
wim 37:ce348c002929 665 * @param value data to write
wim 37:ce348c002929 666 * @return none
wim 37:ce348c002929 667 */
wim 37:ce348c002929 668 void _setEnableBit(bool value);
wim 37:ce348c002929 669
wim 29:a3663151aa65 670 /** Implementation of pure Virtual Low level writes to LCD Bus (serial expander)
wim 29:a3663151aa65 671 * Set the Enable pin.
wim 29:a3663151aa65 672 */
wim 21:9eb628d9e164 673 virtual void _setEnable(bool value);
wim 29:a3663151aa65 674
wim 29:a3663151aa65 675 /** Implementation of pure Virtual Low level writes to LCD Bus (serial expander)
wim 32:59c4b8f648d4 676 * Set the RS pin (0 = Command, 1 = Data).
wim 29:a3663151aa65 677 */
wim 21:9eb628d9e164 678 virtual void _setRS(bool value);
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 BL pin (0 = Backlight Off, 1 = Backlight On).
wim 29:a3663151aa65 682 */
wim 21:9eb628d9e164 683 virtual void _setBL(bool value);
wim 29:a3663151aa65 684
wim 37:ce348c002929 685 /** Place the 4bit data in the databus shadowvalue
wim 37:ce348c002929 686 * Used for mbed I2C portexpander
wim 37:ce348c002929 687 * @param value data to write
wim 37:ce348c002929 688 * @return none
wim 37:ce348c002929 689 */
wim 37:ce348c002929 690 void _setDataBits(int value);
wim 37:ce348c002929 691
wim 29:a3663151aa65 692 /** Implementation of pure Virtual Low level writes to LCD Bus (serial expander)
wim 29:a3663151aa65 693 * Set the databus value (4 bit).
wim 29:a3663151aa65 694 */
wim 29:a3663151aa65 695 virtual void _setData(int value);
wim 37:ce348c002929 696
wim 37:ce348c002929 697 //New optimized
wim 37:ce348c002929 698 //Test faster _writeByte 0.11s vs 0.27s for a 20x4 fillscreen (PCF8574)
wim 37:ce348c002929 699 //Test faster _writeByte 0.14s vs 0.34s for a 20x4 fillscreen (MCP23008)
wim 37:ce348c002929 700
wim 37:ce348c002929 701 /** Low level writes to LCD serial bus expander
wim 37:ce348c002929 702 */
wim 37:ce348c002929 703 virtual void _writeByte(int value);
wim 37:ce348c002929 704
wim 29:a3663151aa65 705 /** Write data to MCP23008 I2C portexpander
wim 29:a3663151aa65 706 * @param reg register to write
wim 29:a3663151aa65 707 * @param value data to write
wim 29:a3663151aa65 708 * @return none
wim 29:a3663151aa65 709 */
wim 37:ce348c002929 710 void _writeRegister (int reg, int value);
wim 21:9eb628d9e164 711
wim 21:9eb628d9e164 712 //I2C bus
wim 21:9eb628d9e164 713 I2C *_i2c;
wim 21:9eb628d9e164 714 char _slaveAddress;
wim 21:9eb628d9e164 715
wim 37:ce348c002929 716 // Internal bus shadow value for serial bus only
wim 30:033048611c01 717 char _lcd_bus;
wim 21:9eb628d9e164 718 };
wim 34:e5a0dcb43ecc 719 #endif /* I2C Expander PCF8574/MCP23008 */
wim 21:9eb628d9e164 720
wim 23:d47f226efb24 721 //---------- End TextLCD_I2C ------------
wim 22:35742ec80c24 722
wim 22:35742ec80c24 723
wim 23:d47f226efb24 724 //--------- Start TextLCD_SPI -----------
wim 34:e5a0dcb43ecc 725 #if(LCD_SPI == 1) /* SPI Expander SN74595 */
wim 22:35742ec80c24 726
wim 21:9eb628d9e164 727 /** Create a TextLCD interface using an SPI 74595 portexpander
wim 21:9eb628d9e164 728 *
wim 21:9eb628d9e164 729 */
wim 21:9eb628d9e164 730 class TextLCD_SPI : public TextLCD_Base {
wim 21:9eb628d9e164 731 public:
wim 21:9eb628d9e164 732 /** Create a TextLCD interface using an SPI 74595 portexpander
wim 21:9eb628d9e164 733 *
wim 21:9eb628d9e164 734 * @param spi SPI Bus
wim 21:9eb628d9e164 735 * @param cs chip select pin (active low)
wim 21:9eb628d9e164 736 * @param type Sets the panel size/addressing mode (default = LCD16x2)
wim 21:9eb628d9e164 737 * @param ctrl LCD controller (default = HD44780)
wim 21:9eb628d9e164 738 */
wim 21:9eb628d9e164 739 TextLCD_SPI(SPI *spi, PinName cs, LCDType type = LCD16x2, LCDCtrl ctrl = HD44780);
wim 21:9eb628d9e164 740
wim 21:9eb628d9e164 741 private:
wim 29:a3663151aa65 742
wim 29:a3663151aa65 743 /** Implementation of pure Virtual Low level writes to LCD Bus (serial expander)
wim 29:a3663151aa65 744 * Set the Enable pin.
wim 29:a3663151aa65 745 */
wim 21:9eb628d9e164 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 expander)
wim 32:59c4b8f648d4 749 * Set the RS pin (0 = Command, 1 = Data).
wim 29:a3663151aa65 750 */
wim 21:9eb628d9e164 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 expander)
wim 29:a3663151aa65 754 * Set the BL pin (0 = Backlight Off, 1 = Backlight On).
wim 29:a3663151aa65 755 */
wim 21:9eb628d9e164 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 expander)
wim 29:a3663151aa65 759 * Set the databus value (4 bit).
wim 29:a3663151aa65 760 */
wim 37:ce348c002929 761 virtual void _setData(int value);
wim 21:9eb628d9e164 762
wim 21:9eb628d9e164 763 // SPI bus
wim 21:9eb628d9e164 764 SPI *_spi;
wim 21:9eb628d9e164 765 DigitalOut _cs;
wim 21:9eb628d9e164 766
wim 37:ce348c002929 767 // Internal bus shadow value for serial bus only
wim 21:9eb628d9e164 768 char _lcd_bus;
wim 21:9eb628d9e164 769 };
wim 34:e5a0dcb43ecc 770 #endif /* SPI Expander SN74595 */
wim 23:d47f226efb24 771 //---------- End TextLCD_SPI ------------
wim 21:9eb628d9e164 772
Sissors 24:fb3399713710 773
wim 37:ce348c002929 774 //--------- Start TextLCD_I2C_N -----------
wim 37:ce348c002929 775 #if(LCD_I2C_N == 1) /* Native I2C */
wim 37:ce348c002929 776
wim 37:ce348c002929 777 /** Create a TextLCD interface using a controller with native I2C interface
wim 37:ce348c002929 778 *
wim 37:ce348c002929 779 */
wim 37:ce348c002929 780 class TextLCD_I2C_N : public TextLCD_Base {
wim 37:ce348c002929 781 public:
wim 37:ce348c002929 782 /** Create a TextLCD interface using a controller with native I2C interface
wim 37:ce348c002929 783 *
wim 37:ce348c002929 784 * @param i2c I2C Bus
wim 37:ce348c002929 785 * @param deviceAddress I2C slave address (default = ST7032_SA = 0x7C)
wim 37:ce348c002929 786 * @param type Sets the panel size/addressing mode (default = LCD16x2)
wim 37:ce348c002929 787 * @param bl Backlight control line (optional, default = NC)
wim 37:ce348c002929 788 * @param ctrl LCD controller (default = ST7032_3V3)
wim 37:ce348c002929 789 */
wim 37:ce348c002929 790 TextLCD_I2C_N(I2C *i2c, char deviceAddress = ST7032_SA, LCDType type = LCD16x2, PinName bl = NC, LCDCtrl ctrl = ST7032_3V3);
wim 37:ce348c002929 791
wim 37:ce348c002929 792 /** Destruct a TextLCD interface using a controller with native I2C interface
wim 37:ce348c002929 793 */
wim 37:ce348c002929 794 virtual ~TextLCD_I2C_N(void);
wim 37:ce348c002929 795
wim 37:ce348c002929 796 private:
wim 37:ce348c002929 797
wim 37:ce348c002929 798 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 37:ce348c002929 799 * Set the Enable pin.
wim 37:ce348c002929 800 */
wim 37:ce348c002929 801 virtual void _setEnable(bool value);
wim 37:ce348c002929 802
wim 37:ce348c002929 803 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 37:ce348c002929 804 * Set the RS pin ( 0 = Command, 1 = Data).
wim 37:ce348c002929 805 */
wim 37:ce348c002929 806 virtual void _setRS(bool value);
wim 37:ce348c002929 807
wim 37:ce348c002929 808 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 37:ce348c002929 809 * Set the BL pin (0 = Backlight Off, 1 = Backlight On).
wim 37:ce348c002929 810 */
wim 37:ce348c002929 811 virtual void _setBL(bool value);
wim 37:ce348c002929 812
wim 37:ce348c002929 813 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 37:ce348c002929 814 * Set the databus value (4 bit).
wim 37:ce348c002929 815 */
wim 37:ce348c002929 816 virtual void _setData(int value);
wim 37:ce348c002929 817
wim 37:ce348c002929 818 /** Low level writes to LCD serial bus only (serial native)
wim 37:ce348c002929 819 */
wim 37:ce348c002929 820 virtual void _writeByte(int value);
wim 37:ce348c002929 821
wim 37:ce348c002929 822 //I2C bus
wim 37:ce348c002929 823 I2C *_i2c;
wim 37:ce348c002929 824 char _slaveAddress;
wim 37:ce348c002929 825
wim 37:ce348c002929 826 // controlbyte to select between data and command. Internal shadow value for serial bus only
wim 37:ce348c002929 827 char _controlbyte;
wim 37:ce348c002929 828
wim 37:ce348c002929 829 //Backlight
wim 37:ce348c002929 830 DigitalOut *_bl;
wim 37:ce348c002929 831
wim 37:ce348c002929 832 };
wim 37:ce348c002929 833 #endif /* Native I2C */
wim 37:ce348c002929 834 //---------- End TextLCD_I2C_N ------------
wim 37:ce348c002929 835
wim 37:ce348c002929 836
wim 26:bd897a001012 837 //--------- Start TextLCD_SPI_N -----------
wim 34:e5a0dcb43ecc 838 #if(LCD_SPI_N == 1) /* Native SPI bus */
Sissors 24:fb3399713710 839
wim 30:033048611c01 840 /** Create a TextLCD interface using a controller with native SPI4 interface
Sissors 24:fb3399713710 841 *
Sissors 24:fb3399713710 842 */
wim 25:6162b31128c9 843 class TextLCD_SPI_N : public TextLCD_Base {
Sissors 24:fb3399713710 844 public:
wim 30:033048611c01 845 /** Create a TextLCD interface using a controller with native SPI4 interface
Sissors 24:fb3399713710 846 *
Sissors 24:fb3399713710 847 * @param spi SPI Bus
Sissors 24:fb3399713710 848 * @param cs chip select pin (active low)
Sissors 24:fb3399713710 849 * @param rs Instruction/data control line
Sissors 24:fb3399713710 850 * @param type Sets the panel size/addressing mode (default = LCD16x2)
Sissors 24:fb3399713710 851 * @param bl Backlight control line (optional, default = NC)
wim 26:bd897a001012 852 * @param ctrl LCD controller (default = ST7032_3V3)
Sissors 24:fb3399713710 853 */
wim 26:bd897a001012 854 TextLCD_SPI_N(SPI *spi, PinName cs, PinName rs, LCDType type = LCD16x2, PinName bl = NC, LCDCtrl ctrl = ST7032_3V3);
wim 37:ce348c002929 855
wim 37:ce348c002929 856 /** Destruct a TextLCD interface using a controller with native SPI4 interface
wim 37:ce348c002929 857 */
wim 25:6162b31128c9 858 virtual ~TextLCD_SPI_N(void);
Sissors 24:fb3399713710 859
Sissors 24:fb3399713710 860 private:
wim 29:a3663151aa65 861
wim 29:a3663151aa65 862 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 29:a3663151aa65 863 * Set the Enable pin.
wim 29:a3663151aa65 864 */
Sissors 24:fb3399713710 865 virtual void _setEnable(bool value);
wim 29:a3663151aa65 866
wim 29:a3663151aa65 867 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 32:59c4b8f648d4 868 * Set the RS pin (0 = Command, 1 = Data).
wim 29:a3663151aa65 869 */
Sissors 24:fb3399713710 870 virtual void _setRS(bool value);
wim 29:a3663151aa65 871
wim 29:a3663151aa65 872 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 29:a3663151aa65 873 * Set the BL pin (0 = Backlight Off, 1 = Backlight On).
wim 29:a3663151aa65 874 */
Sissors 24:fb3399713710 875 virtual void _setBL(bool value);
wim 29:a3663151aa65 876
wim 29:a3663151aa65 877 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 29:a3663151aa65 878 * Set the databus value (4 bit).
wim 29:a3663151aa65 879 */
Sissors 24:fb3399713710 880 virtual void _setData(int value);
wim 29:a3663151aa65 881
wim 29:a3663151aa65 882 /** Low level writes to LCD serial bus only (serial native)
wim 29:a3663151aa65 883 */
Sissors 24:fb3399713710 884 virtual void _writeByte(int value);
Sissors 24:fb3399713710 885
Sissors 24:fb3399713710 886 // SPI bus
Sissors 24:fb3399713710 887 SPI *_spi;
Sissors 24:fb3399713710 888 DigitalOut _cs;
Sissors 24:fb3399713710 889 DigitalOut _rs;
wim 30:033048611c01 890
wim 30:033048611c01 891 //Backlight
Sissors 24:fb3399713710 892 DigitalOut *_bl;
Sissors 24:fb3399713710 893 };
wim 34:e5a0dcb43ecc 894 #endif /* Native SPI bus */
wim 25:6162b31128c9 895 //---------- End TextLCD_SPI_N ------------
Sissors 24:fb3399713710 896
wim 26:bd897a001012 897
wim 36:9f5f86dfd44a 898 //-------- Start TextLCD_SPI_N_3_8 --------
wim 36:9f5f86dfd44a 899 #if(LCD_SPI_N_3_8 == 1) /* Native SPI bus */
wim 37:ce348c002929 900 /** Create a TextLCD interface using a controller with native SPI3 8 bits interface
wim 37:ce348c002929 901 * This mode is supported by ST7070.
wim 37:ce348c002929 902 *
wim 37:ce348c002929 903 */
wim 36:9f5f86dfd44a 904 class TextLCD_SPI_N_3_8 : public TextLCD_Base {
wim 36:9f5f86dfd44a 905 public:
wim 36:9f5f86dfd44a 906 /** Create a TextLCD interface using a controller with a native SPI3 8 bits interface
wim 36:9f5f86dfd44a 907 * This mode is supported by ST7070. Note that implementation in TexTLCD is not very efficient due to
wim 36:9f5f86dfd44a 908 * structure of the TextLCD library: each databyte is written separately and requires a separate 'count command' set to 1 byte.
wim 36:9f5f86dfd44a 909 *
wim 36:9f5f86dfd44a 910 * @param spi SPI Bus
wim 36:9f5f86dfd44a 911 * @param cs chip select pin (active low)
wim 36:9f5f86dfd44a 912 * @param type Sets the panel size/addressing mode (default = LCD16x2)
wim 36:9f5f86dfd44a 913 * @param bl Backlight control line (optional, default = NC)
wim 36:9f5f86dfd44a 914 * @param ctrl LCD controller (default = ST7070)
wim 36:9f5f86dfd44a 915 */
wim 36:9f5f86dfd44a 916 TextLCD_SPI_N_3_8(SPI *spi, PinName cs, LCDType type = LCD16x2, PinName bl = NC, LCDCtrl ctrl = ST7070);
wim 36:9f5f86dfd44a 917
wim 37:ce348c002929 918 /** Destruct a TextLCD interface using a controller with native SPI3_8 interface
wim 37:ce348c002929 919 */
wim 36:9f5f86dfd44a 920 virtual ~TextLCD_SPI_N_3_8(void);
wim 36:9f5f86dfd44a 921
wim 36:9f5f86dfd44a 922 private:
wim 36:9f5f86dfd44a 923
wim 36:9f5f86dfd44a 924 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 36:9f5f86dfd44a 925 * Set the Enable pin.
wim 36:9f5f86dfd44a 926 */
wim 36:9f5f86dfd44a 927 virtual void _setEnable(bool value);
wim 36:9f5f86dfd44a 928
wim 36:9f5f86dfd44a 929 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 36:9f5f86dfd44a 930 * Set the RS pin (0 = Command, 1 = Data).
wim 36:9f5f86dfd44a 931 */
wim 36:9f5f86dfd44a 932 virtual void _setRS(bool value);
wim 36:9f5f86dfd44a 933
wim 36:9f5f86dfd44a 934 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 36:9f5f86dfd44a 935 * Set the BL pin (0 = Backlight Off, 1 = Backlight On).
wim 36:9f5f86dfd44a 936 */
wim 36:9f5f86dfd44a 937 virtual void _setBL(bool value);
wim 36:9f5f86dfd44a 938
wim 36:9f5f86dfd44a 939 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 36:9f5f86dfd44a 940 * Set the databus value (4 bit).
wim 36:9f5f86dfd44a 941 */
wim 36:9f5f86dfd44a 942 virtual void _setData(int value);
wim 36:9f5f86dfd44a 943
wim 36:9f5f86dfd44a 944 /** Low level writes to LCD serial bus only (serial native)
wim 36:9f5f86dfd44a 945 */
wim 36:9f5f86dfd44a 946 virtual void _writeByte(int value);
wim 36:9f5f86dfd44a 947
wim 36:9f5f86dfd44a 948 // SPI bus
wim 36:9f5f86dfd44a 949 SPI *_spi;
wim 36:9f5f86dfd44a 950 DigitalOut _cs;
wim 36:9f5f86dfd44a 951
wim 37:ce348c002929 952 // controlbyte to select between data and command. Internal shadow value for serial bus only
wim 36:9f5f86dfd44a 953 char _controlbyte;
wim 36:9f5f86dfd44a 954
wim 36:9f5f86dfd44a 955 //Backlight
wim 36:9f5f86dfd44a 956 DigitalOut *_bl;
wim 36:9f5f86dfd44a 957 };
wim 36:9f5f86dfd44a 958
wim 36:9f5f86dfd44a 959 #endif /* Native SPI bus */
wim 36:9f5f86dfd44a 960 //------- End TextLCD_SPI_N_3_8 -----------
wim 36:9f5f86dfd44a 961
wim 36:9f5f86dfd44a 962
wim 34:e5a0dcb43ecc 963 //------- Start TextLCD_SPI_N_3_9 ---------
wim 34:e5a0dcb43ecc 964 #if(LCD_SPI_N_3_9 == 1) /* Native SPI bus */
wim 30:033048611c01 965 //Code checked out on logic analyser. Not yet tested on hardware..
wim 30:033048611c01 966
wim 30:033048611c01 967 /** Create a TextLCD interface using a controller with native SPI3 9 bits interface
wim 30:033048611c01 968 * Note: current mbed libs only support SPI 9 bit mode for NXP platforms
wim 30:033048611c01 969 *
wim 30:033048611c01 970 */
wim 30:033048611c01 971 class TextLCD_SPI_N_3_9 : public TextLCD_Base {
wim 30:033048611c01 972 public:
wim 30:033048611c01 973 /** Create a TextLCD interface using a controller with native SPI3 9 bits interface
wim 30:033048611c01 974 * Note: current mbed libs only support SPI 9 bit mode for NXP platforms
wim 30:033048611c01 975 *
wim 30:033048611c01 976 * @param spi SPI Bus
wim 30:033048611c01 977 * @param cs chip select pin (active low)
wim 30:033048611c01 978 * @param type Sets the panel size/addressing mode (default = LCD16x2)
wim 30:033048611c01 979 * @param bl Backlight control line (optional, default = NC)
wim 30:033048611c01 980 * @param ctrl LCD controller (default = AIP31068)
wim 30:033048611c01 981 */
wim 30:033048611c01 982 TextLCD_SPI_N_3_9(SPI *spi, PinName cs, LCDType type = LCD16x2, PinName bl = NC, LCDCtrl ctrl = AIP31068);
wim 37:ce348c002929 983
wim 37:ce348c002929 984 /** Destruct a TextLCD interface using a controller with native SPI3_9 interface
wim 37:ce348c002929 985 */
wim 30:033048611c01 986 virtual ~TextLCD_SPI_N_3_9(void);
wim 30:033048611c01 987
wim 30:033048611c01 988 private:
wim 30:033048611c01 989
wim 30:033048611c01 990 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 30:033048611c01 991 * Set the Enable pin.
wim 30:033048611c01 992 */
wim 30:033048611c01 993 virtual void _setEnable(bool value);
wim 30:033048611c01 994
wim 30:033048611c01 995 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 32:59c4b8f648d4 996 * Set the RS pin (0 = Command, 1 = Data).
wim 32:59c4b8f648d4 997 */
wim 32:59c4b8f648d4 998 virtual void _setRS(bool value);
wim 32:59c4b8f648d4 999
wim 32:59c4b8f648d4 1000 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 32:59c4b8f648d4 1001 * Set the BL pin (0 = Backlight Off, 1 = Backlight On).
wim 32:59c4b8f648d4 1002 */
wim 32:59c4b8f648d4 1003 virtual void _setBL(bool value);
wim 32:59c4b8f648d4 1004
wim 32:59c4b8f648d4 1005 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 32:59c4b8f648d4 1006 * Set the databus value (4 bit).
wim 32:59c4b8f648d4 1007 */
wim 32:59c4b8f648d4 1008 virtual void _setData(int value);
wim 32:59c4b8f648d4 1009
wim 32:59c4b8f648d4 1010 /** Low level writes to LCD serial bus only (serial native)
wim 32:59c4b8f648d4 1011 */
wim 32:59c4b8f648d4 1012 virtual void _writeByte(int value);
wim 32:59c4b8f648d4 1013
wim 32:59c4b8f648d4 1014 // SPI bus
wim 32:59c4b8f648d4 1015 SPI *_spi;
wim 32:59c4b8f648d4 1016 DigitalOut _cs;
wim 32:59c4b8f648d4 1017
wim 37:ce348c002929 1018 // controlbyte to select between data and command. Internal shadow value for serial bus only
wim 32:59c4b8f648d4 1019 char _controlbyte;
wim 32:59c4b8f648d4 1020
wim 32:59c4b8f648d4 1021 //Backlight
wim 32:59c4b8f648d4 1022 DigitalOut *_bl;
wim 32:59c4b8f648d4 1023 };
wim 34:e5a0dcb43ecc 1024 #endif /* Native SPI bus */
wim 32:59c4b8f648d4 1025 //-------- End TextLCD_SPI_N_3_9 ----------
wim 32:59c4b8f648d4 1026
wim 32:59c4b8f648d4 1027
wim 32:59c4b8f648d4 1028 //------- Start TextLCD_SPI_N_3_10 ---------
wim 34:e5a0dcb43ecc 1029 #if(LCD_SPI_N_3_10 == 1) /* Native SPI bus */
wim 32:59c4b8f648d4 1030
wim 32:59c4b8f648d4 1031 /** Create a TextLCD interface using a controller with native SPI3 10 bits interface
wim 32:59c4b8f648d4 1032 * Note: current mbed libs only support SPI 10 bit mode for NXP platforms
wim 32:59c4b8f648d4 1033 *
wim 32:59c4b8f648d4 1034 */
wim 32:59c4b8f648d4 1035 class TextLCD_SPI_N_3_10 : public TextLCD_Base {
wim 32:59c4b8f648d4 1036 public:
wim 32:59c4b8f648d4 1037 /** Create a TextLCD interface using a controller with native SPI3 10 bits interface
wim 32:59c4b8f648d4 1038 * Note: current mbed libs only support SPI 10 bit mode for NXP platforms
wim 32:59c4b8f648d4 1039 *
wim 32:59c4b8f648d4 1040 * @param spi SPI Bus
wim 32:59c4b8f648d4 1041 * @param cs chip select pin (active low)
wim 32:59c4b8f648d4 1042 * @param type Sets the panel size/addressing mode (default = LCD16x2)
wim 32:59c4b8f648d4 1043 * @param bl Backlight control line (optional, default = NC)
wim 32:59c4b8f648d4 1044 * @param ctrl LCD controller (default = AIP31068)
wim 32:59c4b8f648d4 1045 */
wim 32:59c4b8f648d4 1046 TextLCD_SPI_N_3_10(SPI *spi, PinName cs, LCDType type = LCD16x2, PinName bl = NC, LCDCtrl ctrl = AIP31068);
wim 37:ce348c002929 1047
wim 37:ce348c002929 1048 /** Destruct a TextLCD interface using a controller with native SPI3_10 interface
wim 37:ce348c002929 1049 */
wim 32:59c4b8f648d4 1050 virtual ~TextLCD_SPI_N_3_10(void);
wim 32:59c4b8f648d4 1051
wim 32:59c4b8f648d4 1052 private:
wim 32:59c4b8f648d4 1053
wim 32:59c4b8f648d4 1054 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 32:59c4b8f648d4 1055 * Set the Enable pin.
wim 32:59c4b8f648d4 1056 */
wim 32:59c4b8f648d4 1057 virtual void _setEnable(bool value);
wim 32:59c4b8f648d4 1058
wim 32:59c4b8f648d4 1059 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 32:59c4b8f648d4 1060 * Set the RS pin (0 = Command, 1 = Data).
wim 32:59c4b8f648d4 1061 */
wim 32:59c4b8f648d4 1062 virtual void _setRS(bool value);
wim 32:59c4b8f648d4 1063
wim 32:59c4b8f648d4 1064 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 32:59c4b8f648d4 1065 * Set the BL pin (0 = Backlight Off, 1 = Backlight On).
wim 32:59c4b8f648d4 1066 */
wim 32:59c4b8f648d4 1067 virtual void _setBL(bool value);
wim 32:59c4b8f648d4 1068
wim 32:59c4b8f648d4 1069 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 32:59c4b8f648d4 1070 * Set the databus value (4 bit).
wim 32:59c4b8f648d4 1071 */
wim 32:59c4b8f648d4 1072 virtual void _setData(int value);
wim 32:59c4b8f648d4 1073
wim 32:59c4b8f648d4 1074 /** Low level writes to LCD serial bus only (serial native)
wim 32:59c4b8f648d4 1075 */
wim 32:59c4b8f648d4 1076 virtual void _writeByte(int value);
wim 32:59c4b8f648d4 1077
wim 32:59c4b8f648d4 1078 // SPI bus
wim 32:59c4b8f648d4 1079 SPI *_spi;
wim 32:59c4b8f648d4 1080 DigitalOut _cs;
wim 36:9f5f86dfd44a 1081
wim 37:ce348c002929 1082 // controlbyte to select between data and command. Internal shadow value for serial bus only
wim 32:59c4b8f648d4 1083 char _controlbyte;
wim 32:59c4b8f648d4 1084
wim 32:59c4b8f648d4 1085 //Backlight
wim 32:59c4b8f648d4 1086 DigitalOut *_bl;
wim 32:59c4b8f648d4 1087 };
wim 32:59c4b8f648d4 1088
wim 34:e5a0dcb43ecc 1089 #endif /* Native SPI bus */
wim 32:59c4b8f648d4 1090 //-------- End TextLCD_SPI_N_3_10 ----------
wim 32:59c4b8f648d4 1091
wim 32:59c4b8f648d4 1092
wim 32:59c4b8f648d4 1093 //------- Start TextLCD_SPI_N_3_16 ---------
wim 34:e5a0dcb43ecc 1094 #if(LCD_SPI_N_3_16 == 1) /* Native SPI bus */
wim 32:59c4b8f648d4 1095
wim 32:59c4b8f648d4 1096 /** Create a TextLCD interface using a controller with native SPI3 16 bits interface
wim 32:59c4b8f648d4 1097 *
wim 32:59c4b8f648d4 1098 */
wim 32:59c4b8f648d4 1099 class TextLCD_SPI_N_3_16 : public TextLCD_Base {
wim 32:59c4b8f648d4 1100 public:
wim 32:59c4b8f648d4 1101 /** Create a TextLCD interface using a controller with native SPI3 16 bits interface
wim 32:59c4b8f648d4 1102 *
wim 32:59c4b8f648d4 1103 * @param spi SPI Bus
wim 32:59c4b8f648d4 1104 * @param cs chip select pin (active low)
wim 32:59c4b8f648d4 1105 * @param type Sets the panel size/addressing mode (default = LCD16x2)
wim 32:59c4b8f648d4 1106 * @param bl Backlight control line (optional, default = NC)
wim 32:59c4b8f648d4 1107 * @param ctrl LCD controller (default = PT6314)
wim 32:59c4b8f648d4 1108 */
wim 32:59c4b8f648d4 1109 TextLCD_SPI_N_3_16(SPI *spi, PinName cs, LCDType type = LCD16x2, PinName bl = NC, LCDCtrl ctrl = PT6314);
wim 37:ce348c002929 1110
wim 37:ce348c002929 1111 /** Destruct a TextLCD interface using a controller with native SPI3_16 interface
wim 37:ce348c002929 1112 */
wim 32:59c4b8f648d4 1113 virtual ~TextLCD_SPI_N_3_16(void);
wim 32:59c4b8f648d4 1114
wim 32:59c4b8f648d4 1115 private:
wim 32:59c4b8f648d4 1116
wim 32:59c4b8f648d4 1117 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 32:59c4b8f648d4 1118 * Set the Enable pin.
wim 32:59c4b8f648d4 1119 */
wim 32:59c4b8f648d4 1120 virtual void _setEnable(bool value);
wim 32:59c4b8f648d4 1121
wim 32:59c4b8f648d4 1122 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 32:59c4b8f648d4 1123 * Set the RS pin (0 = Command, 1 = Data).
wim 30:033048611c01 1124 */
wim 30:033048611c01 1125 virtual void _setRS(bool value);
wim 30:033048611c01 1126
wim 30:033048611c01 1127 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 30:033048611c01 1128 * Set the BL pin (0 = Backlight Off, 1 = Backlight On).
wim 30:033048611c01 1129 */
wim 30:033048611c01 1130 virtual void _setBL(bool value);
wim 30:033048611c01 1131
wim 30:033048611c01 1132 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 30:033048611c01 1133 * Set the databus value (4 bit).
wim 30:033048611c01 1134 */
wim 30:033048611c01 1135 virtual void _setData(int value);
wim 30:033048611c01 1136
wim 30:033048611c01 1137 /** Low level writes to LCD serial bus only (serial native)
wim 30:033048611c01 1138 */
wim 30:033048611c01 1139 virtual void _writeByte(int value);
wim 30:033048611c01 1140
wim 30:033048611c01 1141 // SPI bus
wim 30:033048611c01 1142 SPI *_spi;
wim 30:033048611c01 1143 DigitalOut _cs;
wim 30:033048611c01 1144
wim 37:ce348c002929 1145 // controlbyte to select between data and command. Internal shadow value for serial bus only
wim 30:033048611c01 1146 char _controlbyte;
wim 30:033048611c01 1147
wim 30:033048611c01 1148 //Backlight
wim 30:033048611c01 1149 DigitalOut *_bl;
wim 30:033048611c01 1150 };
wim 34:e5a0dcb43ecc 1151 #endif /* Native SPI bus */
wim 32:59c4b8f648d4 1152 //-------- End TextLCD_SPI_N_3_16 ----------
wim 34:e5a0dcb43ecc 1153
wim 30:033048611c01 1154
wim 32:59c4b8f648d4 1155 //------- Start TextLCD_SPI_N_3_24 ---------
wim 34:e5a0dcb43ecc 1156 #if(LCD_SPI_N_3_24 == 1) /* Native SPI bus */
wim 30:033048611c01 1157
wim 32:59c4b8f648d4 1158 /** Create a TextLCD interface using a controller with native SPI3 24 bits interface
wim 32:59c4b8f648d4 1159 * Note: lib uses SPI 8 bit mode
wim 30:033048611c01 1160 *
wim 30:033048611c01 1161 */
wim 32:59c4b8f648d4 1162 class TextLCD_SPI_N_3_24 : public TextLCD_Base {
wim 30:033048611c01 1163 public:
wim 32:59c4b8f648d4 1164 /** Create a TextLCD interface using a controller with native SPI3 24 bits interface
wim 32:59c4b8f648d4 1165 * Note: lib uses SPI 8 bit mode
wim 30:033048611c01 1166 *
wim 30:033048611c01 1167 * @param spi SPI Bus
wim 30:033048611c01 1168 * @param cs chip select pin (active low)
wim 30:033048611c01 1169 * @param type Sets the panel size/addressing mode (default = LCD16x2)
wim 30:033048611c01 1170 * @param bl Backlight control line (optional, default = NC)
wim 32:59c4b8f648d4 1171 * @param ctrl LCD controller (default = SSD1803)
wim 30:033048611c01 1172 */
wim 32:59c4b8f648d4 1173 TextLCD_SPI_N_3_24(SPI *spi, PinName cs, LCDType type = LCD16x2, PinName bl = NC, LCDCtrl ctrl = SSD1803_3V3);
wim 37:ce348c002929 1174
wim 37:ce348c002929 1175 /** Destruct a TextLCD interface using a controller with native SPI3_24 interface
wim 37:ce348c002929 1176 */
wim 32:59c4b8f648d4 1177 virtual ~TextLCD_SPI_N_3_24(void);
wim 30:033048611c01 1178
wim 30:033048611c01 1179 private:
wim 30:033048611c01 1180
wim 30:033048611c01 1181 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 30:033048611c01 1182 * Set the Enable pin.
wim 30:033048611c01 1183 */
wim 30:033048611c01 1184 virtual void _setEnable(bool value);
wim 30:033048611c01 1185
wim 30:033048611c01 1186 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 32:59c4b8f648d4 1187 * Set the RS pin (0 = Command, 1 = Data).
wim 30:033048611c01 1188 */
wim 30:033048611c01 1189 virtual void _setRS(bool value);
wim 30:033048611c01 1190
wim 30:033048611c01 1191 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 30:033048611c01 1192 * Set the BL pin (0 = Backlight Off, 1 = Backlight On).
wim 30:033048611c01 1193 */
wim 30:033048611c01 1194 virtual void _setBL(bool value);
wim 30:033048611c01 1195
wim 30:033048611c01 1196 /** Implementation of pure Virtual Low level writes to LCD Bus (serial native)
wim 30:033048611c01 1197 * Set the databus value (4 bit).
wim 30:033048611c01 1198 */
wim 30:033048611c01 1199 virtual void _setData(int value);
wim 30:033048611c01 1200
wim 30:033048611c01 1201 /** Low level writes to LCD serial bus only (serial native)
wim 30:033048611c01 1202 */
wim 30:033048611c01 1203 virtual void _writeByte(int value);
wim 30:033048611c01 1204
wim 30:033048611c01 1205 // SPI bus
wim 30:033048611c01 1206 SPI *_spi;
wim 30:033048611c01 1207 DigitalOut _cs;
wim 30:033048611c01 1208
wim 30:033048611c01 1209 // controlbyte to select between data and command. Internal value for serial bus only
wim 30:033048611c01 1210 char _controlbyte;
wim 30:033048611c01 1211
wim 30:033048611c01 1212 //Backlight
wim 30:033048611c01 1213 DigitalOut *_bl;
wim 30:033048611c01 1214 };
wim 34:e5a0dcb43ecc 1215 #endif /* Native SPI bus */
wim 32:59c4b8f648d4 1216 //-------- End TextLCD_SPI_N_3_24 ----------
wim 30:033048611c01 1217
simon 1:ac48b187213c 1218 #endif