4 static unsigned char const fontdata
[][BADGE_FONT_GLYPH_WIDTH
] = {
5 { 0x00, 0x00, 0x4f, 0x00, 0x00 },
6 { 0x00, 0x07, 0x00, 0x07, 0x00 },
7 { 0x14, 0x7f, 0x14, 0x7f, 0x14 },
8 { 0x24, 0x2a, 0x7f, 0x2a, 0x12 },
9 { 0x23, 0x13, 0x08, 0x64, 0x62 },
10 { 0x36, 0x49, 0x55, 0x22, 0x50 },
11 { 0x00, 0x05, 0x03, 0x00, 0x00 },
12 { 0x00, 0x1c, 0x22, 0x41, 0x00 },
13 { 0x00, 0x41, 0x22, 0x1c, 0x00 },
14 { 0x08, 0x2a, 0x1c, 0x2a, 0x08 },
15 { 0x08, 0x08, 0x3e, 0x08, 0x08 },
16 { 0x00, 0x50, 0x30, 0x00, 0x00 },
17 { 0x08, 0x08, 0x08, 0x08, 0x08 },
18 { 0x00, 0x30, 0x30, 0x00, 0x00 },
19 { 0x20, 0x10, 0x08, 0x04, 0x02 },
20 { 0x3e, 0x51, 0x49, 0x45, 0x3e },
21 { 0x00, 0x42, 0x7f, 0x40, 0x00 },
22 { 0x42, 0x61, 0x51, 0x49, 0x46 },
23 { 0x21, 0x41, 0x45, 0x4b, 0x31 },
24 { 0x18, 0x14, 0x12, 0x7f, 0x10 },
25 { 0x27, 0x45, 0x45, 0x45, 0x39 },
26 { 0x3c, 0x4a, 0x49, 0x49, 0x30 },
27 { 0x01, 0x71, 0x09, 0x05, 0x03 },
28 { 0x36, 0x49, 0x49, 0x49, 0x36 },
29 { 0x06, 0x49, 0x49, 0x29, 0x1e },
30 { 0x00, 0x36, 0x36, 0x00, 0x00 },
31 { 0x00, 0x56, 0x36, 0x00, 0x00 },
32 { 0x00, 0x08, 0x14, 0x22, 0x41 },
33 { 0x14, 0x14, 0x14, 0x14, 0x14 },
34 { 0x41, 0x22, 0x14, 0x08, 0x00 },
35 { 0x02, 0x01, 0x51, 0x09, 0x06 },
36 { 0x32, 0x49, 0x79, 0x41, 0x3e },
37 { 0x7e, 0x11, 0x11, 0x11, 0x7e },
38 { 0x7f, 0x49, 0x49, 0x49, 0x36 },
39 { 0x3e, 0x41, 0x41, 0x41, 0x22 },
40 { 0x7f, 0x41, 0x41, 0x22, 0x1c },
41 { 0x7f, 0x49, 0x49, 0x49, 0x41 },
42 { 0x7f, 0x09, 0x09, 0x01, 0x01 },
43 { 0x3e, 0x41, 0x41, 0x51, 0x32 },
44 { 0x7f, 0x08, 0x08, 0x08, 0x7f },
45 { 0x00, 0x41, 0x7f, 0x41, 0x00 },
46 { 0x20, 0x40, 0x41, 0x3f, 0x01 },
47 { 0x7f, 0x08, 0x14, 0x22, 0x41 },
48 { 0x7f, 0x40, 0x40, 0x40, 0x40 },
49 { 0x7f, 0x02, 0x04, 0x02, 0x7f },
50 { 0x7f, 0x04, 0x08, 0x10, 0x7f },
51 { 0x3e, 0x41, 0x41, 0x41, 0x3e },
52 { 0x7f, 0x09, 0x09, 0x09, 0x06 },
53 { 0x3e, 0x41, 0x51, 0x21, 0x5e },
54 { 0x7f, 0x09, 0x19, 0x29, 0x46 },
55 { 0x46, 0x49, 0x49, 0x49, 0x31 },
56 { 0x01, 0x01, 0x7f, 0x01, 0x01 },
57 { 0x3f, 0x40, 0x40, 0x40, 0x3f },
58 { 0x1f, 0x20, 0x40, 0x20, 0x1f },
59 { 0x7f, 0x20, 0x18, 0x20, 0x7f },
60 { 0x63, 0x14, 0x08, 0x14, 0x63 },
61 { 0x03, 0x04, 0x78, 0x04, 0x03 },
62 { 0x61, 0x51, 0x49, 0x45, 0x43 },
63 { 0x00, 0x00, 0x7f, 0x41, 0x41 },
64 { 0x02, 0x04, 0x08, 0x10, 0x20 },
65 { 0x41, 0x41, 0x7f, 0x00, 0x00 },
66 { 0x04, 0x02, 0x01, 0x02, 0x04 },
67 { 0x40, 0x40, 0x40, 0x40, 0x40 },
68 { 0x00, 0x01, 0x02, 0x04, 0x00 },
69 { 0x20, 0x54, 0x54, 0x54, 0x78 },
70 { 0x7f, 0x48, 0x44, 0x44, 0x38 },
71 { 0x38, 0x44, 0x44, 0x44, 0x20 },
72 { 0x38, 0x44, 0x44, 0x48, 0x7f },
73 { 0x38, 0x54, 0x54, 0x54, 0x18 },
74 { 0x08, 0x7e, 0x09, 0x01, 0x02 },
75 { 0x08, 0x14, 0x54, 0x54, 0x3c },
76 { 0x7f, 0x08, 0x04, 0x04, 0x78 },
77 { 0x00, 0x44, 0x7d, 0x40, 0x00 },
78 { 0x20, 0x40, 0x44, 0x3d, 0x00 },
79 { 0x00, 0x7f, 0x10, 0x28, 0x44 },
80 { 0x00, 0x41, 0x7f, 0x40, 0x00 },
81 { 0x7c, 0x04, 0x18, 0x04, 0x78 },
82 { 0x7c, 0x08, 0x04, 0x04, 0x78 },
83 { 0x38, 0x44, 0x44, 0x44, 0x38 },
84 { 0x7c, 0x14, 0x14, 0x14, 0x08 },
85 { 0x08, 0x14, 0x14, 0x18, 0x7c },
86 { 0x7c, 0x08, 0x04, 0x04, 0x08 },
87 { 0x48, 0x54, 0x54, 0x54, 0x20 },
88 { 0x04, 0x3f, 0x44, 0x40, 0x20 },
89 { 0x3c, 0x40, 0x40, 0x20, 0x7c },
90 { 0x1c, 0x20, 0x40, 0x20, 0x1c },
91 { 0x3c, 0x40, 0x30, 0x40, 0x3c },
92 { 0x44, 0x28, 0x10, 0x28, 0x44 },
93 { 0x0c, 0x50, 0x50, 0x50, 0x3c },
94 { 0x44, 0x64, 0x54, 0x4c, 0x44 },
95 { 0x00, 0x08, 0x36, 0x41, 0x00 },
96 { 0x00, 0x00, 0x7f, 0x00, 0x00 },
97 { 0x00, 0x41, 0x36, 0x08, 0x00 },
98 { 0x10, 0x08, 0x08, 0x10, 0x08 },
99 { 0x78, 0x44, 0x42, 0x44, 0x78 },
100 { 0x14, 0x3e, 0x55, 0x41, 0x22 },
101 { 0x78, 0x14, 0x13, 0x10, 0x7f },
102 { 0x00, 0x50, 0x30, 0x00, 0x00 },
103 { 0x20, 0x48, 0x3e, 0x09, 0x02 },
104 { 0x60, 0x50, 0x00, 0x60, 0x50 },
105 { 0x40, 0x00, 0x40, 0x00, 0x40 },
106 { 0x00, 0x02, 0x7f, 0x02, 0x00 },
107 { 0x00, 0x22, 0x7f, 0x22, 0x00 },
108 { 0x00, 0x02, 0x01, 0x02, 0x00 },
109 { 0x61, 0x69, 0x04, 0x62, 0x61 },
110 { 0x26, 0x49, 0x49, 0x49, 0x32 },
111 { 0x00, 0x08, 0x14, 0x00, 0x00 },
112 { 0x3e, 0x41, 0x41, 0x3e, 0x49 },
113 { 0x01, 0x7f, 0x48, 0x48, 0x30 },
114 { 0x61, 0x51, 0x49, 0x45, 0x43 },
115 { 0x22, 0x49, 0x45, 0x49, 0x3e },
116 { 0x38, 0x44, 0x48, 0x30, 0x4c },
117 { 0x00, 0x01, 0x02, 0x04, 0x00 },
118 { 0x00, 0x04, 0x02, 0x01, 0x00 },
119 { 0x01, 0x02, 0x05, 0x02, 0x04 },
120 { 0x04, 0x02, 0x05, 0x02, 0x01 },
121 { 0x00, 0x1c, 0x1c, 0x1c, 0x00 },
122 { 0x00, 0x08, 0x08, 0x08, 0x08 },
123 { 0x08, 0x08, 0x08, 0x08, 0x08 },
124 { 0x01, 0x00, 0x01, 0x02, 0x01 },
125 { 0x78, 0x2d, 0x2a, 0x28, 0x28 },
126 { 0x48, 0x54, 0x55, 0x54, 0x20 },
127 { 0x00, 0x44, 0x28, 0x10, 0x00 },
128 { 0x38, 0x44, 0x38, 0x54, 0x58 },
129 { 0x1c, 0x3e, 0x7c, 0x3e, 0x1c },
130 { 0x44, 0x64, 0x55, 0x4c, 0x44 },
131 { 0x0e, 0x10, 0x60, 0x10, 0x0e },
132 { 0x00, 0x00, 0x00, 0x00, 0x00 },
133 { 0x00, 0x00, 0x79, 0x00, 0x00 },
134 { 0x1c, 0x22, 0x7f, 0x22, 0x10 },
135 { 0x48, 0x3e, 0x49, 0x41, 0x20 },
136 { 0x22, 0x1c, 0x14, 0x1c, 0x22 },
137 { 0x15, 0x16, 0x7c, 0x16, 0x15 },
138 { 0x00, 0x00, 0x77, 0x00, 0x00 },
139 { 0x20, 0x4a, 0x55, 0x29, 0x02 },
140 { 0x00, 0x01, 0x00, 0x01, 0x00 },
141 { 0x7f, 0x41, 0x5d, 0x49, 0x7f },
142 { 0x48, 0x55, 0x55, 0x55, 0x5e },
143 { 0x10, 0x28, 0x54, 0x28, 0x44 },
144 { 0x10, 0x10, 0x10, 0x10, 0x70 },
145 { 0x10, 0x10, 0x10, 0x10, 0x10 },
146 { 0x7f, 0x41, 0x65, 0x51, 0x7f },
147 { 0x01, 0x01, 0x01, 0x01, 0x01 },
148 { 0x07, 0x08, 0x08, 0x07, 0x00 },
149 { 0x44, 0x44, 0x5f, 0x44, 0x44 },
150 { 0x09, 0x0c, 0x0a, 0x09, 0x00 },
151 { 0x08, 0x0a, 0x0a, 0x05, 0x00 },
152 { 0x00, 0x04, 0x02, 0x01, 0x00 },
153 { 0x7f, 0x10, 0x10, 0x08, 0x1f },
154 { 0x06, 0x09, 0x09, 0x7f, 0x7f },
155 { 0x00, 0x18, 0x18, 0x00, 0x00 },
156 { 0x00, 0x40, 0x58, 0x20, 0x00 },
157 { 0x00, 0x01, 0x07, 0x00, 0x00 },
158 { 0x00, 0x01, 0x02, 0x01, 0x00 },
159 { 0x22, 0x14, 0x2a, 0x14, 0x08 },
160 { 0x11, 0x0f, 0x34, 0x2a, 0x7d },
161 { 0x01, 0x0f, 0x48, 0x64, 0x58 },
162 { 0x0a, 0x0f, 0x30, 0x28, 0x7c },
163 { 0x30, 0x48, 0x45, 0x40, 0x20 },
164 { 0x78, 0x14, 0x13, 0x14, 0x78 },
165 { 0x78, 0x14, 0x13, 0x14, 0x78 },
166 { 0x78, 0x15, 0x14, 0x15, 0x78 },
167 { 0x79, 0x14, 0x14, 0x15, 0x78 },
168 { 0x78, 0x14, 0x12, 0x14, 0x78 },
169 { 0x78, 0x15, 0x16, 0x15, 0x78 },
170 { 0x7c, 0x12, 0x7f, 0x49, 0x49 },
171 { 0x0f, 0x10, 0x50, 0x70, 0x09 },
172 { 0x7c, 0x54, 0x55, 0x54, 0x44 },
173 { 0x7c, 0x54, 0x55, 0x54, 0x44 },
174 { 0x7c, 0x55, 0x54, 0x55, 0x44 },
175 { 0x7c, 0x55, 0x54, 0x55, 0x44 },
176 { 0x00, 0x44, 0x7d, 0x44, 0x00 },
177 { 0x00, 0x44, 0x7d, 0x44, 0x00 },
178 { 0x00, 0x45, 0x7c, 0x45, 0x00 },
179 { 0x00, 0x45, 0x7c, 0x45, 0x00 },
180 { 0x08, 0x7f, 0x49, 0x41, 0x3e },
181 { 0x7d, 0x08, 0x10, 0x21, 0x7c },
182 { 0x3c, 0x42, 0x43, 0x42, 0x3c },
183 { 0x3c, 0x42, 0x43, 0x42, 0x3c },
184 { 0x38, 0x45, 0x44, 0x45, 0x38 },
185 { 0x39, 0x44, 0x44, 0x45, 0x38 },
186 { 0x3c, 0x42, 0x42, 0x42, 0x3c },
187 { 0x22, 0x14, 0x08, 0x14, 0x22 },
188 { 0x08, 0x55, 0x7f, 0x55, 0x08 },
189 { 0x3e, 0x40, 0x41, 0x40, 0x3e },
190 { 0x3e, 0x40, 0x41, 0x40, 0x3e },
191 { 0x3c, 0x41, 0x40, 0x41, 0x3c },
192 { 0x3e, 0x40, 0x40, 0x40, 0x3e },
193 { 0x02, 0x04, 0x79, 0x04, 0x02 },
194 { 0x40, 0x7f, 0x12, 0x12, 0x0c },
195 { 0x40, 0x3e, 0x49, 0x49, 0x36 },
196 { 0x20, 0x54, 0x55, 0x54, 0x78 },
197 { 0x20, 0x54, 0x55, 0x54, 0x78 },
198 { 0x20, 0x55, 0x54, 0x55, 0x78 },
199 { 0x21, 0x54, 0x54, 0x55, 0x78 },
200 { 0x20, 0x55, 0x54, 0x55, 0x78 },
201 { 0x20, 0x55, 0x56, 0x55, 0x78 },
202 { 0x32, 0x4a, 0x3c, 0x4a, 0x2c },
203 { 0x0c, 0x12, 0x52, 0x72, 0x08 },
204 { 0x38, 0x54, 0x55, 0x54, 0x18 },
205 { 0x38, 0x54, 0x55, 0x54, 0x18 },
206 { 0x38, 0x55, 0x54, 0x55, 0x18 },
207 { 0x38, 0x55, 0x54, 0x55, 0x18 },
208 { 0x00, 0x48, 0x7d, 0x40, 0x00 },
209 { 0x00, 0x48, 0x7d, 0x40, 0x00 },
210 { 0x00, 0x49, 0x7c, 0x41, 0x00 },
211 { 0x00, 0x49, 0x7c, 0x41, 0x00 },
212 { 0x25, 0x52, 0x55, 0x58, 0x30 },
213 { 0x7d, 0x08, 0x04, 0x05, 0x78 },
214 { 0x38, 0x44, 0x45, 0x44, 0x38 },
215 { 0x38, 0x44, 0x45, 0x44, 0x38 },
216 { 0x30, 0x4a, 0x49, 0x4a, 0x30 },
217 { 0x32, 0x49, 0x49, 0x4a, 0x31 },
218 { 0x38, 0x45, 0x44, 0x45, 0x38 },
219 { 0x08, 0x08, 0x2a, 0x08, 0x08 },
220 { 0x08, 0x54, 0x3e, 0x15, 0x08 },
221 { 0x3c, 0x40, 0x41, 0x20, 0x7c },
222 { 0x3c, 0x40, 0x41, 0x20, 0x7c },
223 { 0x3c, 0x41, 0x40, 0x21, 0x7c },
224 { 0x3c, 0x41, 0x40, 0x21, 0x7c },
225 { 0x0c, 0x50, 0x52, 0x51, 0x3c },
226 { 0x00, 0x41, 0x7f, 0x54, 0x08 },
227 { 0x0c, 0x51, 0x50, 0x51, 0x3c },
230 uint8_t badge_framebuffer_render_char(badge_framebuffer
*fb
, int8_t pos_x
, int8_t pos_y
, char c
) {
232 // intentionally left empty.
234 badge_sprite sp
= { BADGE_FONT_GLYPH_WIDTH
, BADGE_FONT_HEIGHT
, fontdata
[c
- 33] };
235 badge_framebuffer_blt(fb
, pos_x
, pos_y
, &sp
, 0);
243 uint8_t badge_framebuffer_render_text(badge_framebuffer
*fb
, int8_t pos_x
, int8_t pos_y
, char const *text
) {
247 if(0 != badge_framebuffer_render_char(fb
, pos_x
, pos_y
, *text
)) {
253 pos_x
+= BADGE_FONT_WIDTH
;
259 static uint8_t badge_framebuffer_render_number_aux(badge_framebuffer
*fb
, int8_t *pos_x
, int8_t pos_y
, uint8_t number
) {
261 badge_framebuffer_render_number_aux(fb
, pos_x
, pos_y
, number
/ 10);
264 uint8_t err
= badge_framebuffer_render_char(fb
, *pos_x
, pos_y
, '0' + number
% 10);
266 if(err
!= 0) return err
;
268 *pos_x
+= BADGE_FONT_WIDTH
;
272 uint8_t badge_framebuffer_render_number(badge_framebuffer
*fb
, int8_t pos_x
, int8_t pos_y
, uint8_t number
) {
273 return badge_framebuffer_render_number_aux(fb
, &pos_x
, pos_y
, number
);
This page took 0.080616 seconds and 5 git commands to generate.