nlgplay for mbed
Dependencies: SDFileSystemEx mbed
Diff: lcd.cpp
- Revision:
- 1:ec416e6d5739
- Parent:
- 0:2053640461b5
- Child:
- 7:7e183b33c3f9
--- a/lcd.cpp Sat May 17 12:54:13 2014 +0000 +++ b/lcd.cpp Mon May 19 03:10:50 2014 +0000 @@ -31,13 +31,15 @@ void lcd_printStr(const char *s) { - while(*s) { + int idx = 0; + while(*s && idx < 8) { if(*(s + 1)) { lcd_contdata(*s); } else { lcd_lastdata(*s); } s++; + idx++; } } @@ -78,6 +80,36 @@ lcd_cmd(0x80 | (y * 0x40 + x)); } + +void lcd_printStrY(int y,const char *s) +{ + lcd_setCursor(0,y); + lcd_printStr(s); +} + +void lcd_printStrYscr(int y,const char *s) +{ + int cnt = strlen(s) - 7; + if (cnt <= 0) + cnt = 1; + + for(int i = 0; i < cnt; i++) + { + lcd_setCursor(0, y); + lcd_printStr(s + i); + wait(0.5); + } +} + + +void lcd_printStr2(const char *s, const char *s2) +{ + lcd_setCursor(0,0); + lcd_printStr(s); + lcd_setCursor(0,1); + lcd_printStr(s2); +} + void lcd_cls(void) { lcd_setCursor(0, 0);