Subversion Repositories group.electronics

Rev

Rev 45 | Rev 47 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 45 Rev 46
Line 31... Line 31...
31
	_delay_ms(50);
31
	_delay_ms(50);
32
 
32
 
33
	lcd_command(LCD_DISPLAYCONTROL | lcd.display);
33
	lcd_command(LCD_DISPLAYCONTROL | lcd.display);
34
	_delay_ms(50);
34
	_delay_ms(50);
35
 
35
 
36
	i2c_clear();	
36
	lcd_clear();	
37
	_delay_ms(50);
37
	_delay_ms(50);
38
 
38
 
39
	i2c_home();
39
	lcd_home();
40
	_delay_ms(50);
40
	_delay_ms(50);
41
}
41
}
42
 
42
 
43
/** Helper functions **/
43
/** Helper functions **/
-
 
44
 
44
void i2c_clear() {
45
inline void lcd_clear() {
45
	lcd_command(LCD_CLEARDISPLAY);
46
	lcd_command(LCD_CLEARDISPLAY);
46
}
47
}
47
 
48
 
48
void i2c_home() {
49
inline void lcd_home() {
49
	lcd_command(LCD_RETURNHOME);
50
	lcd_command(LCD_RETURNHOME);
50
}
51
}
51
 
52
 
-
 
53
inline void lcd_backlight() {
-
 
54
	lcd.backlight = LCD_BACKLIGHT;
-
 
55
}
-
 
56
 
-
 
57
inline void lcd_noBacklight() {
-
 
58
	lcd.backlight = LCD_NOBACKLIGHT;
-
 
59
}
-
 
60
 
52
void i2c_display() {
61
void lcd_display() {
53
	lcd.display |= LCD_DISPLAYON;
62
	lcd.display |= LCD_DISPLAYON;
54
	lcd_command(LCD_DISPLAYCONTROL | lcd.display);
63
	lcd_command(LCD_DISPLAYCONTROL | lcd.display);
55
}
64
}
56
 
65
 
57
void i2c_noDisplay() {
66
void lcd_noDisplay() {
58
	lcd.display &= ~LCD_DISPLAYON;
67
	lcd.display &= ~LCD_DISPLAYON;
59
	lcd_command(LCD_DISPLAYCONTROL | lcd.display);
68
	lcd_command(LCD_DISPLAYCONTROL | lcd.display);
60
}
69
}
61
 
70
 
62
void i2c_backlight() {
71
void lcd_setCursor(uint8_t col, uint8_t row) {
63
	lcd.backlight = LCD_BACKLIGHT;
72
	uint8_t row_offsets[] = { 0x00, 0x40, 0x14, 0x54 };
64
}
-
 
65
 
-
 
66
void i2c_noBacklight() {
-
 
67
	lcd.backlight = LCD_NOBACKLIGHT;
73
	lcd_command(LCD_SETDDRAMADDR | (col+ row_offsets[row - 1]));
68
}
74
}
69
 
75
 
70
 
-
 
71
/** End helpers **/
76
/** End helpers **/
72
 
77
 
73
 
78
 
74
void lcd_command(uint8_t data) {
79
void lcd_command(uint8_t data) {
75
	lcd_send(data, LCD_MODE_CM);
80
	lcd_send(data, LCD_MODE_CM);