Projeto Mecatrônico - 2020 - G3 / Pipetagem_automatica
Committer:
terhorst
Date:
Mon Jun 29 13:38:32 2020 +0000
Revision:
0:574336532869
Projeto Final

Who changed what in which revision?

UserRevisionLine numberNew contents of line
terhorst 0:574336532869 1 /* mbed TextLCD Library, for LCDs based on HD44780 controllers
terhorst 0:574336532869 2 * Copyright (c) 2014, WH
terhorst 0:574336532869 3 * 2014, v01: WH, Extracted from TextLCD.h as of v14
terhorst 0:574336532869 4 * 2014, v02: WH, Added AC780 support, added I2C expander modules, fixed setBacklight() for inverted logic modules. Fixed bug in LCD_SPI_N define
terhorst 0:574336532869 5 * 2014, v03: WH, Added LCD_SPI_N_3_8 define for ST7070
terhorst 0:574336532869 6 * 2015, v04: WH, Added support for alternative fonttables (eg PCF21XX)
terhorst 0:574336532869 7 * 2015, v05: WH, Clean up low-level _writeCommand() and _writeData(), Added support for alt fonttables (eg PCF21XX), Added ST7066_ACM for ACM1602 module, fixed contrast for ST7032
terhorst 0:574336532869 8 * 2015, v06: WH, Performance improvement I2C portexpander
terhorst 0:574336532869 9 * 2015, v07: WH, Fixed Adafruit I2C/SPI portexpander pinmappings, fixed SYDZ Backlight
terhorst 0:574336532869 10 * 2015, v08: WH, Added defines to reduce memory footprint (eg LCD_ICON), added some I2C portexpander defines
terhorst 0:574336532869 11 * 2015, v09: WH, Added defines to reduce memory footprint (LCD_TWO_CTRL, LCD_CONTRAST, LCD_UTF8_FONT),
terhorst 0:574336532869 12 * Added UTF8_2_LCD decode for Cyrilic font (By Andriy Ribalko). Added setFont()
terhorst 0:574336532869 13 *
terhorst 0:574336532869 14 * Permission is hereby granted, free of charge, to any person obtaining a copy
terhorst 0:574336532869 15 * of this software and associated documentation files (the "Software"), to deal
terhorst 0:574336532869 16 * in the Software without restriction, including without limitation the rights
terhorst 0:574336532869 17 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
terhorst 0:574336532869 18 * copies of the Software, and to permit persons to whom the Software is
terhorst 0:574336532869 19 * furnished to do so, subject to the following conditions:
terhorst 0:574336532869 20 *
terhorst 0:574336532869 21 * The above copyright notice and this permission notice shall be included in
terhorst 0:574336532869 22 * all copies or substantial portions of the Software.
terhorst 0:574336532869 23 *
terhorst 0:574336532869 24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
terhorst 0:574336532869 25 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
terhorst 0:574336532869 26 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
terhorst 0:574336532869 27 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
terhorst 0:574336532869 28 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
terhorst 0:574336532869 29 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
terhorst 0:574336532869 30 * THE SOFTWARE.
terhorst 0:574336532869 31 */
terhorst 0:574336532869 32 #ifndef MBED_TEXTLCDCONFIG_H
terhorst 0:574336532869 33 #define MBED_TEXTLCDCONFIG_H
terhorst 0:574336532869 34
terhorst 0:574336532869 35 //Select hardware interface options to reduce memory footprint (multiple options allowed)
terhorst 0:574336532869 36 #define LCD_I2C 1 /* I2C Expander PCF8574/MCP23008 */
terhorst 0:574336532869 37 #define LCD_SPI 1 /* SPI Expander SN74595 */
terhorst 0:574336532869 38 #define LCD_I2C_N 1 /* Native I2C bus */
terhorst 0:574336532869 39 #define LCD_SPI_N 1 /* Native SPI bus */
terhorst 0:574336532869 40 #define LCD_SPI_N_3_8 1 /* Native SPI bus */
terhorst 0:574336532869 41 #define LCD_SPI_N_3_9 1 /* Native SPI bus */
terhorst 0:574336532869 42 #define LCD_SPI_N_3_10 1 /* Native SPI bus */
terhorst 0:574336532869 43 #define LCD_SPI_N_3_16 1 /* Native SPI bus */
terhorst 0:574336532869 44 #define LCD_SPI_N_3_24 1 /* Native SPI bus */
terhorst 0:574336532869 45
terhorst 0:574336532869 46 //Select options to reduce memory footprint (multiple options allowed)
terhorst 0:574336532869 47 #define LCD_UDC 1 /* Enable predefined UDC example*/
terhorst 0:574336532869 48 #define LCD_PRINTF 1 /* Enable Stream implementation */
terhorst 0:574336532869 49 #define LCD_ICON 1 /* Enable Icon implementation -2.0K codesize*/
terhorst 0:574336532869 50 #define LCD_ORIENT 1 /* Enable Orientation switch implementation -0.9K codesize*/
terhorst 0:574336532869 51 #define LCD_BIGFONT 1 /* Enable Big Font implementation -0.6K codesize */
terhorst 0:574336532869 52 #define LCD_INVERT 1 /* Enable display Invert implementation -0.5K codesize*/
terhorst 0:574336532869 53 #define LCD_POWER 1 /* Enable Power control implementation -0.1K codesize*/
terhorst 0:574336532869 54 #define LCD_BLINK 1 /* Enable UDC and Icon Blink control implementation -0.8K codesize*/
terhorst 0:574336532869 55 #define LCD_CONTRAST 1 /* Enable Contrast control implementation -0.9K codesize*/
terhorst 0:574336532869 56 #define LCD_TWO_CTRL 1 /* Enable LCD40x4 (two controller) implementation -0.1K codesize*/
terhorst 0:574336532869 57 #define LCD_FONTSEL 0 /* Enable runtime font select implementation using setFont -0.9K codesize*/
terhorst 0:574336532869 58
terhorst 0:574336532869 59 //Select option to activate default fonttable or alternatively use conversion for specific controller versions (eg PCF2116C, PCF2119R, SSD1803, US2066)
terhorst 0:574336532869 60 #define LCD_DEF_FONT 1 //Default HD44780 font
terhorst 0:574336532869 61 //#define LCD_C_FONT 1 //PCF21xxC font
terhorst 0:574336532869 62 //#define LCD_R_FONT 1 //PCF21xxR font
terhorst 0:574336532869 63 //#define LCD_UTF8_FONT 1 /* Enable UTF8 Support (eg Cyrillic tables) -0.4K codesize*/
terhorst 0:574336532869 64 //#define LCD_UTF8_CYR_B 1 /* Select specific UTF8 Cyrillic table (SSD1803 ROM_B) */
terhorst 0:574336532869 65
terhorst 0:574336532869 66 //Pin Defines for I2C PCF8574/PCF8574A or MCP23008 and SPI 74595 bus expander interfaces
terhorst 0:574336532869 67 //Different commercially available LCD portexpanders use different wiring conventions.
terhorst 0:574336532869 68 //LCD and serial portexpanders should be wired according to the tables below.
terhorst 0:574336532869 69 //
terhorst 0:574336532869 70 //Select Serial Port Expander Hardware module (one option only)
terhorst 0:574336532869 71 #define DEFAULT 0
terhorst 0:574336532869 72 #define ADAFRUIT 0
terhorst 0:574336532869 73 #define DFROBOT 0
terhorst 0:574336532869 74 #define LCM1602 0
terhorst 0:574336532869 75 #define YWROBOT 1
terhorst 0:574336532869 76 #define GYLCD 0
terhorst 0:574336532869 77 #define MJKDZ 0
terhorst 0:574336532869 78 #define SYDZ 0
terhorst 0:574336532869 79 #define WIDEHK 0
terhorst 0:574336532869 80 #define LCDPLUG 0
terhorst 0:574336532869 81
terhorst 0:574336532869 82 #if (DEFAULT==1)
terhorst 0:574336532869 83 //Definitions for default (WH) mapping between serial port expander pins and LCD controller
terhorst 0:574336532869 84 //This hardware supports the I2C bus expander (PCF8574/PCF8574A or MCP23008) and SPI bus expander (74595) interfaces
terhorst 0:574336532869 85 //See https://mbed.org/cookbook/Text-LCD-Enhanced
terhorst 0:574336532869 86 //
terhorst 0:574336532869 87 //Note: LCD RW pin must be connected to GND
terhorst 0:574336532869 88 // E2 is used for LCD40x4 (second controller)
terhorst 0:574336532869 89 // BL may be used to control backlight
terhorst 0:574336532869 90
terhorst 0:574336532869 91 //I2C bus expander (PCF8574/PCF8574A or MCP23008) interface
terhorst 0:574336532869 92 #define LCD_BUS_I2C_D4 (1 << 0)
terhorst 0:574336532869 93 #define LCD_BUS_I2C_D5 (1 << 1)
terhorst 0:574336532869 94 #define LCD_BUS_I2C_D6 (1 << 2)
terhorst 0:574336532869 95 #define LCD_BUS_I2C_D7 (1 << 3)
terhorst 0:574336532869 96 #define LCD_BUS_I2C_RS (1 << 4)
terhorst 0:574336532869 97 #define LCD_BUS_I2C_E (1 << 5)
terhorst 0:574336532869 98 #define LCD_BUS_I2C_E2 (1 << 6)
terhorst 0:574336532869 99 #define LCD_BUS_I2C_BL (1 << 7)
terhorst 0:574336532869 100
terhorst 0:574336532869 101 #define LCD_BUS_I2C_RW (1 << 6)
terhorst 0:574336532869 102
terhorst 0:574336532869 103 //SPI bus expander (74595) interface, same as I2C
terhorst 0:574336532869 104 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4
terhorst 0:574336532869 105 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5
terhorst 0:574336532869 106 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6
terhorst 0:574336532869 107 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7
terhorst 0:574336532869 108 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS
terhorst 0:574336532869 109 #define LCD_BUS_SPI_E LCD_BUS_I2C_E
terhorst 0:574336532869 110 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2
terhorst 0:574336532869 111 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL
terhorst 0:574336532869 112
terhorst 0:574336532869 113 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW
terhorst 0:574336532869 114
terhorst 0:574336532869 115 //Select I2C Portexpander type (one option only)
terhorst 0:574336532869 116 #define PCF8574 1
terhorst 0:574336532869 117 #define MCP23008 0
terhorst 0:574336532869 118
terhorst 0:574336532869 119 //Inverted Backlight control
terhorst 0:574336532869 120 #define BACKLIGHT_INV 0
terhorst 0:574336532869 121 #endif
terhorst 0:574336532869 122
terhorst 0:574336532869 123 #if (ADAFRUIT==1)
terhorst 0:574336532869 124 //Definitions for Adafruit i2cspilcdbackpack mapping between serial port expander pins and LCD controller
terhorst 0:574336532869 125 //This hardware supports both an I2C expander (MCP23008) and an SPI expander (74595) selectable by a jumper.
terhorst 0:574336532869 126 //Slaveaddress may be set by solderbridges (default 0x40). SDA/SCL has pullup Resistors onboard.
terhorst 0:574336532869 127 //See http://www.ladyada.net/products/i2cspilcdbackpack
terhorst 0:574336532869 128 //
terhorst 0:574336532869 129 //Note: LCD RW pin must be kept LOW
terhorst 0:574336532869 130 // E2 is not available on this hardware and so it does not support LCD40x4 (second controller)
terhorst 0:574336532869 131 // BL is used to control backlight
terhorst 0:574336532869 132 //Note: The pinmappings are different for the MCP23008 and the 74595!
terhorst 0:574336532869 133
terhorst 0:574336532869 134 //I2C bus expander (MCP23008) interface
terhorst 0:574336532869 135 #define LCD_BUS_I2C_0 (1 << 0)
terhorst 0:574336532869 136 #define LCD_BUS_I2C_RS (1 << 1)
terhorst 0:574336532869 137 #define LCD_BUS_I2C_E (1 << 2)
terhorst 0:574336532869 138 #define LCD_BUS_I2C_D4 (1 << 3)
terhorst 0:574336532869 139 #define LCD_BUS_I2C_D5 (1 << 4)
terhorst 0:574336532869 140 #define LCD_BUS_I2C_D6 (1 << 5)
terhorst 0:574336532869 141 #define LCD_BUS_I2C_D7 (1 << 6)
terhorst 0:574336532869 142 #define LCD_BUS_I2C_BL (1 << 7)
terhorst 0:574336532869 143
terhorst 0:574336532869 144 #define LCD_BUS_I2C_E2 (1 << 0)
terhorst 0:574336532869 145 #define LCD_BUS_I2C_RW (1 << 0)
terhorst 0:574336532869 146
terhorst 0:574336532869 147 //SPI bus expander (74595) interface
terhorst 0:574336532869 148 #define LCD_BUS_SPI_0 (1 << 0)
terhorst 0:574336532869 149 #define LCD_BUS_SPI_RS (1 << 1)
terhorst 0:574336532869 150 #define LCD_BUS_SPI_E (1 << 2)
terhorst 0:574336532869 151 #define LCD_BUS_SPI_D7 (1 << 3)
terhorst 0:574336532869 152 #define LCD_BUS_SPI_D6 (1 << 4)
terhorst 0:574336532869 153 #define LCD_BUS_SPI_D5 (1 << 5)
terhorst 0:574336532869 154 #define LCD_BUS_SPI_D4 (1 << 6)
terhorst 0:574336532869 155 #define LCD_BUS_SPI_BL (1 << 7)
terhorst 0:574336532869 156
terhorst 0:574336532869 157 #define LCD_BUS_SPI_E2 (1 << 0)
terhorst 0:574336532869 158 #define LCD_BUS_SPI_RW (1 << 0)
terhorst 0:574336532869 159
terhorst 0:574336532869 160 //Force I2C portexpander type
terhorst 0:574336532869 161 #define PCF8574 0
terhorst 0:574336532869 162 #define MCP23008 1
terhorst 0:574336532869 163
terhorst 0:574336532869 164 //Inverted Backlight control
terhorst 0:574336532869 165 #define BACKLIGHT_INV 0
terhorst 0:574336532869 166 #endif
terhorst 0:574336532869 167
terhorst 0:574336532869 168 #if (DFROBOT==1)
terhorst 0:574336532869 169 //Definitions for DFROBOT LCD2004 Module mapping between serial port expander pins and LCD controller
terhorst 0:574336532869 170 //This hardware uses PCF8574 and is different from earlier/different Arduino I2C LCD displays
terhorst 0:574336532869 171 //Slaveaddress hardwired to 0x4E. SDA/SCL has pullup Resistors onboard.
terhorst 0:574336532869 172 //See http://arduino-info.wikispaces.com/LCD-Blue-I2C
terhorst 0:574336532869 173 //
terhorst 0:574336532869 174 //Definitions for DFROBOT V1.1
terhorst 0:574336532869 175 //This hardware uses PCF8574. Slaveaddress may be set by jumpers (default 0x40).
terhorst 0:574336532869 176 //SDA/SCL has pullup Resistors onboard and features a voltage level converter 3V3 <-> 5V.
terhorst 0:574336532869 177 //See http://www.dfrobot.com/index.php?route=product/product&product_id=135
terhorst 0:574336532869 178 //
terhorst 0:574336532869 179 //
terhorst 0:574336532869 180 //Note: LCD RW pin must be kept LOW
terhorst 0:574336532869 181 // E2 is not available on default Arduino hardware and so it does not support LCD40x4 (second controller)
terhorst 0:574336532869 182 // BL is used to control backlight
terhorst 0:574336532869 183
terhorst 0:574336532869 184 //I2C bus expander PCF8574 interface
terhorst 0:574336532869 185 #define LCD_BUS_I2C_RS (1 << 0)
terhorst 0:574336532869 186 #define LCD_BUS_I2C_RW (1 << 1)
terhorst 0:574336532869 187 #define LCD_BUS_I2C_E (1 << 2)
terhorst 0:574336532869 188 #define LCD_BUS_I2C_BL (1 << 3)
terhorst 0:574336532869 189 #define LCD_BUS_I2C_D4 (1 << 4)
terhorst 0:574336532869 190 #define LCD_BUS_I2C_D5 (1 << 5)
terhorst 0:574336532869 191 #define LCD_BUS_I2C_D6 (1 << 6)
terhorst 0:574336532869 192 #define LCD_BUS_I2C_D7 (1 << 7)
terhorst 0:574336532869 193
terhorst 0:574336532869 194 #define LCD_BUS_I2C_E2 (1 << 1)
terhorst 0:574336532869 195
terhorst 0:574336532869 196 //SPI bus expander (74595) interface, same as I2C
terhorst 0:574336532869 197 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS
terhorst 0:574336532869 198 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW
terhorst 0:574336532869 199 #define LCD_BUS_SPI_E LCD_BUS_I2C_E
terhorst 0:574336532869 200 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL
terhorst 0:574336532869 201 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4
terhorst 0:574336532869 202 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5
terhorst 0:574336532869 203 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6
terhorst 0:574336532869 204 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7
terhorst 0:574336532869 205
terhorst 0:574336532869 206 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2
terhorst 0:574336532869 207
terhorst 0:574336532869 208
terhorst 0:574336532869 209 //Force I2C portexpander type
terhorst 0:574336532869 210 #define PCF8574 1
terhorst 0:574336532869 211 #define MCP23008 0
terhorst 0:574336532869 212
terhorst 0:574336532869 213 //Inverted Backlight control
terhorst 0:574336532869 214 #define BACKLIGHT_INV 0
terhorst 0:574336532869 215 #endif
terhorst 0:574336532869 216
terhorst 0:574336532869 217 #if ((YWROBOT==1) || (LCM1602==1))
terhorst 0:574336532869 218 //Definitions for YWROBOT LCM1602 V1 Module mapping between serial port expander pins and LCD controller.
terhorst 0:574336532869 219 //Very similar to DFROBOT. Also marked as 'Funduino'. This hardware uses PCF8574.
terhorst 0:574336532869 220 //Slaveaddress may be set by solderbridges (default 0x4E). SDA/SCL has no pullup Resistors onboard.
terhorst 0:574336532869 221 //See http://arduino-info.wikispaces.com/LCD-Blue-I2C
terhorst 0:574336532869 222 //
terhorst 0:574336532869 223 //Note: LCD RW pin must be kept LOW
terhorst 0:574336532869 224 // E2 is not available on default hardware and so it does not support LCD40x4 (second controller)
terhorst 0:574336532869 225 // BL is used to control backlight.
terhorst 0:574336532869 226
terhorst 0:574336532869 227 //I2C bus expander PCF8574 interface
terhorst 0:574336532869 228 #define LCD_BUS_I2C_RS (1 << 0)
terhorst 0:574336532869 229 #define LCD_BUS_I2C_RW (1 << 1)
terhorst 0:574336532869 230 #define LCD_BUS_I2C_E (1 << 2)
terhorst 0:574336532869 231 #define LCD_BUS_I2C_BL (1 << 3)
terhorst 0:574336532869 232 #define LCD_BUS_I2C_D4 (1 << 4)
terhorst 0:574336532869 233 #define LCD_BUS_I2C_D5 (1 << 5)
terhorst 0:574336532869 234 #define LCD_BUS_I2C_D6 (1 << 6)
terhorst 0:574336532869 235 #define LCD_BUS_I2C_D7 (1 << 7)
terhorst 0:574336532869 236
terhorst 0:574336532869 237 #define LCD_BUS_I2C_E2 (1 << 1)
terhorst 0:574336532869 238
terhorst 0:574336532869 239 //SPI bus expander (74595) interface, same as I2C
terhorst 0:574336532869 240 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS
terhorst 0:574336532869 241 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW
terhorst 0:574336532869 242 #define LCD_BUS_SPI_E LCD_BUS_I2C_E
terhorst 0:574336532869 243 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL
terhorst 0:574336532869 244 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4
terhorst 0:574336532869 245 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5
terhorst 0:574336532869 246 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6
terhorst 0:574336532869 247 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7
terhorst 0:574336532869 248
terhorst 0:574336532869 249 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2
terhorst 0:574336532869 250
terhorst 0:574336532869 251 //Force I2C portexpander type
terhorst 0:574336532869 252 #define PCF8574 1
terhorst 0:574336532869 253 #define MCP23008 0
terhorst 0:574336532869 254
terhorst 0:574336532869 255 //Inverted Backlight control
terhorst 0:574336532869 256 #define BACKLIGHT_INV 0
terhorst 0:574336532869 257 #endif
terhorst 0:574336532869 258
terhorst 0:574336532869 259 #if ((GYLCD==1) || (MJKDZ==1))
terhorst 0:574336532869 260 //Definitions for Arduino-IIC-LCD GY-LCD-V1, for GY-IICLCD and for MJKDZ Module mapping between serial port expander pins and LCD controller.
terhorst 0:574336532869 261 //Very similar to DFROBOT. This hardware uses PCF8574.
terhorst 0:574336532869 262 //Slaveaddress may be set by solderbridges (default 0x4E). SDA/SCL has pullup Resistors onboard.
terhorst 0:574336532869 263 //See http://arduino-info.wikispaces.com/LCD-Blue-I2C
terhorst 0:574336532869 264 //
terhorst 0:574336532869 265 //Note: LCD RW pin must be kept LOW
terhorst 0:574336532869 266 // E2 is not available on default hardware and so it does not support LCD40x4 (second controller)
terhorst 0:574336532869 267 // BL is used to control backlight, reverse logic: Low turns on Backlight. This is handled in setBacklight()
terhorst 0:574336532869 268
terhorst 0:574336532869 269 //I2C bus expander PCF8574 interface
terhorst 0:574336532869 270 #define LCD_BUS_I2C_D4 (1 << 0)
terhorst 0:574336532869 271 #define LCD_BUS_I2C_D5 (1 << 1)
terhorst 0:574336532869 272 #define LCD_BUS_I2C_D6 (1 << 2)
terhorst 0:574336532869 273 #define LCD_BUS_I2C_D7 (1 << 3)
terhorst 0:574336532869 274 #define LCD_BUS_I2C_E (1 << 4)
terhorst 0:574336532869 275 #define LCD_BUS_I2C_RW (1 << 5)
terhorst 0:574336532869 276 #define LCD_BUS_I2C_RS (1 << 6)
terhorst 0:574336532869 277 #define LCD_BUS_I2C_BL (1 << 7)
terhorst 0:574336532869 278
terhorst 0:574336532869 279 #define LCD_BUS_I2C_E2 (1 << 5)
terhorst 0:574336532869 280
terhorst 0:574336532869 281 //SPI bus expander (74595) interface
terhorst 0:574336532869 282 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4
terhorst 0:574336532869 283 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5
terhorst 0:574336532869 284 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6
terhorst 0:574336532869 285 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7
terhorst 0:574336532869 286 #define LCD_BUS_SPI_E LCD_BUS_I2C_E
terhorst 0:574336532869 287 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW
terhorst 0:574336532869 288 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS
terhorst 0:574336532869 289 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL
terhorst 0:574336532869 290
terhorst 0:574336532869 291 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2
terhorst 0:574336532869 292
terhorst 0:574336532869 293 //Force I2C portexpander type
terhorst 0:574336532869 294 #define PCF8574 1
terhorst 0:574336532869 295 #define MCP23008 0
terhorst 0:574336532869 296
terhorst 0:574336532869 297 //Force Inverted Backlight control
terhorst 0:574336532869 298 #define BACKLIGHT_INV 1
terhorst 0:574336532869 299 #endif
terhorst 0:574336532869 300
terhorst 0:574336532869 301 #if (SYDZ==1)
terhorst 0:574336532869 302 //Definitions for SYDZ Module mapping between serial port expander pins and LCD controller.
terhorst 0:574336532869 303 //Very similar to DFROBOT. This hardware uses PCF8574A.
terhorst 0:574336532869 304 //Slaveaddress may be set by switches (default 0x70). SDA/SCL has pullup Resistors onboard.
terhorst 0:574336532869 305 //See ebay
terhorst 0:574336532869 306 //
terhorst 0:574336532869 307 //Note: LCD RW pin must be kept LOW
terhorst 0:574336532869 308 // E2 is not available on default hardware and so it does not support LCD40x4 (second controller)
terhorst 0:574336532869 309 // BL is used to control backlight
terhorst 0:574336532869 310
terhorst 0:574336532869 311 //I2C bus expander PCF8574A interface
terhorst 0:574336532869 312 #define LCD_BUS_I2C_RS (1 << 0)
terhorst 0:574336532869 313 #define LCD_BUS_I2C_RW (1 << 1)
terhorst 0:574336532869 314 #define LCD_BUS_I2C_E (1 << 2)
terhorst 0:574336532869 315 #define LCD_BUS_I2C_BL (1 << 3)
terhorst 0:574336532869 316 #define LCD_BUS_I2C_D4 (1 << 4)
terhorst 0:574336532869 317 #define LCD_BUS_I2C_D5 (1 << 5)
terhorst 0:574336532869 318 #define LCD_BUS_I2C_D6 (1 << 6)
terhorst 0:574336532869 319 #define LCD_BUS_I2C_D7 (1 << 7)
terhorst 0:574336532869 320
terhorst 0:574336532869 321 #define LCD_BUS_I2C_E2 (1 << 1)
terhorst 0:574336532869 322
terhorst 0:574336532869 323 //SPI bus expander (74595) interface, same as I2C
terhorst 0:574336532869 324 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS
terhorst 0:574336532869 325 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW
terhorst 0:574336532869 326 #define LCD_BUS_SPI_E LCD_BUS_I2C_E
terhorst 0:574336532869 327 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL
terhorst 0:574336532869 328 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4
terhorst 0:574336532869 329 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5
terhorst 0:574336532869 330 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6
terhorst 0:574336532869 331 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7
terhorst 0:574336532869 332
terhorst 0:574336532869 333 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2
terhorst 0:574336532869 334
terhorst 0:574336532869 335 //Force I2C portexpander type
terhorst 0:574336532869 336 #define PCF8574 1
terhorst 0:574336532869 337 #define MCP23008 0
terhorst 0:574336532869 338
terhorst 0:574336532869 339 //Force Inverted Backlight control
terhorst 0:574336532869 340 #define BACKLIGHT_INV 0
terhorst 0:574336532869 341 #endif
terhorst 0:574336532869 342
terhorst 0:574336532869 343 #if (WIDEHK==1)
terhorst 0:574336532869 344 //Definitions for WIDE.HK I2C backpack mapping between serial port expander pins and LCD controller
terhorst 0:574336532869 345 //This hardware uses an MCP23008 I2C expander.
terhorst 0:574336532869 346 //Slaveaddress is hardcoded at 0x4E. SDA/SCL has pullup Resistors onboard (3k3).
terhorst 0:574336532869 347 //See http://www.wide.hk
terhorst 0:574336532869 348 //
terhorst 0:574336532869 349 //Note: LCD RW pin must be kept LOW
terhorst 0:574336532869 350 // E2 is not available on this hardware and so it does not support LCD40x4 (second controller)
terhorst 0:574336532869 351 // BL is used to control backlight
terhorst 0:574336532869 352 //
terhorst 0:574336532869 353
terhorst 0:574336532869 354 //I2C bus expander (MCP23008) interface
terhorst 0:574336532869 355 #define LCD_BUS_I2C_D4 (1 << 0)
terhorst 0:574336532869 356 #define LCD_BUS_I2C_D5 (1 << 1)
terhorst 0:574336532869 357 #define LCD_BUS_I2C_D6 (1 << 2)
terhorst 0:574336532869 358 #define LCD_BUS_I2C_D7 (1 << 3)
terhorst 0:574336532869 359 #define LCD_BUS_I2C_RS (1 << 4)
terhorst 0:574336532869 360 #define LCD_BUS_I2C_RW (1 << 5)
terhorst 0:574336532869 361 #define LCD_BUS_I2C_BL (1 << 6)
terhorst 0:574336532869 362 #define LCD_BUS_I2C_E (1 << 7)
terhorst 0:574336532869 363
terhorst 0:574336532869 364 #define LCD_BUS_I2C_E2 (1 << 5)
terhorst 0:574336532869 365
terhorst 0:574336532869 366 //SPI bus expander (74595) interface, same as I2C
terhorst 0:574336532869 367 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4
terhorst 0:574336532869 368 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5
terhorst 0:574336532869 369 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6
terhorst 0:574336532869 370 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7
terhorst 0:574336532869 371 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS
terhorst 0:574336532869 372 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW
terhorst 0:574336532869 373 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL
terhorst 0:574336532869 374 #define LCD_BUS_SPI_E LCD_BUS_I2C_E
terhorst 0:574336532869 375
terhorst 0:574336532869 376 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2
terhorst 0:574336532869 377
terhorst 0:574336532869 378 //Force I2C portexpander type
terhorst 0:574336532869 379 #define PCF8574 0
terhorst 0:574336532869 380 #define MCP23008 1
terhorst 0:574336532869 381
terhorst 0:574336532869 382 //Inverted Backlight control
terhorst 0:574336532869 383 #define BACKLIGHT_INV 0
terhorst 0:574336532869 384 #endif
terhorst 0:574336532869 385
terhorst 0:574336532869 386 #if (LCDPLUG==1)
terhorst 0:574336532869 387 //Definitions for Jeelabs LCD_Plug I2C backpack mapping between serial port expander pins and LCD controller
terhorst 0:574336532869 388 //This hardware uses an MCP23008 I2C expander.
terhorst 0:574336532869 389 //Slaveaddress is hardcoded at 0x48. SDA/SCL has no pullup Resistors onboard.
terhorst 0:574336532869 390 //See http://jeelabs.net/projects/hardware/wiki/lcd_plug
terhorst 0:574336532869 391 //
terhorst 0:574336532869 392 //Note: LCD RW pin must be kept LOW
terhorst 0:574336532869 393 // E2 is available on a plug and so it does support LCD40x4 (second controller)
terhorst 0:574336532869 394 // BL is used to control backlight
terhorst 0:574336532869 395 //
terhorst 0:574336532869 396
terhorst 0:574336532869 397 //I2C bus expander (MCP23008) interface
terhorst 0:574336532869 398 #define LCD_BUS_I2C_D4 (1 << 0)
terhorst 0:574336532869 399 #define LCD_BUS_I2C_D5 (1 << 1)
terhorst 0:574336532869 400 #define LCD_BUS_I2C_D6 (1 << 2)
terhorst 0:574336532869 401 #define LCD_BUS_I2C_D7 (1 << 3)
terhorst 0:574336532869 402 #define LCD_BUS_I2C_RS (1 << 4)
terhorst 0:574336532869 403 #define LCD_BUS_I2C_E2 (1 << 5)
terhorst 0:574336532869 404 #define LCD_BUS_I2C_E (1 << 6)
terhorst 0:574336532869 405 #define LCD_BUS_I2C_BL (1 << 7)
terhorst 0:574336532869 406
terhorst 0:574336532869 407 #define LCD_BUS_I2C_RW (1 << 5)
terhorst 0:574336532869 408
terhorst 0:574336532869 409 //SPI bus expander (74595) interface, same as I2C
terhorst 0:574336532869 410 #define LCD_BUS_SPI_D4 LCD_BUS_I2C_D4
terhorst 0:574336532869 411 #define LCD_BUS_SPI_D5 LCD_BUS_I2C_D5
terhorst 0:574336532869 412 #define LCD_BUS_SPI_D6 LCD_BUS_I2C_D6
terhorst 0:574336532869 413 #define LCD_BUS_SPI_D7 LCD_BUS_I2C_D7
terhorst 0:574336532869 414 #define LCD_BUS_SPI_RS LCD_BUS_I2C_RS
terhorst 0:574336532869 415 #define LCD_BUS_SPI_E2 LCD_BUS_I2C_E2
terhorst 0:574336532869 416 #define LCD_BUS_SPI_E LCD_BUS_I2C_E
terhorst 0:574336532869 417 #define LCD_BUS_SPI_BL LCD_BUS_I2C_BL
terhorst 0:574336532869 418
terhorst 0:574336532869 419 #define LCD_BUS_SPI_RW LCD_BUS_I2C_RW
terhorst 0:574336532869 420
terhorst 0:574336532869 421 //Force I2C portexpander type
terhorst 0:574336532869 422 #define PCF8574 0
terhorst 0:574336532869 423 #define MCP23008 1
terhorst 0:574336532869 424
terhorst 0:574336532869 425 //Inverted Backlight control
terhorst 0:574336532869 426 #define BACKLIGHT_INV 0
terhorst 0:574336532869 427 #endif
terhorst 0:574336532869 428
terhorst 0:574336532869 429
terhorst 0:574336532869 430 //Bitpattern Defines for I2C PCF8574/PCF8574A, MCP23008 and SPI 74595 Bus expanders
terhorst 0:574336532869 431 //Don't change!
terhorst 0:574336532869 432 #define LCD_BUS_I2C_MSK (LCD_BUS_I2C_D4 | LCD_BUS_I2C_D5 | LCD_BUS_I2C_D6 | LCD_BUS_I2C_D7)
terhorst 0:574336532869 433 #if (BACKLIGHT_INV == 1)
terhorst 0:574336532869 434 #define LCD_BUS_I2C_DEF (0x00 | LCD_BUS_I2C_BL)
terhorst 0:574336532869 435 #else
terhorst 0:574336532869 436 #define LCD_BUS_I2C_DEF 0x00
terhorst 0:574336532869 437 #endif
terhorst 0:574336532869 438
terhorst 0:574336532869 439 #define LCD_BUS_SPI_MSK (LCD_BUS_SPI_D4 | LCD_BUS_SPI_D5 | LCD_BUS_SPI_D6 | LCD_BUS_SPI_D7)
terhorst 0:574336532869 440 #if (BACKLIGHT_INV == 1)
terhorst 0:574336532869 441 #define LCD_BUS_SPI_DEF (0x00 | LCD_BUS_SPI_BL)
terhorst 0:574336532869 442 #else
terhorst 0:574336532869 443 #define LCD_BUS_SPI_DEF 0x00
terhorst 0:574336532869 444 #endif
terhorst 0:574336532869 445
terhorst 0:574336532869 446
terhorst 0:574336532869 447 /* PCF8574/PCF8574A I2C portexpander slave address */
terhorst 0:574336532869 448 #define PCF8574_SA0 0x40
terhorst 0:574336532869 449 #define PCF8574_SA1 0x42
terhorst 0:574336532869 450 #define PCF8574_SA2 0x44
terhorst 0:574336532869 451 #define PCF8574_SA3 0x46
terhorst 0:574336532869 452 #define PCF8574_SA4 0x48
terhorst 0:574336532869 453 #define PCF8574_SA5 0x4A
terhorst 0:574336532869 454 #define PCF8574_SA6 0x4C
terhorst 0:574336532869 455 #define PCF8574_SA7 0x4E
terhorst 0:574336532869 456
terhorst 0:574336532869 457 #define PCF8574A_SA0 0x70
terhorst 0:574336532869 458 #define PCF8574A_SA1 0x72
terhorst 0:574336532869 459 #define PCF8574A_SA2 0x74
terhorst 0:574336532869 460 #define PCF8574A_SA3 0x76
terhorst 0:574336532869 461 #define PCF8574A_SA4 0x78
terhorst 0:574336532869 462 #define PCF8574A_SA5 0x7A
terhorst 0:574336532869 463 #define PCF8574A_SA6 0x7C
terhorst 0:574336532869 464 #define PCF8574A_SA7 0x7E
terhorst 0:574336532869 465
terhorst 0:574336532869 466 /* MCP23008 I2C portexpander slave address */
terhorst 0:574336532869 467 #define MCP23008_SA0 0x40
terhorst 0:574336532869 468 #define MCP23008_SA1 0x42
terhorst 0:574336532869 469 #define MCP23008_SA2 0x44
terhorst 0:574336532869 470 #define MCP23008_SA3 0x46
terhorst 0:574336532869 471 #define MCP23008_SA4 0x48
terhorst 0:574336532869 472 #define MCP23008_SA5 0x4A
terhorst 0:574336532869 473 #define MCP23008_SA6 0x4C
terhorst 0:574336532869 474 #define MCP23008_SA7 0x4E
terhorst 0:574336532869 475
terhorst 0:574336532869 476 /* MCP23008 I2C portexpander internal registers */
terhorst 0:574336532869 477 #define IODIR 0x00
terhorst 0:574336532869 478 #define IPOL 0x01
terhorst 0:574336532869 479 #define GPINTEN 0x02
terhorst 0:574336532869 480 #define DEFVAL 0x03
terhorst 0:574336532869 481 #define INTCON 0x04
terhorst 0:574336532869 482 #define IOCON 0x05
terhorst 0:574336532869 483 #define GPPU 0x06
terhorst 0:574336532869 484 #define INTF 0x07
terhorst 0:574336532869 485 #define INTCAP 0x08
terhorst 0:574336532869 486 #define GPIO 0x09
terhorst 0:574336532869 487 #define OLAT 0x0A
terhorst 0:574336532869 488
terhorst 0:574336532869 489 /* ST7032i I2C slave address */
terhorst 0:574336532869 490 #define ST7032_SA 0x7C
terhorst 0:574336532869 491
terhorst 0:574336532869 492 /* ST7036i I2C slave address */
terhorst 0:574336532869 493 #define ST7036_SA0 0x78
terhorst 0:574336532869 494 #define ST7036_SA1 0x7A
terhorst 0:574336532869 495 #define ST7036_SA2 0x7C
terhorst 0:574336532869 496 #define ST7036_SA3 0x7E
terhorst 0:574336532869 497
terhorst 0:574336532869 498 /* ST7066_ACM I2C slave address, Added for ACM1602 module */
terhorst 0:574336532869 499 #define ST7066_SA0 0xA0
terhorst 0:574336532869 500
terhorst 0:574336532869 501 /* PCF21XX I2C slave address */
terhorst 0:574336532869 502 #define PCF21XX_SA0 0x74
terhorst 0:574336532869 503 #define PCF21XX_SA1 0x76
terhorst 0:574336532869 504
terhorst 0:574336532869 505 /* AIP31068 I2C slave address */
terhorst 0:574336532869 506 #define AIP31068_SA 0x7C
terhorst 0:574336532869 507
terhorst 0:574336532869 508 /* SSD1803 I2C slave address */
terhorst 0:574336532869 509 #define SSD1803_SA0 0x78
terhorst 0:574336532869 510 #define SSD1803_SA1 0x7A
terhorst 0:574336532869 511
terhorst 0:574336532869 512 /* US2066/SSD1311 I2C slave address */
terhorst 0:574336532869 513 #define US2066_SA0 0x78
terhorst 0:574336532869 514 #define US2066_SA1 0x7A
terhorst 0:574336532869 515
terhorst 0:574336532869 516 /* AC780 I2C slave address */
terhorst 0:574336532869 517 #define AC780_SA0 0x78
terhorst 0:574336532869 518 #define AC780_SA1 0x7A
terhorst 0:574336532869 519 #define AC780_SA2 0x7C
terhorst 0:574336532869 520 #define AC780_SA3 0x7E
terhorst 0:574336532869 521
terhorst 0:574336532869 522 /* SPLC792A is clone of ST7032i */
terhorst 0:574336532869 523 #define SPLC792A_SA0 0x78
terhorst 0:574336532869 524 #define SPLC792A_SA1 0x7A
terhorst 0:574336532869 525 #define SPLC792A_SA2 0x7C
terhorst 0:574336532869 526 #define SPLC792A_SA3 0x7E
terhorst 0:574336532869 527
terhorst 0:574336532869 528 //Some native I2C controllers dont support ACK. Set define to '0' to allow code to proceed even without ACK
terhorst 0:574336532869 529 //#define LCD_I2C_ACK 0
terhorst 0:574336532869 530 #define LCD_I2C_ACK 1
terhorst 0:574336532869 531
terhorst 0:574336532869 532
terhorst 0:574336532869 533 // Contrast setting, 6 significant bits (only supported for controllers with extended features)
terhorst 0:574336532869 534 // Voltage Multiplier setting, 2 or 3 significant bits (only supported for controllers with extended features)
terhorst 0:574336532869 535 #define LCD_DEF_CONTRAST 0x20
terhorst 0:574336532869 536
terhorst 0:574336532869 537 //ST7032 EastRising ERC1602FS-4 display
terhorst 0:574336532869 538 //Contrast setting 6 significant bits (0..63)
terhorst 0:574336532869 539 //Voltage Multiplier setting 3 significant bits:
terhorst 0:574336532869 540 // 0: 1.818V
terhorst 0:574336532869 541 // 1: 2.222V
terhorst 0:574336532869 542 // 2: 2.667V
terhorst 0:574336532869 543 // 3: 3.333V
terhorst 0:574336532869 544 // 4: 3.636V (ST7032 default)
terhorst 0:574336532869 545 // 5: 4.000V
terhorst 0:574336532869 546 // 6: 4.444V
terhorst 0:574336532869 547 // 7: 5.000V
terhorst 0:574336532869 548 #define LCD_ST7032_CONTRAST 0x28
terhorst 0:574336532869 549 #define LCD_ST7032_RAB 0x04
terhorst 0:574336532869 550
terhorst 0:574336532869 551 //ST7036 EA DOGM1603 display
terhorst 0:574336532869 552 //Contrast setting 6 significant bits
terhorst 0:574336532869 553 //Voltage Multiplier setting 3 significant bits
terhorst 0:574336532869 554 #define LCD_ST7036_CONTRAST 0x28
terhorst 0:574336532869 555 #define LCD_ST7036_RAB 0x04
terhorst 0:574336532869 556
terhorst 0:574336532869 557 //SSD1803 EA DOGM204 display
terhorst 0:574336532869 558 //Contrast setting 6 significant bits
terhorst 0:574336532869 559 //Voltage Multiplier setting 3 significant bits
terhorst 0:574336532869 560 #define LCD_SSD1_CONTRAST 0x28
terhorst 0:574336532869 561 #define LCD_SSD1_RAB 0x06
terhorst 0:574336532869 562
terhorst 0:574336532869 563 //US2066/SSD1311 EastRising ER-OLEDM2002-4 display
terhorst 0:574336532869 564 //Contrast setting 8 significant bits, use 6 for compatibility
terhorst 0:574336532869 565 #define LCD_US20_CONTRAST 0x3F
terhorst 0:574336532869 566 //#define LCD_US20_CONTRAST 0x1F
terhorst 0:574336532869 567
terhorst 0:574336532869 568 //PCF2113, PCF2119 display
terhorst 0:574336532869 569 //Contrast setting 6 significant bits
terhorst 0:574336532869 570 //Voltage Multiplier setting 2 significant bits
terhorst 0:574336532869 571 #define LCD_PCF2_CONTRAST 0x20
terhorst 0:574336532869 572 #define LCD_PCF2_S12 0x02
terhorst 0:574336532869 573
terhorst 0:574336532869 574 //PT6314 VFD display
terhorst 0:574336532869 575 //Contrast setting 2 significant bits, use 6 for compatibility
terhorst 0:574336532869 576 #define LCD_PT63_CONTRAST 0x3F
terhorst 0:574336532869 577
terhorst 0:574336532869 578 //SPLC792A is clone of ST7032i
terhorst 0:574336532869 579 //Contrast setting 6 significant bits (0..63)
terhorst 0:574336532869 580 //Voltage Multiplier setting 3 significant bits:
terhorst 0:574336532869 581 // 0: 1.818V
terhorst 0:574336532869 582 // 1: 2.222V
terhorst 0:574336532869 583 // 2: 2.667V
terhorst 0:574336532869 584 // 3: 3.333V (SPLC792A default)
terhorst 0:574336532869 585 // 4: 3.636V
terhorst 0:574336532869 586 // 5: 4.000V
terhorst 0:574336532869 587 // 6: 4.444V
terhorst 0:574336532869 588 // 7: 5.000V
terhorst 0:574336532869 589 #define LCD_SPLC792A_CONTRAST 0x28
terhorst 0:574336532869 590 #define LCD_SPLC792A_RAB 0x04
terhorst 0:574336532869 591
terhorst 0:574336532869 592 #endif //MBED_TEXTLCDCONFIG_H