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