You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
99 lines
2.2 KiB
99 lines
2.2 KiB
#ifndef GROVE_LCD_H_
|
|
#define GROVE_LCD_H_
|
|
|
|
// Device I2C Arress
|
|
#define LCD_ADDRESS 0x7c
|
|
#define RGB_ADDRESS 0xc4
|
|
|
|
// Set colors
|
|
enum color {
|
|
AQUA = 0x00FFFF,
|
|
BLACK = 0x000000,
|
|
BLUE = 0x0000FF,
|
|
PURPLE = 0xFF00FF,
|
|
GREEN = 0x00FF00,
|
|
RED = 0xFF0000,
|
|
WHITE = 0xFFFFFF,
|
|
YELLOW = 0xFFFF00
|
|
};
|
|
|
|
#define REG_RED 0x04 // pwm2
|
|
#define REG_GREEN 0x03 // pwm1
|
|
#define REG_BLUE 0x02 // pwm0
|
|
|
|
#define REG_MODE1 0x00
|
|
#define REG_MODE2 0x01
|
|
#define REG_OUTPUT 0x08
|
|
|
|
// commands
|
|
#define LCD_CLEARDISPLAY 0x01
|
|
#define LCD_RETURNHOME 0x02
|
|
#define LCD_ENTRYMODESET 0x04
|
|
#define LCD_DISPLAYCONTROL 0x08
|
|
#define LCD_CURSORSHIFT 0x10
|
|
#define LCD_FUNCTIONSET 0x20
|
|
#define LCD_SETCGRAMADDR 0x40
|
|
#define LCD_SETDDRAMADDR 0x80
|
|
|
|
// flags for display entry mode
|
|
#define LCD_ENTRYRIGHT 0x00
|
|
#define LCD_ENTRYLEFT 0x02
|
|
#define LCD_ENTRYSHIFTINCREMENT 0x01
|
|
#define LCD_ENTRYSHIFTDECREMENT 0x00
|
|
|
|
// flags for display on/off control
|
|
#define LCD_DISPLAYON 0x04
|
|
#define LCD_DISPLAYOFF 0x00
|
|
#define LCD_CURSORON 0x02
|
|
#define LCD_CURSOROFF 0x00
|
|
#define LCD_BLINKON 0x01
|
|
#define LCD_BLINKOFF 0x00
|
|
|
|
// flags for display/cursor shift
|
|
#define LCD_DISPLAYMOVE 0x08
|
|
#define LCD_CURSORMOVE 0x00
|
|
#define LCD_MOVERIGHT 0x04
|
|
#define LCD_MOVELEFT 0x00
|
|
|
|
// flags for function set
|
|
#define LCD_8BITMODE 0x10
|
|
#define LCD_4BITMODE 0x00
|
|
#define LCD_2LINE 0x08
|
|
#define LCD_5x8DOTS 0x00
|
|
|
|
void lcd_print(char c[]);
|
|
int lcd_write(char value);
|
|
// TODO may be.
|
|
// void lcd_print_DEC(int i);
|
|
// void lcd_print_HEX(int i);
|
|
// void lcd_print_OCT(int i);
|
|
// void lcd_print_BIN(int i);
|
|
void lcd_begin(void);
|
|
void lcd_clear(void);
|
|
void lcd_home(void);
|
|
|
|
void lcd_noDisplay(void);
|
|
void lcd_display(void);
|
|
void lcd_noBlink(void);
|
|
void lcd_blink(void);
|
|
void lcd_noCursor(void);
|
|
void lcd_cursor(void);
|
|
void lcd_scrollDisplayLeft(void);
|
|
void lcd_scrollDisplayRight(void);
|
|
void lcd_leftToRight(void);
|
|
void lcd_rightToLeft(void);
|
|
void lcd_autoscroll(void);
|
|
void lcd_noAutoscroll(void);
|
|
|
|
void lcd_createChar(int, int[]);
|
|
void lcd_setCursor(int, int);
|
|
|
|
// color control
|
|
void lcd_setRGB(unsigned char r, unsigned char g, unsigned char b);// set rgb
|
|
void lcd_setColor(enum color c);
|
|
|
|
// blink the LED backlight
|
|
void lcd_blinkLED(void);
|
|
void lcd_noBlinkLED(void);
|
|
|
|
#endif /* GROVE_LCD_H_ */ |