Subversion Repositories group.electronics

Rev

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

Rev 53 Rev 54
Line 3... Line 3...
3
#include "wire.h"
3
#include "wire.h"
4
#include "lcd.h"
4
#include "lcd.h"
5
#include "petelib.h"
5
#include "petelib.h"
6
#include <util/delay.h>
6
#include <util/delay.h>
7
 
7
 
8
struct {
-
 
9
	uint8_t display;
-
 
10
	uint8_t function;
-
 
11
	uint8_t backlight;
-
 
12
} lcd;
-
 
13
 
-
 
14
void lcd_init() {
8
void lcd_init() {
15
	lcd.backlight = LCD_BACKLIGHT;
9
	lcd.backlight = LCD_BACKLIGHT;
16
	lcd.display = LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKOFF;
10
	lcd.display = LCD_DISPLAYON | LCD_CURSOROFF | LCD_BLINKOFF;
17
	lcd.function = LCD_2LINE;
11
	lcd.function = LCD_2LINE;
18
 
12
 
Line 76... Line 70...
76
	lcd_autocursorLeft();
70
	lcd_autocursorLeft();
77
 
71
 
78
	return c;
72
	return c;
79
}
73
}
80
 
74
 
-
 
75
void lcd_overprint_right(char *str, uint8_t len, uint8_t col, uint8_t row) {
-
 
76
	uint8_t newcol = col + len;
-
 
77
	char* newstr = str + len;
-
 
78
	uint8_t i;
-
 
79
	uint8_t stopbit = 0;
-
 
80
	lcd_setCursor(newcol, row);
-
 
81
	lcd_autocursorRight();
-
 
82
	for (i=0; i<len; i++) {
-
 
83
		if (newstr[0] == 0x00)
-
 
84
			stopbit = 1;
-
 
85
	
-
 
86
		if (stopbit)
-
 
87
			lcd_char(0x20);
-
 
88
		else
-
 
89
			lcd_char(newstr[0]);
-
 
90
 
-
 
91
		newstr--;
-
 
92
	}
-
 
93
	lcd_autocursorLeft();
-
 
94
}
-
 
95
 
81
uint8_t lcd_print(char* str) {
96
uint8_t lcd_print(char* str) {
82
        uint8_t c = 0;
97
        uint8_t c = 0;
83
        while ((str++)[0] != 0x00) {
98
        while ((str++)[0] != 0x00) {
84
                lcd_char((uint8_t) (str-1)[0]);
99
                lcd_char((uint8_t) (str-1)[0]);
85
                //str++;
-
 
86
                c++;
100
                c++;
87
        }
101
        }
88
        return c;
102
        return c;
89
}
103
}
90
 
104