6 #define LCD_CLEARDISPLAY 0x01
7 #define LCD_RETURNHOME 0x02
8 #define LCD_ENTRYMODESET 0x04
9 #define LCD_DISPLAYCONTROL 0x08
10 #define LCD_CURSORSHIFT 0x10
11 #define LCD_FUNCTIONSET 0x20
12 #define LCD_SETCGRAMADDR 0x40
13 #define LCD_SETDDRAMADDR 0x80
16 #define LCD_ENTRYRIGHT 0x00
17 #define LCD_ENTRYLEFT 0x02
18 #define LCD_ENTRYSHIFTINCREMENT 0x01
19 #define LCD_ENTRYSHIFTDECREMENT 0x00
22 #define LCD_DISPLAYON 0x04
23 #define LCD_DISPLAYOFF 0x00
24 #define LCD_CURSORON 0x02
25 #define LCD_CURSOROFF 0x00
26 #define LCD_BLINKON 0x01
27 #define LCD_BLINKOFF 0x00
30 #define LCD_DISPLAYMOVE 0x08
31 #define LCD_CURSORMOVE 0x00
32 #define LCD_MOVERIGHT 0x04
33 #define LCD_MOVELEFT 0x00
36 #define LCD_8BITMODE 0x10
37 #define LCD_4BITMODE 0x00
38 #define LCD_2LINE 0x08
39 #define LCD_1LINE 0x00
42 #define LCD_BACKLIGHT 0x08
43 #define LCD_NOBACKLIGHT 0x00
90 void LiquidCrystal_I2C::init_priv() {
103 if ((dotsize != 0) && (lines == 1)) {
113 expanderWrite(_backlightval);
121 write4bits(0x03 << 4);
122 delayMicroseconds(4500);
125 write4bits(0x03 << 4);
126 delayMicroseconds(4500);
129 write4bits(0x03 << 4);
130 delayMicroseconds(150);
133 write4bits(0x02 << 4);
157 delayMicroseconds(2000);
162 delayMicroseconds(2000);
166 int row_offsets[] = {0x00, 0x40, 0x14, 0x54};
167 if (row > _numlines) {
260 for (
int i = 0; i < 8; i++) {
279 inline void LiquidCrystal_I2C::command(uint8_t value) {
288 void LiquidCrystal_I2C::send(uint8_t value, uint8_t mode) {
289 uint8_t highnib = value & 0xf0;
290 uint8_t lownib = (value << 4)&0xf0;
291 write4bits((highnib) | mode);
292 write4bits((lownib) | mode);
295 void LiquidCrystal_I2C::write4bits(uint8_t value) {
296 expanderWrite(value);
300 void LiquidCrystal_I2C::expanderWrite(uint8_t _data) {
301 Wire.beginTransmission(_Addr);
302 Wire.write((
int) (_data) | _backlightval);
303 Wire.endTransmission();
306 void LiquidCrystal_I2C::pulseEnable(uint8_t _data) {
307 expanderWrite(_data |
En);
308 delayMicroseconds(1);
310 expanderWrite(_data & ~
En);
311 delayMicroseconds(50);
#define LCD_ENTRYSHIFTDECREMENT
#define LCD_ENTRYSHIFTINCREMENT
#define LCD_DISPLAYCONTROL
Functions for deploying I2C LCD displays.
void rightToLeft()
This is for text that flows Right to Left.
void noAutoscroll()
This will 'left justify' text from the cursor.
void noCursor()
Turns the underline cursor on/off.
void autoscroll()
This will 'right justify' text from the cursor.
void scrollDisplayRight()
LiquidCrystal_I2C(uint8_t i2c_Addr, uint8_t lcd_cols, uint8_t lcd_rows)
Constructior.
void noBacklight()
Turn the (optional) backlight off/on.
void noBlink()
Turn on and off the blinking cursor.
void leftToRight()
This is for text that flows Left to Right.
static constexpr uint8_t LCD_5x10DOTS
void createChar(uint8_t, uint8_t[])
Allows us to fill the first 8 CGRAM locations with custom characters.
void setCursor(uint8_t, uint8_t)
static constexpr uint8_t LCD_5x8DOTS
void begin(uint8_t cols, uint8_t rows, uint8_t charsize=LCD_5x8DOTS)
void noDisplay()
Turn the display on/off (quickly)