ASURO Library
2.80
|
Library to control LCD over I²c More...
Go to the source code of this file.
Macros | |
#define | LCD_INIT {(LCD_4BIT | LCD_2LINE | LCD_5X7), 0} |
#define | LCD_DEV 0x40 |
#define | LCD_LINES 2 |
#define | LCD_CHARS 8 |
#define | LCD_LINE1 0x00 |
#define | LCD_LINE2 0x40 |
#define | LCD_LINE3 0x10 |
#define | LCD_LINE4 0x50 |
#define | LD4 MY_LCD_LD4 |
#define | LD5 MY_LCD_LD5 |
#define | LD6 MY_LCD_LD6 |
#define | LD7 MY_LCD_LD7 |
#define | LRS MY_LCD_LRS |
#define | LRW MY_LCD_LRW |
#define | LEN MY_LCD_LEN |
#define | LBL MY_LCD_LBL |
#define | LCD_D0 (1 << LD4) |
#define | LCD_D1 (1 << LD5) |
#define | LCD_D2 (1 << LD6) |
#define | LCD_D3 (1 << LD7) |
#define | LCD_D4 (1 << LD4) |
#define | LCD_D5 (1 << LD5) |
#define | LCD_D6 (1 << LD6) |
#define | LCD_D7 (1 << LD7) |
#define | LCD_RS (1 << LRS) |
#define | LCD_RW (1 << LRW) |
#define | LCD_EN (1 << LEN) |
#define | LCD_BL (1 << LBL) |
#define | LCD_CLEAR 0x01 |
#define | LCD_HOME 0x02 |
#define | LCD_ENTRYMODE 0x04 |
#define | LCD_INCREASE (LCD_ENTRYMODE | 0x02) |
#define | LCD_DECREASE (LCD_ENTRYMODE | 0x00) |
#define | LCD_DISPLAYSHIFTON (LCD_ENTRYMODE | 0x01) |
#define | LCD_DISPLAYSHIFTOFF (LCD_ENTRYMODE | 0x00) |
#define | LCD_DISPLAYMODE 0x08 |
#define | LCD_DISPLAYON (LCD_DISPLAYMODE | 0x04) |
#define | LCD_DISPLAYOFF (LCD_DISPLAYMODE | 0x00) |
#define | LCD_CURSORON (LCD_DISPLAYMODE | 0x02) |
#define | LCD_CURSOROFF (LCD_DISPLAYMODE | 0x00) |
#define | LCD_BLINKINGON (LCD_DISPLAYMODE | 0x01) |
#define | LCD_BLINKINGOFF (LCD_DISPLAYMODE | 0x00) |
#define | LCD_SHIFTMODE 0x10 |
#define | LCD_DISPLAYSHIFT (LCD_SHIFTMODE | 0x08) |
#define | LCD_CURSORMOVE (LCD_SHIFTMODE | 0x00) |
#define | LCD_RIGHT (LCD_SHIFTMODE | 0x04) |
#define | LCD_LEFT (LCD_SHIFTMODE | 0x00) |
#define | LCD_CONFIGURATION 0x20 |
#define | LCD_8BIT (LCD_CONFIGURATION | 0x10) |
#define | LCD_4BIT (LCD_CONFIGURATION | 0x00) |
#define | LCD_2LINE (LCD_CONFIGURATION | 0x08) |
#define | LCD_1LINE (LCD_CONFIGURATION | 0x00) |
#define | LCD_5X10 (LCD_CONFIGURATION | 0x04) |
#define | LCD_5X7 (LCD_CONFIGURATION | 0x00) |
#define | LCD_CGRAM 0x40 |
#define | LCD_DDRAM 0x80 |
#define | LCD_KEY_YELLOW (1<<PD6) |
#define | LCD_KEY_RED (1<<PD2) |
#define | LCD_KEY_BLUE (1<<PB3) |
#define | PrintLCD_P(_str) PrintLCD_p(PSTR(_str)) |
#define | SetCharLCD_P(_asc, _str) SetCharLCD_p(_asc, PSTR(_str)) |
Functions | |
void | InitLCD (void) |
Init LCD Hardware. | |
void | InitLCDKeys (void) |
Init LCD Keys. | |
void | BacklightLCD (unsigned char state) |
Switch LCD Backlight on/off. | |
void | SetIOLCD (unsigned char setCommand, unsigned char bits) |
Set LCD IO Port. | |
unsigned char | GetIOLCD (void) |
Read LCD IO Port. | |
void | SetCursorLCD (unsigned char cursor, unsigned char line) |
Set Cursor. | |
void | ClearLCD (void) |
Clears the Display. | |
void | SetDataLCD (unsigned char data) |
Write Data LCD, for use with CommandLCD or WriteLCD. | |
void | CommandLCD (unsigned char command) |
Set LCD Command, implemented as macro. | |
void | WriteLCD (unsigned char data) |
Write Data. | |
void | PrintLCD (char *string, unsigned char wrap) |
Print String to LCD. | |
void | PrintSetLCD (unsigned char cursor, unsigned char line, char *string) |
Print String at cursor position. | |
void | PrintIntLCD (int value) |
Print Integer Value. | |
void | PrintAlignLCD (unsigned char line, unsigned char alignment, char *string) |
Print a String at aligned position (left, center right) | |
void | PrintLCD_p (const char *progmem_s) |
Print String from Program Space to LCD. | |
void | SetCharLCD_p (unsigned char AsciiCode, const char *progmem_s) |
Set special character from Program Space to LCD user character. | |
int | PollSwitchLCD (void) |
poll LCD module keys | |
Variables | |
unsigned char | portLCD |
unsigned char | lineLCD |
unsigned char | cursorLCD |
Library to control LCD over I²c
This Library is designed for HD44870 based LCDs with I2C expander PCF8574p. It requires I²C Master Software from Peter Fleury. PIN-Assignment: P0-P3 -> DB4-DB7, P4 -> RS, P5 -> R/w, P7 -> Enable. For Use with ASURO Robot
Inspiration from I²C-LCD library by "Nico Eichelmann, Thomas Eichelmann"
Definition in file lcd.h.
#define LBL MY_LCD_LBL |
#define LCD_1LINE (LCD_CONFIGURATION | 0x00) |
#define LCD_2LINE (LCD_CONFIGURATION | 0x08) |
#define LCD_4BIT (LCD_CONFIGURATION | 0x00) |
#define LCD_5X10 (LCD_CONFIGURATION | 0x04) |
#define LCD_5X7 (LCD_CONFIGURATION | 0x00) |
#define LCD_8BIT (LCD_CONFIGURATION | 0x10) |
#define LCD_BLINKINGOFF (LCD_DISPLAYMODE | 0x00) |
#define LCD_BLINKINGON (LCD_DISPLAYMODE | 0x01) |
#define LCD_CURSORMOVE (LCD_SHIFTMODE | 0x00) |
#define LCD_CURSOROFF (LCD_DISPLAYMODE | 0x00) |
#define LCD_CURSORON (LCD_DISPLAYMODE | 0x02) |
#define LCD_DECREASE (LCD_ENTRYMODE | 0x00) |
#define LCD_DISPLAYOFF (LCD_DISPLAYMODE | 0x00) |
#define LCD_DISPLAYON (LCD_DISPLAYMODE | 0x04) |
#define LCD_DISPLAYSHIFT (LCD_SHIFTMODE | 0x08) |
#define LCD_DISPLAYSHIFTOFF (LCD_ENTRYMODE | 0x00) |
#define LCD_DISPLAYSHIFTON (LCD_ENTRYMODE | 0x01) |
#define LCD_INCREASE (LCD_ENTRYMODE | 0x02) |
#define LCD_LEFT (LCD_SHIFTMODE | 0x00) |
#define LCD_RIGHT (LCD_SHIFTMODE | 0x04) |
#define LD4 MY_LCD_LD4 |
#define LD5 MY_LCD_LD5 |
#define LD6 MY_LCD_LD6 |
#define LD7 MY_LCD_LD7 |
#define LEN MY_LCD_LEN |
#define LRS MY_LCD_LRS |
#define LRW MY_LCD_LRW |
#define PrintLCD_P | ( | _str | ) | PrintLCD_p(PSTR(_str)) |
#define SetCharLCD_P | ( | _asc, | |
_str | |||
) | SetCharLCD_p(_asc, PSTR(_str)) |
void BacklightLCD | ( | unsigned char | state | ) |
Switch LCD Backlight on/off.
state | On or off |
void ClearLCD | ( | void | ) |
Clears the Display.
void CommandLCD | ( | unsigned char | command | ) |
Set LCD Command, implemented as macro.
command | LCD command |
unsigned char GetIOLCD | ( | void | ) |
Read LCD IO Port.
void InitLCD | ( | void | ) |
Init LCD Hardware.
void InitLCDKeys | ( | void | ) |
Init LCD Keys.
int PollSwitchLCD | ( | void | ) |
poll LCD module keys
void PrintAlignLCD | ( | unsigned char | line, |
unsigned char | alignment, | ||
char * | string | ||
) |
Print a String at aligned position (left, center right)
line | Line number |
alignment | left, center or right aligned |
string | string pointer |
void PrintIntLCD | ( | int | value | ) |
Print Integer Value.
value | Integer value |
void PrintLCD | ( | char * | string, |
unsigned char | wrap | ||
) |
Print String to LCD.
string | String pointer |
wrap | String Wrapped or not |
void PrintLCD_p | ( | const char * | progmem_s | ) |
Print String from Program Space to LCD.
progmem_s | String pointer |
void PrintSetLCD | ( | unsigned char | cursor, |
unsigned char | line, | ||
char * | string | ||
) |
Print String at cursor position.
cursor | Cursor position |
line | line number |
string | String pointer |
void SetCharLCD_p | ( | unsigned char | AsciiCode, |
const char * | progmem_s | ||
) |
Set special character from Program Space to LCD user character.
AsciiCode | ASCII code |
progmem_s | String pointer |
void SetCursorLCD | ( | unsigned char | cursor, |
unsigned char | line | ||
) |
Set Cursor.
cursor | cursor position |
line | line number |
void SetDataLCD | ( | unsigned char | data | ) |
Write Data LCD, for use with CommandLCD or WriteLCD.
data | LCD Data |
void SetIOLCD | ( | unsigned char | setCommand, |
unsigned char | bits | ||
) |
Set LCD IO Port.
setCommand | ON or OFF |
bits | Bits to set |
void WriteLCD | ( | unsigned char | data | ) |
Write Data.
data | LCD Data |