35 #include <avr/pgmspace.h>
39 #include <util/delay.h>
41 #include "i2cmaster.h"
45 static uint8_t lightOn=0;
84 if (value & CMD_D0) data_out |=
LCD_D4;
85 if (value & CMD_D1) data_out |=
LCD_D5;
86 if (value & CMD_D2) data_out |=
LCD_D6;
87 if (value & CMD_D3) data_out |=
LCD_D7;
88 if (value & CMD_RS) data_out |=
LCD_RS;
89 if (value & CMD_RW) data_out |=
LCD_RW;
99 uint8_t lcddata = 0x00;
102 lcddata = i2c_readNak();
110 uint8_t lcddata, data;
124 if (lcddata &
LCD_D4) data |= CMD_D0;
125 if (lcddata &
LCD_D5) data |= CMD_D1;
126 if (lcddata &
LCD_D6) data |= CMD_D2;
127 if (lcddata &
LCD_D7) data |= CMD_D3;
143 return (hi << 4) + (lo & 0x0F);
168 while((c=pgm_read_byte(
string++))) {
183 bool lcd_putcharlc(uint8_t line, uint8_t col,
char value) {
216 while((c=pgm_read_byte(
string++))) {
256 while((c=pgm_read_byte(
string++))) {
278 ((line == 0) || (col == 0)) )
return false;
311 if (lcddata & (1 << 7))
return false;
353 if (state & (1 << 7)) {
void lcd_light(bool light)
Turn backlight ON/OFF.
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) ...
uint8_t lcd_read(bool mode)
Read data from display over i2c (for internal use)
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) ...
void lcd_write_i2c(uint8_t value)
Write data to i2c (for internal use)
#define LCD_DISPLAYSHIFTOFF
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)...
uint8_t lcd_read_i2c(void)
Read data from i2c (for internal use)
void lcd_command(uint8_t command)
Issue a command to the display.
bool lcd_busy(void)
Check if LCD is busy.
void lcd_putchar(char lcddata)
Put char to cursor position.
uint8_t lcd_getbyte(bool mode)
Read one byte over i2c from display.
void lcd_print_P(PGM_P string)
Print string from Flash to cursor position.
void lcd_print(char *string)
Print string to cursor position.
bool lcd_getlc(uint8_t *line, uint8_t *col)
Get line and col of the cursor position.
void lcd_write(uint8_t value)
Write nibble to display with toggle of enable-bit.
bool lcd_nextline(void)
Go to nextline (if next line > LCD_LINES return false)
void lcd_init(void)
Display initialization sequence.
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) ...
bool lcd_gotolc(uint8_t line, uint8_t col)
Go to position.