Pantalla LCD

Dependencies:   mbed TextLCD

Committer:
jhonlopez
Date:
Sun May 26 17:55:58 2019 +0000
Revision:
0:531dcadb7c20
Programa pantalla LCD

Who changed what in which revision?

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