diff options
Diffstat (limited to 'firmware/drivers/lcd.c')
-rw-r--r-- | firmware/drivers/lcd.c | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/firmware/drivers/lcd.c b/firmware/drivers/lcd.c index 66b1c682e7..d0e2c623de 100644 --- a/firmware/drivers/lcd.c +++ b/firmware/drivers/lcd.c | |||
@@ -370,6 +370,10 @@ void lcd_define_pattern (int which,char *pattern,int length) | |||
370 | */ | 370 | */ |
371 | unsigned char display[LCD_WIDTH][LCD_HEIGHT/8]; | 371 | unsigned char display[LCD_WIDTH][LCD_HEIGHT/8]; |
372 | 372 | ||
373 | static int font=0; | ||
374 | static int xmargin=0; | ||
375 | static int ymargin=0; | ||
376 | |||
373 | /* | 377 | /* |
374 | * ASCII character generation tables | 378 | * ASCII character generation tables |
375 | * | 379 | * |
@@ -445,13 +449,35 @@ void lcd_clear_display (void) | |||
445 | memset (display, 0, sizeof display); | 449 | memset (display, 0, sizeof display); |
446 | } | 450 | } |
447 | 451 | ||
452 | void lcd_setfont(int newfont) | ||
453 | { | ||
454 | font = newfont; | ||
455 | } | ||
456 | |||
457 | void lcd_setmargins(int x, int y) | ||
458 | { | ||
459 | xmargin = x; | ||
460 | ymargin = y; | ||
461 | } | ||
462 | |||
448 | /* | 463 | /* |
449 | * Put a string at specified position and font | 464 | * Put a string at specified character position |
450 | */ | 465 | */ |
451 | void lcd_puts(int x, int y, char *str, int font) | 466 | void lcd_puts(int x, int y, char *str) |
467 | { | ||
468 | lcd_putsxy( xmargin + x*fonts[font], | ||
469 | ymargin + y*fontheight[font], | ||
470 | str, font ); | ||
471 | } | ||
472 | |||
473 | /* | ||
474 | * Put a string at specified bit position | ||
475 | */ | ||
476 | |||
477 | void lcd_putsxy(int x, int y, char *str, int thisfont) | ||
452 | { | 478 | { |
453 | int nx = fonts[font]; | 479 | int nx = fonts[thisfont]; |
454 | int ny = fontheight[font]; | 480 | int ny = fontheight[thisfont]; |
455 | int ch; | 481 | int ch; |
456 | unsigned char *src; | 482 | unsigned char *src; |
457 | int lcd_x = x; | 483 | int lcd_x = x; |
@@ -680,7 +706,7 @@ void lcd_clearpixel(int x, int y) | |||
680 | /* | 706 | /* |
681 | * Return width and height of a given font. | 707 | * Return width and height of a given font. |
682 | */ | 708 | */ |
683 | void lcd_fontsize(char font, char *width, char *height) | 709 | void lcd_getfontsize(int font, int *width, int *height) |
684 | { | 710 | { |
685 | if(font < sizeof(fonts)) { | 711 | if(font < sizeof(fonts)) { |
686 | *width = fonts[font]; | 712 | *width = fonts[font]; |