129 #define LCD_I2C_DEVICE 0x4E
132 #define LCD_LINE_MODE LCD_2LINE
134 #define LCD_LINE1 0x00
135 #define LCD_LINE2 0x40
136 #define LCD_LINE3 0x40
137 #define LCD_LINE4 0x60
141 #error "#define LCD_LINES must be less or equal to 4"
145 #error "#define LCD_COLS must be less or equal to 20"
165 #define LCD_LIGHT_PIN 3
176 #define LCD_D4 (1 << LCD_D4_PIN)
177 #define LCD_D5 (1 << LCD_D5_PIN)
178 #define LCD_D6 (1 << LCD_D6_PIN)
179 #define LCD_D7 (1 << LCD_D7_PIN)
181 #define LCD_RS (1 << LCD_RS_PIN)
182 #define LCD_RW (1 << LCD_RW_PIN)
183 #define LCD_LIGHT_N (1 << LCD_LIGHT_PIN)
184 #define LCD_E (1 << LCD_E_PIN)
190 #define CMD_D0 (1 << 0)
191 #define CMD_D1 (1 << 1)
192 #define CMD_D2 (1 << 2)
193 #define CMD_D3 (1 << 3)
194 #define CMD_RS (1 << 4)
195 #define CMD_RW (1 << 5)
200 #define LCD_ADDRESS 0
219 #define LCD_CLEAR 0x01
220 #define LCD_HOME 0x02
225 #define LCD_ENTRYMODE 0x04
226 #define LCD_INCREASE LCD_ENTRYMODE | 0x02
227 #define LCD_DECREASE LCD_ENTRYMODE | 0x00
228 #define LCD_DISPLAYSHIFTON LCD_ENTRYMODE | 0x01
229 #define LCD_DISPLAYSHIFTOFF LCD_ENTRYMODE | 0x00
234 #define LCD_DISPLAYMODE 0x08
235 #define LCD_DISPLAYON LCD_DISPLAYMODE | 0x04
236 #define LCD_DISPLAYOFF LCD_DISPLAYMODE | 0x00
237 #define LCD_CURSORON LCD_DISPLAYMODE | 0x02
238 #define LCD_CURSOROFF LCD_DISPLAYMODE | 0x00
239 #define LCD_BLINKINGON LCD_DISPLAYMODE | 0x01
240 #define LCD_BLINKINGOFF LCD_DISPLAYMODE | 0x00
245 #define LCD_SHIFTMODE 0x10
246 #define LCD_DISPLAYSHIFT LCD_SHIFTMODE | 0x08
247 #define LCD_CURSORMOVE LCD_SHIFTMODE | 0x00
248 #define LCD_RIGHT LCD_SHIFTMODE | 0x04
249 #define LCD_LEFT LCD_SHIFTMODE | 0x00
254 #define LCD_CONFIGURATION 0x20
255 #define LCD_8BIT LCD_CONFIGURATION | 0x10
256 #define LCD_4BIT LCD_CONFIGURATION | 0x00
257 #define LCD_4LINE 0x09
258 #define LCD_2LINE LCD_CONFIGURATION | 0x08
259 #define LCD_1LINE LCD_CONFIGURATION | 0x00
260 #define LCD_5X10 LCD_CONFIGURATION | 0x04
261 #define LCD_5X7 LCD_CONFIGURATION | 0x00
263 #define LCD_LIGHT_OFF LCD_LIGHT_N // low active
264 #define LCD_LIGHT_ON 0x00
381 bool lcd_printlc(uint8_t line, uint8_t col,
char *
string);
401 bool lcd_printlcc(uint8_t line, uint8_t col,
char *
string);
427 bool lcd_getlc(uint8_t *line, uint8_t*col);
void lcd_light(bool light)
Turn backlight ON/OFF.
Definition: i2clcd.c:336
bool lcd_printlc(uint8_t line, uint8_t col, char *string)
Print string to position (If string is longer than LCD_COLS overwrite first chars in line) ...
Definition: i2clcd.c:193
uint8_t lcd_read(bool mode)
Read data from display over i2c (for internal use)
Definition: i2clcd.c:109
bool lcd_printlcc(uint8_t line, uint8_t col, char *string)
Print string to position (If string is longer than LCD_COLS continue in next line) ...
Definition: i2clcd.c:229
void lcd_write_i2c(uint8_t value)
Write data to i2c (for internal use)
Definition: i2clcd.c:71
bool lcd_printlc_P(uint8_t line, uint8_t col, char *string)
Print string from Flash to position (If string is longer than LCD_COLS overwrite first chars in line)...
Definition: i2clcd.c:211
uint8_t lcd_read_i2c(void)
Read data from i2c (for internal use)
Definition: i2clcd.c:98
void lcd_command(uint8_t command)
Issue a command to the display.
Definition: i2clcd.c:148
bool lcd_busy(void)
Check if LCD is busy.
Definition: i2clcd.c:349
void lcd_putchar(char value)
Put char to cursor position.
Definition: i2clcd.c:175
bool lcd_putcharlr(uint8_t line, uint8_t col, char value)
Put char to position.
uint8_t lcd_getbyte(bool mode)
Read one byte over i2c from display.
Definition: i2clcd.c:138
void lcd_print_P(PGM_P string)
Print string from Flash to cursor position.
Definition: i2clcd.c:165
void lcd_print(char *string)
Print string to cursor position.
Definition: i2clcd.c:156
bool lcd_getlc(uint8_t *line, uint8_t *col)
Get line and col of the cursor position.
Definition: i2clcd.c:307
void lcd_write(uint8_t value)
Write nibble to display with toggle of enable-bit.
Definition: i2clcd.c:80
bool lcd_nextline(void)
Go to nextline (if next line > LCD_LINES return false)
Definition: i2clcd.c:294
void lcd_init(void)
Display initialization sequence.
Definition: i2clcd.c:49
bool lcd_printlcc_P(uint8_t line, uint8_t col, char *string)
Print string from flash to position (If string is longer than LCD_COLS continue in next line) ...
Definition: i2clcd.c:251
bool lcd_gotolc(uint8_t line, uint8_t col)
Go to position.
Definition: i2clcd.c:273