Subversion Repositories group.electronics

Rev

Blame | Last modification | View Log | RSS feed

#ifndef lcd_h
#define lcd_h
#define LCD_ADDR        0x27

#define LCD_CLEARDISPLAY        0x01
#define LCD_RETURNHOME          0x02

#define LCD_ENTRYMODESET        0x04
#define LCD_DISPLAYCONTROL      0x08
#define LCD_FUNCTIONSET         0x20
#define LCD_SETCGRAMADDR        0x40
#define LCD_SETDDRAMADDR        0x80

#define LCD_DISPLAYON           0x04
#define LCD_DISPLAYOFF          0x00
#define LCD_CURSORON            0x02
#define LCD_CURSOROFF           0x00
#define LCD_BLINKON             0x01
#define LCD_BLINKOFF            0x00

#define LCD_ENTRYRIGHT 0x00
#define LCD_ENTRYLEFT 0x02
#define LCD_ENTRYSHIFTINCREMENT 0x01
#define LCD_ENTRYSHIFTDECREMENT 0x00

#define LCD_BACKLIGHT           0x08
#define LCD_NOBACKLIGHT         0x00

#define LCD_4BITMODE            0x10
#define LCD_2LINE               0x08
#define LCD_5x8DOTS             0x00

#define LCD_MODE_CM     0x00                    // Command line
#define LCD_MODE_RS     0x01                    // Write line
#define LCD_MODE_RW     0x02                    // Read line
#define LCD_MODE_EN     0x04                    // Enable line

struct {
        uint8_t display;
        uint8_t function;
        uint8_t backlight;
} lcd;

void lcd_init(void);

void lcd_percent_graph(uint8_t, uint8_t, uint8_t);

uint8_t lcd_print(char*);
uint8_t lcd_print_right(char*);
void lcd_overprint(char * str, uint8_t len, uint8_t, uint8_t);
void lcd_overprint_right(char *str, uint8_t len, uint8_t col, uint8_t row);

inline void lcd_clear();
inline void lcd_home();
inline void lcd_backlight();
inline void lcd_noBacklight();
void lcd_display();
void lcd_noDisplay();
void lcd_setCursor(uint8_t, uint8_t);
void lcd_autocursorLeft();
void lcd_autocursorRight();
void lcd_autoscroll();
void lcd_noAutoscroll();

void lcd_command(uint8_t);
void lcd_char(uint8_t data);
void lcd_send(uint8_t, uint8_t);
void lcd_write(uint8_t);
void lcd_pulse(uint8_t);
void lcd_createChar(uint8_t, uint8_t[]);

#endif