summaryrefslogtreecommitdiff
path: root/firmware/drivers/lcd.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/lcd.c')
-rw-r--r--firmware/drivers/lcd.c36
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 */
371unsigned char display[LCD_WIDTH][LCD_HEIGHT/8]; 371unsigned char display[LCD_WIDTH][LCD_HEIGHT/8];
372 372
373static int font=0;
374static int xmargin=0;
375static 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
452void lcd_setfont(int newfont)
453{
454 font = newfont;
455}
456
457void 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 */
451void lcd_puts(int x, int y, char *str, int font) 466void 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
477void 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 */
683void lcd_fontsize(char font, char *width, char *height) 709void 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];