Update lcd.c

pull/7/head
Sylaina 6 years ago committed by GitHub
parent 38a874c498
commit 6014d0996f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

15
lcd.c

@ -174,17 +174,22 @@ void lcd_set_contrast(uint8_t contrast){
lcd_command(commandSequence, sizeof(commandSequence)); lcd_command(commandSequence, sizeof(commandSequence));
} }
void lcd_putc(char c){ void lcd_putc(char c){
#ifdef BIGCHAR
uint8_t control = 2;
#else
uint8_t control = 1;
#endif
switch (c) { switch (c) {
case '\b': case '\b':
// backspace // backspace
lcd_gotoxy(cursorPosition.x-1, cursorPosition.y); lcd_gotoxy(cursorPosition.x-control, cursorPosition.y);
lcd_putc(' '); lcd_putc(' ');
lcd_gotoxy(cursorPosition.x-1, cursorPosition.y); lcd_gotoxy(cursorPosition.x-control, cursorPosition.y);
break; break;
case '\t': case '\t':
// tab // tab
if( (cursorPosition.x+4) < (DISPLAY_WIDTH/ sizeof(FONT[0])-4) ){ if( (cursorPosition.x+control*4) < (DISPLAY_WIDTH/ sizeof(FONT[0])-control*4) ){
lcd_gotoxy(cursorPosition.x+4, cursorPosition.y); lcd_gotoxy(cursorPosition.x+control*4, cursorPosition.y);
}else{ }else{
lcd_gotoxy(DISPLAY_WIDTH/ sizeof(FONT[0]), cursorPosition.y); lcd_gotoxy(DISPLAY_WIDTH/ sizeof(FONT[0]), cursorPosition.y);
} }
@ -192,7 +197,7 @@ void lcd_putc(char c){
case '\n': case '\n':
// linefeed // linefeed
if(cursorPosition.y < (DISPLAY_HEIGHT/8-1)){ if(cursorPosition.y < (DISPLAY_HEIGHT/8-1)){
lcd_gotoxy(cursorPosition.x, ++cursorPosition.y); lcd_gotoxy(cursorPosition.x, cursorPosition.y+control);
} }
break; break;
case '\r': case '\r':

Loading…
Cancel
Save