Subversion Repositories group.electronics

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
117 pfowler 1
#ifndef lcd_h
2
#define lcd_h
3
#define LCD_ADDR        0x27
4
 
5
#define LCD_CLEARDISPLAY        0x01
6
#define LCD_RETURNHOME          0x02
7
 
8
#define LCD_ENTRYMODESET	0x04
9
#define LCD_DISPLAYCONTROL      0x08
10
#define LCD_FUNCTIONSET         0x20
11
#define LCD_SETCGRAMADDR	0x40
12
#define LCD_SETDDRAMADDR	0x80
13
 
14
#define LCD_DISPLAYON           0x04
15
#define LCD_DISPLAYOFF          0x00
16
#define LCD_CURSORON            0x02
17
#define LCD_CURSOROFF           0x00
18
#define LCD_BLINKON             0x01
19
#define LCD_BLINKOFF            0x00
20
 
21
#define LCD_ENTRYRIGHT 0x00
22
#define LCD_ENTRYLEFT 0x02
23
#define LCD_ENTRYSHIFTINCREMENT 0x01
24
#define LCD_ENTRYSHIFTDECREMENT 0x00
25
 
26
#define LCD_BACKLIGHT		0x08
27
#define LCD_NOBACKLIGHT		0x00
28
 
29
#define LCD_4BITMODE            0x10
30
#define LCD_2LINE               0x08
31
#define LCD_5x8DOTS             0x00
32
 
33
#define LCD_MODE_CM     0x00                    // Command line
34
#define LCD_MODE_RS     0x01                    // Write line
35
#define LCD_MODE_RW     0x02                    // Read line
36
#define LCD_MODE_EN     0x04                    // Enable line
37
 
38
struct {
39
	uint8_t display;
40
	uint8_t function;
41
	uint8_t backlight;
42
} lcd;
43
 
44
void lcd_init(void);
45
 
46
void lcd_percent_graph(uint8_t, uint8_t, uint8_t);
47
 
48
uint8_t lcd_print(char*);
49
uint8_t lcd_print_right(char*);
50
void lcd_overprint(char * str, uint8_t len, uint8_t, uint8_t);
51
void lcd_overprint_right(char *str, uint8_t len, uint8_t col, uint8_t row);
52
 
53
inline void lcd_clear();
54
inline void lcd_home();
55
inline void lcd_backlight();
56
inline void lcd_noBacklight();
57
void lcd_display();
58
void lcd_noDisplay();
59
void lcd_setCursor(uint8_t, uint8_t);
60
void lcd_autocursorLeft();
61
void lcd_autocursorRight();
62
void lcd_autoscroll();
63
void lcd_noAutoscroll();
64
 
65
void lcd_command(uint8_t);
66
void lcd_char(uint8_t data);
67
void lcd_send(uint8_t, uint8_t);
68
void lcd_write(uint8_t);
69
void lcd_pulse(uint8_t);
70
void lcd_createChar(uint8_t, uint8_t[]);
71
 
72
#endif