diff options
Diffstat (limited to 'uisimulator')
-rw-r--r-- | uisimulator/common/stubs.c | 50 |
1 files changed, 43 insertions, 7 deletions
diff --git a/uisimulator/common/stubs.c b/uisimulator/common/stubs.c index dee86b078f..11c1b827d4 100644 --- a/uisimulator/common/stubs.c +++ b/uisimulator/common/stubs.c | |||
@@ -24,6 +24,9 @@ | |||
24 | #include "button.h" | 24 | #include "button.h" |
25 | #include "menu.h" | 25 | #include "menu.h" |
26 | 26 | ||
27 | #include "string.h" | ||
28 | #include "lcd.h" | ||
29 | |||
27 | void backlight_on(void) | 30 | void backlight_on(void) |
28 | { | 31 | { |
29 | /* we could do something better here! */ | 32 | /* we could do something better here! */ |
@@ -106,18 +109,51 @@ bool simulate_usb(void) | |||
106 | return false; | 109 | return false; |
107 | } | 110 | } |
108 | 111 | ||
109 | void lcd_define_pattern (int which,char *pattern,int length) | 112 | static char patterns[8][7]; |
113 | |||
114 | void lcd_define_pattern(int which, char *pattern, int length) | ||
110 | { | 115 | { |
111 | (void)which; | 116 | int i, j; |
112 | (void)pattern; | 117 | int pat = which / 8; |
113 | (void)length; | 118 | char icon[8]; |
119 | memset(icon, 0, sizeof icon); | ||
120 | |||
121 | DEBUGF("Defining pattern %d\n", pat); | ||
122 | for (j = 0; j <= 5; j++) { | ||
123 | for (i = 0; i < length; i++) { | ||
124 | if ((pattern[i])&(1<<(j))) | ||
125 | icon[j] |= (1<<(i)); | ||
126 | } | ||
127 | } | ||
128 | for (i = 0; i <= 5; i++) | ||
129 | { | ||
130 | patterns[pat][i] = icon[i]; | ||
131 | } | ||
114 | } | 132 | } |
115 | 133 | ||
134 | char* get_lcd_pattern(int which) | ||
135 | { | ||
136 | DEBUGF("Get pattern %d\n", which); | ||
137 | return patterns[which]; | ||
138 | } | ||
139 | |||
140 | extern void lcd_puts(int x, int y, unsigned char *str); | ||
141 | |||
116 | void lcd_putc(int x, int y, unsigned char ch) | 142 | void lcd_putc(int x, int y, unsigned char ch) |
117 | { | 143 | { |
118 | (void)x; | 144 | static char str[2] = "x"; |
119 | (void)y; | 145 | if (ch <= 8) |
120 | (void)ch; | 146 | { |
147 | char* bm = get_lcd_pattern(ch); | ||
148 | lcd_bitmap(bm, x * 6, (y * 8) + 8, 6, 8, true); | ||
149 | return; | ||
150 | } | ||
151 | if (ch == 137) { | ||
152 | /* Have no good font yet. Simulate the cursor character. */ | ||
153 | ch = '>'; | ||
154 | } | ||
155 | str[0] = ch; | ||
156 | lcd_puts(x, y, str); | ||
121 | } | 157 | } |
122 | 158 | ||
123 | void lcd_set_contrast( int x ) | 159 | void lcd_set_contrast( int x ) |