diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/lcd.c | 36 | ||||
-rw-r--r-- | firmware/drivers/lcd.h | 10 |
2 files changed, 37 insertions, 9 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]; |
diff --git a/firmware/drivers/lcd.h b/firmware/drivers/lcd.h index 21da38188a..3bbf89a92c 100644 --- a/firmware/drivers/lcd.h +++ b/firmware/drivers/lcd.h | |||
@@ -28,6 +28,7 @@ | |||
28 | extern void lcd_init(void); | 28 | extern void lcd_init(void); |
29 | extern void lcd_clear_display(void); | 29 | extern void lcd_clear_display(void); |
30 | extern void lcd_backlight(bool on); | 30 | extern void lcd_backlight(bool on); |
31 | extern void lcd_puts(int x, int y, char *string); | ||
31 | 32 | ||
32 | #ifdef HAVE_LCD_CHARCELLS | 33 | #ifdef HAVE_LCD_CHARCELLS |
33 | # define LCD_ICON_BATTERY 0 | 34 | # define LCD_ICON_BATTERY 0 |
@@ -60,7 +61,6 @@ extern void lcd_backlight(bool on); | |||
60 | # define LCD_ICON_PARAM 10 | 61 | # define LCD_ICON_PARAM 10 |
61 | # define LCD_PARAM_SYMBOL 0xF0 | 62 | # define LCD_PARAM_SYMBOL 0xF0 |
62 | 63 | ||
63 | extern void lcd_puts(int x, int y, char *string); | ||
64 | extern void lcd_define_pattern (int which,char *pattern,int length); | 64 | extern void lcd_define_pattern (int which,char *pattern,int length); |
65 | 65 | ||
66 | #endif | 66 | #endif |
@@ -73,8 +73,11 @@ extern void lcd_define_pattern (int which,char *pattern,int length); | |||
73 | #define LCD_WIDTH 112 /* Display width in pixels */ | 73 | #define LCD_WIDTH 112 /* Display width in pixels */ |
74 | #define LCD_HEIGHT 64 /* Display height in pixels */ | 74 | #define LCD_HEIGHT 64 /* Display height in pixels */ |
75 | 75 | ||
76 | extern void lcd_update (void); | 76 | extern void lcd_update(void); |
77 | extern void lcd_puts(int x, int y, char *str, int font); | 77 | extern void lcd_putsxy(int x, int y, char *string, int font); |
78 | extern void lcd_setfont(int font); | ||
79 | extern void lcd_getfontsize(int font, int *width, int *height); | ||
80 | extern void lcd_setmargins(int xmargin, int ymargin); | ||
78 | extern void lcd_bitmap (unsigned char *src, int x, int y, int nx, int ny, | 81 | extern void lcd_bitmap (unsigned char *src, int x, int y, int nx, int ny, |
79 | bool clear); | 82 | bool clear); |
80 | extern void lcd_clearrect (int x, int y, int nx, int ny); | 83 | extern void lcd_clearrect (int x, int y, int nx, int ny); |
@@ -85,7 +88,6 @@ extern void lcd_drawline( int x1, int y1, int x2, int y2 ); | |||
85 | extern void lcd_drawpixel(int x, int y); | 88 | extern void lcd_drawpixel(int x, int y); |
86 | extern void lcd_clearpixel(int x, int y); | 89 | extern void lcd_clearpixel(int x, int y); |
87 | 90 | ||
88 | void lcd_fontsize(char font, char *width, char *height); | ||
89 | 91 | ||
90 | #if defined(HAVE_LCD_CHARCELLS) && defined(SIMULATOR) | 92 | #if defined(HAVE_LCD_CHARCELLS) && defined(SIMULATOR) |
91 | #include <charundef.h> | 93 | #include <charundef.h> |