i2c'li lcd ekran Mehmet Akif ARVAS

Committer:
wim
Date:
Wed Feb 20 19:37:53 2013 +0000
Revision:
16:c276b75e6585
Parent:
15:b70ebfffb258
Child:
17:652ab113bc2e
Cleaned up and Commented

Who changed what in which revision?

UserRevisionLine numberNew contents of line
simon 1:ac48b187213c 1 /* mbed TextLCD Library, for a 4-bit LCD based on HD44780
simon 6:e4cb7ddee0d3 2 * Copyright (c) 2007-2010, sford, http://mbed.org
wim 13:24506ba22480 3 * 2013, v01: WH, Added LCD types, fixed LCD address issues, added Cursor and UDCs
wim 15:b70ebfffb258 4 * 2013, v02: WH, Added I2C and SPI bus interfaces
wim 15:b70ebfffb258 5 * 2013, v03: WH, Added support for LCD40x4 which uses 2 controllers
simon 1:ac48b187213c 6 *
simon 1:ac48b187213c 7 * Permission is hereby granted, free of charge, to any person obtaining a copy
simon 1:ac48b187213c 8 * of this software and associated documentation files (the "Software"), to deal
simon 1:ac48b187213c 9 * in the Software without restriction, including without limitation the rights
simon 1:ac48b187213c 10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
simon 1:ac48b187213c 11 * copies of the Software, and to permit persons to whom the Software is
simon 1:ac48b187213c 12 * furnished to do so, subject to the following conditions:
simon 2:227356c7d12c 13 *
simon 1:ac48b187213c 14 * The above copyright notice and this permission notice shall be included in
simon 1:ac48b187213c 15 * all copies or substantial portions of the Software.
simon 2:227356c7d12c 16 *
simon 1:ac48b187213c 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
simon 1:ac48b187213c 18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
simon 1:ac48b187213c 19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
simon 1:ac48b187213c 20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
simon 1:ac48b187213c 21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
simon 1:ac48b187213c 22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
simon 1:ac48b187213c 23 * THE SOFTWARE.
simon 1:ac48b187213c 24 */
simon 1:ac48b187213c 25
simon 1:ac48b187213c 26 #ifndef MBED_TEXTLCD_H
simon 1:ac48b187213c 27 #define MBED_TEXTLCD_H
simon 1:ac48b187213c 28
simon 1:ac48b187213c 29 #include "mbed.h"
simon 2:227356c7d12c 30
wim 15:b70ebfffb258 31
simon 5:a53b3e2d6f1e 32 /** A TextLCD interface for driving 4-bit HD44780-based LCDs
simon 2:227356c7d12c 33 *
wim 16:c276b75e6585 34 * Currently supports 8x1, 8x2, 12x4, 16x1, 16x2, 16x4, 20x2, 20x4, 24x2, 24x4, 40x2 and 40x4 panels
wim 16:c276b75e6585 35 * Interface options include direct mbed pins, I2C portexpander (PCF8474) or SPI bus shiftregister (74595)
simon 2:227356c7d12c 36 *
simon 2:227356c7d12c 37 * @code
simon 2:227356c7d12c 38 * #include "mbed.h"
simon 2:227356c7d12c 39 * #include "TextLCD.h"
simon 5:a53b3e2d6f1e 40 *
wim 16:c276b75e6585 41 * // I2C Communication
wim 16:c276b75e6585 42 * I2C i2c_lcd(p28,p27); // SDA, SCL
wim 16:c276b75e6585 43 *
wim 16:c276b75e6585 44 * // SPI Communication
wim 16:c276b75e6585 45 * SPI spi_lcd(p5, NC, p7); // MOSI, MISO, SCLK
wim 16:c276b75e6585 46 *
wim 16:c276b75e6585 47 * TextLCD lcd(p15, p16, p17, p18, p19, p20); // RS, E, D4-D7, LCDType=LCD16x2
wim 16:c276b75e6585 48 * //TextLCD lcd(&spi_lcd, p8, TextLCD::LCD40x4); // SPI bus, CS pin, LCD Type
wim 16:c276b75e6585 49 * //TextLCD lcd(&i2c_lcd, 0x42, TextLCD::LCD20x4); // I2C bus, PCF8574 Slaveaddress, LCD Type
simon 5:a53b3e2d6f1e 50 *
simon 2:227356c7d12c 51 * int main() {
wim 16:c276b75e6585 52 * lcd.printf("Hello World!\n");
simon 2:227356c7d12c 53 * }
simon 2:227356c7d12c 54 * @endcode
simon 2:227356c7d12c 55 */
wim 8:03116f75b66e 56
wim 13:24506ba22480 57
wim 16:c276b75e6585 58 //Pin Defines for I2C PCF8574 and SPI 74595 Bus interfaces
wim 13:24506ba22480 59 //LCD and serial portexpanders should be wired accordingly
wim 13:24506ba22480 60 //Note: LCD RW pin must be connected to GND
wim 15:b70ebfffb258 61 // E2 is used for LCD40x4 (second controller)
wim 13:24506ba22480 62 // BL may be used for future expansion to control backlight
wim 13:24506ba22480 63 //
wim 15:b70ebfffb258 64 #define D_LCD_PIN_D4 0
wim 15:b70ebfffb258 65 #define D_LCD_PIN_D5 1
wim 15:b70ebfffb258 66 #define D_LCD_PIN_D6 2
wim 15:b70ebfffb258 67 #define D_LCD_PIN_D7 3
wim 15:b70ebfffb258 68 #define D_LCD_PIN_RS 4
wim 15:b70ebfffb258 69 #define D_LCD_PIN_E 5
wim 15:b70ebfffb258 70 #define D_LCD_PIN_E2 6
wim 15:b70ebfffb258 71 #define D_LCD_PIN_BL 7
wim 13:24506ba22480 72
wim 13:24506ba22480 73 #define D_LCD_BUS_MSK 0x0F
wim 15:b70ebfffb258 74 #define D_LCD_BUS_DEF 0x00
wim 13:24506ba22480 75
wim 13:24506ba22480 76 //Bitpattern Defines for I2C PCF8574 and SPI 74595 Bus
wim 13:24506ba22480 77 //
wim 13:24506ba22480 78 #define D_LCD_D4 (1<<D_LCD_PIN_D4)
wim 13:24506ba22480 79 #define D_LCD_D5 (1<<D_LCD_PIN_D5)
wim 13:24506ba22480 80 #define D_LCD_D6 (1<<D_LCD_PIN_D6)
wim 13:24506ba22480 81 #define D_LCD_D7 (1<<D_LCD_PIN_D7)
wim 13:24506ba22480 82 #define D_LCD_RS (1<<D_LCD_PIN_RS)
wim 13:24506ba22480 83 #define D_LCD_E (1<<D_LCD_PIN_E)
wim 13:24506ba22480 84 #define D_LCD_E2 (1<<D_LCD_PIN_E2)
wim 13:24506ba22480 85 #define D_LCD_BL (1<<D_LCD_PIN_BL)
wim 13:24506ba22480 86
wim 13:24506ba22480 87
wim 13:24506ba22480 88
wim 13:24506ba22480 89 /** Some sample User Defined Chars 5x7 dots */
wim 11:9ec02df863a1 90 const char udc_ae[] = {0x00, 0x00, 0x1B, 0x05, 0x1F, 0x14, 0x1F, 0x00}; //æ
wim 11:9ec02df863a1 91 const char udc_0e[] = {0x00, 0x00, 0x0E, 0x13, 0x15, 0x19, 0x0E, 0x00}; //ø
wim 11:9ec02df863a1 92 const char udc_ao[] = {0x0E, 0x0A, 0x0E, 0x01, 0x0F, 0x11, 0x0F, 0x00}; //å
wim 11:9ec02df863a1 93 const char udc_AE[] = {0x0F, 0x14, 0x14, 0x1F, 0x14, 0x14, 0x17, 0x00}; //Æ
wim 11:9ec02df863a1 94 const char udc_0E[] = {0x0E, 0x13, 0x15, 0x15, 0x15, 0x19, 0x0E, 0x00}; //Ø
wim 11:9ec02df863a1 95 const char udc_AA[] = {0x0E, 0x0A, 0x0E, 0x11, 0x1F, 0x11, 0x11, 0x00}; //Å
wim 11:9ec02df863a1 96
wim 11:9ec02df863a1 97 const char udc_0[] = {0x18, 0x14, 0x12, 0x11, 0x12, 0x14, 0x18, 0x00}; // |>
wim 11:9ec02df863a1 98 const char udc_1[] = {0x03, 0x05, 0x09, 0x11, 0x09, 0x05, 0x03, 0x00}; // <|
wim 11:9ec02df863a1 99 const char udc_2[] = {0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00}; // |
wim 11:9ec02df863a1 100 const char udc_3[] = {0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x14, 0x00}; // ||
wim 11:9ec02df863a1 101 const char udc_4[] = {0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x00}; // |||
wim 11:9ec02df863a1 102 const char udc_5[] = {0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x00}; // =
wim 11:9ec02df863a1 103 const char udc_6[] = {0x15, 0x0a, 0x15, 0x0a, 0x15, 0x0a, 0x15, 0x00}; // checkerboard
wim 11:9ec02df863a1 104 const char udc_7[] = {0x10, 0x08, 0x04, 0x02, 0x01, 0x00, 0x10, 0x00}; // \
wim 11:9ec02df863a1 105
wim 13:24506ba22480 106 const char udc_degr[] = {0x06, 0x09, 0x09, 0x06, 0x00, 0x00, 0x00, 0x00}; // Degree symbol
wim 13:24506ba22480 107
wim 13:24506ba22480 108 const char udc_TM_T[] = {0x1F, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00}; // Trademark T
wim 13:24506ba22480 109 const char udc_TM_M[] = {0x11, 0x1B, 0x15, 0x11, 0x00, 0x00, 0x00, 0x00}; // Trademark M
wim 13:24506ba22480 110
wim 13:24506ba22480 111 //const char udc_Bat_Hi[] = {0x0E, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x00}; // Battery Full
wim 13:24506ba22480 112 //const char udc_Bat_Ha[] = {0x0E, 0x11, 0x13, 0x17, 0x1F, 0x1F, 0x1F, 0x00}; // Battery Half
wim 13:24506ba22480 113 //const char udc_Bat_Lo[] = {0x0E, 0x11, 0x11, 0x11, 0x11, 0x11, 0x1F, 0x00}; // Battery Low
wim 13:24506ba22480 114 const char udc_Bat_Hi[] = {0x0E, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x00}; // Battery Full
wim 13:24506ba22480 115 const char udc_Bat_Ha[] = {0x0E, 0x11, 0x11, 0x1F, 0x1F, 0x1F, 0x1F, 0x00}; // Battery Half
wim 13:24506ba22480 116 const char udc_Bat_Lo[] = {0x0E, 0x11, 0x11, 0x11, 0x11, 0x1F, 0x1F, 0x00}; // Battery Low
wim 13:24506ba22480 117
wim 13:24506ba22480 118 const char udc_bar_1[] = {0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00}; // Bar 1
wim 13:24506ba22480 119 const char udc_bar_2[] = {0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00}; // Bar 11
wim 13:24506ba22480 120 const char udc_bar_3[] = {0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x1C, 0x00}; // Bar 111
wim 13:24506ba22480 121 const char udc_bar_4[] = {0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x17, 0x00}; // Bar 1111
wim 13:24506ba22480 122 const char udc_bar_5[] = {0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x00}; // Bar 11111
wim 13:24506ba22480 123
wim 11:9ec02df863a1 124
wim 11:9ec02df863a1 125 /** A TextLCD interface for driving 4-bit HD44780-based LCDs
wim 11:9ec02df863a1 126 *
wim 16:c276b75e6585 127 * Currently supports 8x1, 8x2, 12x2, 12x4, 16x1, 16x2, 16x4, 20x2, 20x4, 24x2, 24x4, 40x2 and 40x4 panels
wim 11:9ec02df863a1 128 *
wim 11:9ec02df863a1 129 */
simon 1:ac48b187213c 130 class TextLCD : public Stream {
simon 1:ac48b187213c 131 public:
simon 1:ac48b187213c 132
simon 2:227356c7d12c 133 /** LCD panel format */
simon 1:ac48b187213c 134 enum LCDType {
wim 8:03116f75b66e 135 LCD8x1, /**< 8x1 LCD panel */
wim 13:24506ba22480 136 LCD8x2, /**< 8x2 LCD panel */
wim 15:b70ebfffb258 137 LCD12x2, /**< 12x2 LCD panel */
wim 15:b70ebfffb258 138 LCD12x4, /**< 12x4 LCD panel */
wim 13:24506ba22480 139 LCD16x1, /**< 16x1 LCD panel (actually 8x2) */
wim 8:03116f75b66e 140 LCD16x2, /**< 16x2 LCD panel (default) */
wim 8:03116f75b66e 141 LCD16x2B, /**< 16x2 LCD panel alternate addressing */
wim 8:03116f75b66e 142 LCD16x4, /**< 16x4 LCD panel */
wim 8:03116f75b66e 143 LCD20x2, /**< 20x2 LCD panel */
wim 8:03116f75b66e 144 LCD20x4, /**< 20x4 LCD panel */
wim 9:0893d986e717 145 LCD24x2, /**< 24x2 LCD panel */
wim 10:dd9b3a696acd 146 LCD24x4, /**< 24x4 LCD panel, special mode KS0078 */
wim 15:b70ebfffb258 147 LCD40x2, /**< 40x2 LCD panel */
wim 15:b70ebfffb258 148 LCD40x4 /**< 40x4 LCD panel, Two controller version */
simon 1:ac48b187213c 149 };
simon 1:ac48b187213c 150
wim 10:dd9b3a696acd 151 /** LCD Cursor control */
wim 10:dd9b3a696acd 152 enum LCDCursor {
wim 12:6bf9d9957d31 153 CurOff_BlkOff, /**< Cursor Off, Blinking Char Off */
wim 12:6bf9d9957d31 154 CurOn_BlkOff, /**< Cursor On, Blinking Char Off */
wim 12:6bf9d9957d31 155 CurOff_BlkOn, /**< Cursor Off, Blinking Char On */
wim 12:6bf9d9957d31 156 CurOn_BlkOn, /**< Cursor On, Blinking Char On */
wim 10:dd9b3a696acd 157 };
wim 10:dd9b3a696acd 158
wim 10:dd9b3a696acd 159
wim 15:b70ebfffb258 160 /** Create a TextLCD interface for using regular mbed pins
simon 2:227356c7d12c 161 *
simon 2:227356c7d12c 162 * @param rs Instruction/data control line
simon 2:227356c7d12c 163 * @param e Enable line (clock)
simon 7:44f34c09bd37 164 * @param d4-d7 Data lines for using as a 4-bit interface
simon 2:227356c7d12c 165 * @param type Sets the panel size/addressing mode (default = LCD16x2)
wim 15:b70ebfffb258 166 * @param e2 Enable2 line (clock for second controller, LCD40x4 only)
simon 2:227356c7d12c 167 */
wim 15:b70ebfffb258 168 TextLCD(PinName rs, PinName e, PinName d4, PinName d5, PinName d6, PinName d7, LCDType type = LCD16x2, PinName e2 = NC);
wim 13:24506ba22480 169
wim 13:24506ba22480 170 /** Create a TextLCD interface using an I2C PC8574 portexpander
wim 13:24506ba22480 171 *
wim 13:24506ba22480 172 * @param i2c I2C Bus
wim 13:24506ba22480 173 * @param deviceAddress I2C slave address (PCF8574)
wim 13:24506ba22480 174 * @param type Sets the panel size/addressing mode (default = LCD16x2)
wim 13:24506ba22480 175 */
wim 13:24506ba22480 176 TextLCD(I2C *i2c, char deviceAddress, LCDType type = LCD16x2);
wim 13:24506ba22480 177
wim 13:24506ba22480 178
wim 13:24506ba22480 179 /** Create a TextLCD interface using an SPI 74595 portexpander
wim 13:24506ba22480 180 *
wim 13:24506ba22480 181 * @param spi SPI Bus
wim 13:24506ba22480 182 * @param cs chip select pin (active low)
wim 13:24506ba22480 183 * @param type Sets the panel size/addressing mode (default = LCD16x2)
wim 13:24506ba22480 184 */
wim 14:0c32b66b14b8 185 TextLCD(SPI *spi, PinName cs, LCDType type = LCD16x2);
wim 13:24506ba22480 186
simon 2:227356c7d12c 187
simon 2:227356c7d12c 188 #if DOXYGEN_ONLY
simon 2:227356c7d12c 189 /** Write a character to the LCD
simon 2:227356c7d12c 190 *
simon 2:227356c7d12c 191 * @param c The character to write to the display
simon 2:227356c7d12c 192 */
simon 2:227356c7d12c 193 int putc(int c);
simon 2:227356c7d12c 194
simon 2:227356c7d12c 195 /** Write a formated string to the LCD
simon 2:227356c7d12c 196 *
simon 2:227356c7d12c 197 * @param format A printf-style format string, followed by the
simon 2:227356c7d12c 198 * variables to use in formating the string.
simon 2:227356c7d12c 199 */
simon 2:227356c7d12c 200 int printf(const char* format, ...);
simon 2:227356c7d12c 201 #endif
simon 2:227356c7d12c 202
simon 2:227356c7d12c 203 /** Locate to a screen column and row
simon 2:227356c7d12c 204 *
simon 2:227356c7d12c 205 * @param column The horizontal position from the left, indexed from 0
simon 2:227356c7d12c 206 * @param row The vertical position from the top, indexed from 0
simon 2:227356c7d12c 207 */
simon 1:ac48b187213c 208 void locate(int column, int row);
simon 2:227356c7d12c 209
wim 10:dd9b3a696acd 210
wim 10:dd9b3a696acd 211 /** Return the memoryaddress of screen column and row location
wim 10:dd9b3a696acd 212 *
wim 10:dd9b3a696acd 213 * @param column The horizontal position from the left, indexed from 0
wim 10:dd9b3a696acd 214 * @param row The vertical position from the top, indexed from 0
wim 10:dd9b3a696acd 215 * @param return The memoryaddress of screen column and row location
wim 10:dd9b3a696acd 216 */
wim 9:0893d986e717 217 int getAddress(int column, int row);
wim 10:dd9b3a696acd 218
wim 10:dd9b3a696acd 219
wim 10:dd9b3a696acd 220 /** Set the memoryaddress of screen column and row location
wim 10:dd9b3a696acd 221 *
wim 10:dd9b3a696acd 222 * @param column The horizontal position from the left, indexed from 0
wim 10:dd9b3a696acd 223 * @param row The vertical position from the top, indexed from 0
wim 10:dd9b3a696acd 224 */
wim 9:0893d986e717 225 void setAddress(int column, int row);
wim 9:0893d986e717 226
wim 10:dd9b3a696acd 227
simon 2:227356c7d12c 228 /** Clear the screen and locate to 0,0 */
simon 1:ac48b187213c 229 void cls();
simon 2:227356c7d12c 230
wim 10:dd9b3a696acd 231 /** Return the number of rows
wim 10:dd9b3a696acd 232 *
wim 10:dd9b3a696acd 233 * @param return The number of rows
wim 10:dd9b3a696acd 234 */
simon 1:ac48b187213c 235 int rows();
wim 10:dd9b3a696acd 236
wim 10:dd9b3a696acd 237 /** Return the number of columns
wim 10:dd9b3a696acd 238 *
wim 10:dd9b3a696acd 239 * @param return The number of columns
wim 10:dd9b3a696acd 240 */
wim 10:dd9b3a696acd 241 int columns();
simon 2:227356c7d12c 242
wim 11:9ec02df863a1 243 /** Set the Cursormode
wim 11:9ec02df863a1 244 *
wim 11:9ec02df863a1 245 * @param show The Cursor mode (CurOff_BlkOff, CurOn_BlkOff, CurOff_BlkOn, CurOn_BlkOn)
wim 11:9ec02df863a1 246 */
wim 13:24506ba22480 247 void setCursor(LCDCursor show);
wim 11:9ec02df863a1 248
wim 11:9ec02df863a1 249
wim 11:9ec02df863a1 250 /** Set User Defined Characters
wim 11:9ec02df863a1 251 *
wim 11:9ec02df863a1 252 * @param unsigned char c The Index of the UDC (0..7)
wim 12:6bf9d9957d31 253 * @param char *udc_data The bitpatterns for the UDC (8 bytes of 5 significant bits)
wim 11:9ec02df863a1 254 */
wim 11:9ec02df863a1 255 void setUDC(unsigned char c, char *udc_data);
wim 11:9ec02df863a1 256
simon 1:ac48b187213c 257 protected:
wim 14:0c32b66b14b8 258 /* LCD Bus control */
wim 13:24506ba22480 259 enum _LCDBus {
wim 14:0c32b66b14b8 260 _PinBus, /*< Regular mbed pins */
wim 14:0c32b66b14b8 261 _I2CBus, /*< I2C PCF8574 Portexpander */
wim 15:b70ebfffb258 262 _SPIBus /*< SPI 74595 Shiftregister */
wim 13:24506ba22480 263 };
wim 13:24506ba22480 264
wim 15:b70ebfffb258 265 /* LCD controller select, mainly used for LCD40x4 */
wim 15:b70ebfffb258 266 enum _LCDCtrl {
wim 15:b70ebfffb258 267 _LCDCtrl_0, /*< Primary */
wim 15:b70ebfffb258 268 _LCDCtrl_1, /*< Secondary */
wim 15:b70ebfffb258 269 };
wim 15:b70ebfffb258 270
simon 1:ac48b187213c 271 // Stream implementation functions
simon 1:ac48b187213c 272 virtual int _putc(int value);
simon 1:ac48b187213c 273 virtual int _getc();
simon 1:ac48b187213c 274
wim 15:b70ebfffb258 275 //Low level methods for LCD controller
wim 13:24506ba22480 276 void _init();
wim 15:b70ebfffb258 277 void _initCtrl();
wim 13:24506ba22480 278 int _address(int column, int row);
wim 15:b70ebfffb258 279 void _setCursor(TextLCD::LCDCursor show);
wim 15:b70ebfffb258 280 void _setUDC(unsigned char c, char *udc_data);
wim 13:24506ba22480 281
wim 15:b70ebfffb258 282 //Low level write operations to LCD controller
wim 15:b70ebfffb258 283 void _writeByte(int value);
wim 15:b70ebfffb258 284 void _writeCommand(int command);
wim 15:b70ebfffb258 285 void _writeData(int data);
wim 15:b70ebfffb258 286
wim 13:24506ba22480 287 //Low level writes to LCD Bus (serial or parallel)
wim 13:24506ba22480 288 void _setEnable(bool value);
wim 13:24506ba22480 289 void _setRS(bool value);
wim 13:24506ba22480 290 void _setData(int value);
wim 14:0c32b66b14b8 291 void _setCS(bool value);
wim 14:0c32b66b14b8 292
wim 13:24506ba22480 293 //Low level writes to LCD serial bus only
wim 13:24506ba22480 294 void _writeBus();
wim 13:24506ba22480 295
wim 13:24506ba22480 296
wim 13:24506ba22480 297 // Regular mbed pins bus
wim 15:b70ebfffb258 298 DigitalOut _rs, _e, _e2;
simon 1:ac48b187213c 299 BusOut _d;
wim 13:24506ba22480 300
wim 13:24506ba22480 301 // I2C bus
wim 13:24506ba22480 302 I2C *_i2c;
wim 13:24506ba22480 303 unsigned char _slaveAddress;
wim 13:24506ba22480 304
wim 13:24506ba22480 305 // SPI bus
wim 14:0c32b66b14b8 306 SPI *_spi;
wim 14:0c32b66b14b8 307 DigitalOut _cs;
wim 13:24506ba22480 308
wim 13:24506ba22480 309 //Bus Interface type
wim 13:24506ba22480 310 _LCDBus _busType;
wim 13:24506ba22480 311
wim 15:b70ebfffb258 312 // Internal bus mirror value for serial bus only
wim 13:24506ba22480 313 char _lcd_bus;
wim 13:24506ba22480 314
wim 13:24506ba22480 315 //Display type
simon 1:ac48b187213c 316 LCDType _type;
simon 1:ac48b187213c 317
wim 15:b70ebfffb258 318 //Controller select, mainly used for LCD40x4
wim 15:b70ebfffb258 319 _LCDCtrl _ctrl;
wim 15:b70ebfffb258 320
wim 13:24506ba22480 321 // Cursor
simon 1:ac48b187213c 322 int _column;
simon 1:ac48b187213c 323 int _row;
wim 15:b70ebfffb258 324 LCDCursor _currentCursor;
simon 1:ac48b187213c 325 };
simon 1:ac48b187213c 326
simon 1:ac48b187213c 327 #endif