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