LibDriver GT30L32S4W
Loading...
Searching...
No Matches
driver_gt30l32s4w_basic.c
Go to the documentation of this file.
1
36
38
39static gt30l32s4w_handle_t gs_handle;
40
49{
50 uint8_t res;
51
52 /* link function */
59
60 /* gt30l32s4w init */
61 res = gt30l32s4w_init(&gs_handle);
62 if (res != 0)
63 {
64 gt30l32s4w_interface_debug_print("gt30l32s4w: init failed.\n");
65
66 return 1;
67 }
68
69 /* set default mode */
71 if (res != 0)
72 {
73 gt30l32s4w_interface_debug_print("gt30l32s4w: set mode failed.\n");
74 (void)gt30l32s4w_deinit(&gs_handle);
75
76 return 1;
77 }
78
79 return 0;
80}
81
90{
91 /* deinit */
92 if (gt30l32s4w_deinit(&gs_handle) != 0)
93 {
94 return 1;
95 }
96
97 return 0;
98}
99
110uint8_t gt30l32s4w_basic_print_pattern(gt30l32s4w_type_t type, uint8_t *buf, uint8_t len)
111{
112 /* print pattern */
113 if (gt30l32s4w_print_pattern(&gs_handle, type, buf, len) != 0)
114 {
115 return 1;
116 }
117
118 return 0;
119}
120
131uint8_t gt30l32s4w_basic_read_12(uint16_t ch, uint8_t buf[24], uint8_t *len)
132{
133 uint8_t msb;
134 uint8_t lsb;
135
136 /* get msb and lsb */
137 msb = (ch >> 8) & 0xFF;
138 lsb = (ch >> 0) & 0xFF;
139
140 /* ascii */
141 if ((ch >= 0x20) && (ch <= 0x7E))
142 {
143 if (gt30l32s4w_read_ascii_6x12(&gs_handle, ch, buf) != 0)
144 {
145 return 1;
146 }
147 *len = 12;
148
149 return 0;
150 }
151 /* char */
152 else if (((msb >= 0xA1) && (msb <= 0xA9) && (lsb >= 0xA1)) ||
153 ((msb >= 0xB0) && (msb <= 0xF7) && (lsb >= 0xA1)))
154 {
155 if (gt30l32s4w_read_char_12x12(&gs_handle, ch, buf) != 0)
156 {
157 return 1;
158 }
159 *len = 24;
160
161 return 0;
162 }
163 /* extend char */
164 else if (((ch >= 0xAAA1U) && (ch <= 0xAAFEU)) ||
165 ((ch >= 0xABA1U) && (ch <= 0xABC0U)))
166 {
167 if (gt30l32s4w_read_char_extend_6x12(&gs_handle, ch, buf) != 0)
168 {
169 return 1;
170 }
171 *len = 12;
172
173 return 0;
174 }
175 else
176 {
177 return 2;
178 }
179}
180
191uint8_t gt30l32s4w_basic_read_16(uint16_t ch, uint8_t buf[32], uint8_t *len)
192{
193 uint8_t msb;
194 uint8_t lsb;
195
196 /* get msb and lsb */
197 msb = (ch >> 8) & 0xFF;
198 lsb = (ch >> 0) & 0xFF;
199
200 /* ascii */
201 if ((ch >= 0x20) && (ch <= 0x7E))
202 {
203 if (gt30l32s4w_read_ascii_8x16(&gs_handle, ch, buf) != 0)
204 {
205 return 1;
206 }
207 *len = 16;
208
209 return 0;
210 }
211 /* char */
212 else if (((msb >= 0xA1) && (msb <= 0xA9) && (lsb >= 0xA1)) ||
213 ((msb >= 0xB0) && (msb <= 0xF7) && (lsb >= 0xA1)))
214 {
215 if (gt30l32s4w_read_char_15x16(&gs_handle, ch, buf) != 0)
216 {
217 return 1;
218 }
219 *len = 32;
220
221 return 0;
222 }
223 /* extend char */
224 else if (((ch >= 0xAAA1U) && (ch <= 0xAAFEU)) ||
225 ((ch >= 0xABA1U) && (ch <= 0xABC0U)))
226 {
227 if (gt30l32s4w_read_char_extend_8x16(&gs_handle, ch, buf) != 0)
228 {
229 return 1;
230 }
231 *len = 16;
232
233 return 0;
234 }
235 /* special char */
236 else if ((ch >= 0xACA1U) && (ch <= 0xACDFU))
237 {
238 if (gt30l32s4w_read_char_special_8x16(&gs_handle, ch, buf) != 0)
239 {
240 return 1;
241 }
242 *len = 16;
243
244 return 0;
245 }
246 else
247 {
248 return 2;
249 }
250}
251
262uint8_t gt30l32s4w_basic_read_24(uint16_t ch, uint8_t buf[72], uint8_t *len)
263{
264 uint8_t msb;
265 uint8_t lsb;
266
267 /* get msb and lsb */
268 msb = (ch >> 8) & 0xFF;
269 lsb = (ch >> 0) & 0xFF;
270
271 /* ascii */
272 if ((ch >= 0x20) && (ch <= 0x7E))
273 {
274 if (gt30l32s4w_read_ascii_12x24(&gs_handle, ch, buf) != 0)
275 {
276 return 1;
277 }
278 *len = 48;
279
280 return 0;
281 }
282 /* char */
283 else if (((msb >= 0xA1) && (msb <= 0xA9) && (lsb >= 0xA1)) ||
284 ((msb >= 0xB0) && (msb <= 0xF7) && (lsb >= 0xA1)))
285 {
286 if (gt30l32s4w_read_char_24x24(&gs_handle, ch, buf) != 0)
287 {
288 return 1;
289 }
290 *len = 72;
291
292 return 0;
293 }
294 /* extend char */
295 else if (((ch >= 0xAAA1U) && (ch <= 0xAAFEU)) ||
296 ((ch >= 0xABA1U) && (ch <= 0xABC0U)))
297 {
298 if (gt30l32s4w_read_char_extend_12x24(&gs_handle, ch, buf) != 0)
299 {
300 return 1;
301 }
302 *len = 48;
303
304 return 0;
305 }
306 else
307 {
308 return 2;
309 }
310}
311
322uint8_t gt30l32s4w_basic_read_32(uint16_t ch, uint8_t buf[128], uint8_t *len)
323{
324 uint8_t msb;
325 uint8_t lsb;
326
327 /* get msb and lsb */
328 msb = (ch >> 8) & 0xFF;
329 lsb = (ch >> 0) & 0xFF;
330
331 /* ascii */
332 if ((ch >= 0x20) && (ch <= 0x7E))
333 {
334 if (gt30l32s4w_read_ascii_16x32(&gs_handle, ch, buf) != 0)
335 {
336 return 1;
337 }
338 *len = 64;
339
340 return 0;
341 }
342 /* char */
343 else if (((msb >= 0xA1) && (msb <= 0xA9) && (lsb >= 0xA1)) ||
344 ((msb >= 0xB0) && (msb <= 0xF7) && (lsb >= 0xA1)))
345 {
346 if (gt30l32s4w_read_char_32x32(&gs_handle, ch, buf) != 0)
347 {
348 return 1;
349 }
350 *len = 128;
351
352 return 0;
353 }
354 /* extend char */
355 else if (((ch >= 0xAAA1U) && (ch <= 0xAAFEU)) ||
356 ((ch >= 0xABA1U) && (ch <= 0xABC0U)))
357 {
358 if (gt30l32s4w_read_char_extend_16x32(&gs_handle, ch, buf) != 0)
359 {
360 return 1;
361 }
362 *len = 64;
363
364 return 0;
365 }
366 else
367 {
368 return 2;
369 }
370}
371
381uint8_t gt30l32s4w_basic_read_ascii_7(uint16_t ch, uint8_t buf[8])
382{
383 /* read ascii 7 */
384 if (gt30l32s4w_read_ascii_5x7(&gs_handle, ch, buf) != 0)
385 {
386 return 1;
387 }
388
389 return 0;
390}
391
401uint8_t gt30l32s4w_basic_read_ascii_8(uint16_t ch, uint8_t buf[8])
402{
403 /* read ascii 8 */
404 if (gt30l32s4w_read_ascii_7x8(&gs_handle, ch, buf) != 0)
405 {
406 return 1;
407 }
408
409 return 0;
410}
411
423{
424 /* arial type */
425 if (type == GT30L32S4W_BASIC_TYPE_ARIAL)
426 {
427 if (gt30l32s4w_read_ascii_arial_12(&gs_handle, ch, buf) != 0)
428 {
429 return 1;
430 }
431
432 return 0;
433 }
434 /* times type */
435 else
436 {
437 if (gt30l32s4w_read_ascii_times_12(&gs_handle, ch, buf) != 0)
438 {
439 return 1;
440 }
441
442 return 0;
443 }
444}
445
457{
458 /* arial type */
459 if (type == GT30L32S4W_BASIC_TYPE_ARIAL)
460 {
461 if (gt30l32s4w_read_ascii_arial_16(&gs_handle, ch, buf) != 0)
462 {
463 return 1;
464 }
465
466 return 0;
467 }
468 /* times type */
469 else
470 {
471 if (gt30l32s4w_read_ascii_times_16(&gs_handle, ch, buf) != 0)
472 {
473 return 1;
474 }
475
476 return 0;
477 }
478}
479
491{
492 /* arial type */
493 if (type == GT30L32S4W_BASIC_TYPE_ARIAL)
494 {
495 if (gt30l32s4w_read_ascii_arial_24(&gs_handle, ch, buf) != 0)
496 {
497 return 1;
498 }
499
500 return 0;
501 }
502 /* times type */
503 else
504 {
505 if (gt30l32s4w_read_ascii_times_24(&gs_handle, ch, buf) != 0)
506 {
507 return 1;
508 }
509
510 return 0;
511 }
512}
513
524uint8_t gt30l32s4w_basic_read_ascii_32_with_length(gt30l32s4w_basic_type_t type, uint16_t ch, uint8_t buf[130])
525{
526 /* arial type */
527 if (type == GT30L32S4W_BASIC_TYPE_ARIAL)
528 {
529 if (gt30l32s4w_read_ascii_arial_32(&gs_handle, ch, buf) != 0)
530 {
531 return 1;
532 }
533
534 return 0;
535 }
536 /* times type */
537 else
538 {
539 if (gt30l32s4w_read_ascii_times_32(&gs_handle, ch, buf) != 0)
540 {
541 return 1;
542 }
543
544 return 0;
545 }
546}
driver gt30l32s4w basic header file
uint8_t gt30l32s4w_read_char_extend_8x16(gt30l32s4w_handle_t *handle, uint16_t ch, uint8_t buf[16])
read char extend 8x16
uint8_t gt30l32s4w_read_ascii_5x7(gt30l32s4w_handle_t *handle, uint16_t ch, uint8_t buf[8])
read ascii 5x7
uint8_t gt30l32s4w_read_ascii_arial_24(gt30l32s4w_handle_t *handle, uint16_t ch, uint8_t buf[74])
read ascii arial 24
uint8_t gt30l32s4w_read_ascii_times_12(gt30l32s4w_handle_t *handle, uint16_t ch, uint8_t buf[26])
read ascii times 12
uint8_t gt30l32s4w_read_ascii_arial_32(gt30l32s4w_handle_t *handle, uint16_t ch, uint8_t buf[130])
read ascii arial 32
uint8_t gt30l32s4w_read_char_12x12(gt30l32s4w_handle_t *handle, uint16_t ch, uint8_t buf[24])
read char 12x12
uint8_t gt30l32s4w_read_char_24x24(gt30l32s4w_handle_t *handle, uint16_t ch, uint8_t buf[72])
read char 24x24
uint8_t gt30l32s4w_set_mode(gt30l32s4w_handle_t *handle, gt30l32s4w_mode_t mode)
set mode
uint8_t gt30l32s4w_read_char_extend_12x24(gt30l32s4w_handle_t *handle, uint16_t ch, uint8_t buf[48])
read char extend 12x24
uint8_t gt30l32s4w_read_ascii_times_32(gt30l32s4w_handle_t *handle, uint16_t ch, uint8_t buf[130])
read ascii times 32
uint8_t gt30l32s4w_init(gt30l32s4w_handle_t *handle)
initialize the chip
uint8_t gt30l32s4w_read_char_extend_6x12(gt30l32s4w_handle_t *handle, uint16_t ch, uint8_t buf[12])
read char extend 6x12
uint8_t gt30l32s4w_read_ascii_16x32(gt30l32s4w_handle_t *handle, uint16_t ch, uint8_t buf[64])
read ascii 16x32
uint8_t gt30l32s4w_deinit(gt30l32s4w_handle_t *handle)
close the chip
uint8_t gt30l32s4w_read_char_extend_16x32(gt30l32s4w_handle_t *handle, uint16_t ch, uint8_t buf[64])
read char extend 16x32
uint8_t gt30l32s4w_read_ascii_times_24(gt30l32s4w_handle_t *handle, uint16_t ch, uint8_t buf[74])
read ascii times 24
uint8_t gt30l32s4w_read_ascii_12x24(gt30l32s4w_handle_t *handle, uint16_t ch, uint8_t buf[48])
read ascii 12x24
uint8_t gt30l32s4w_print_pattern(gt30l32s4w_handle_t *handle, gt30l32s4w_type_t type, uint8_t *buf, uint8_t len)
print pattern
uint8_t gt30l32s4w_read_char_15x16(gt30l32s4w_handle_t *handle, uint16_t ch, uint8_t buf[32])
read char 15x16
uint8_t gt30l32s4w_read_char_special_8x16(gt30l32s4w_handle_t *handle, uint16_t ch, uint8_t buf[16])
read char special 8x16
uint8_t gt30l32s4w_read_ascii_6x12(gt30l32s4w_handle_t *handle, uint16_t ch, uint8_t buf[12])
read ascii 6x12
uint8_t gt30l32s4w_read_ascii_arial_16(gt30l32s4w_handle_t *handle, uint16_t ch, uint8_t buf[34])
read ascii arial 16
uint8_t gt30l32s4w_read_ascii_7x8(gt30l32s4w_handle_t *handle, uint16_t ch, uint8_t buf[8])
read ascii 7x8
gt30l32s4w_type_t
gt30l32s4w type enumeration definition
struct gt30l32s4w_handle_s gt30l32s4w_handle_t
gt30l32s4w handle structure definition
uint8_t gt30l32s4w_read_ascii_times_16(gt30l32s4w_handle_t *handle, uint16_t ch, uint8_t buf[34])
read ascii times 16
uint8_t gt30l32s4w_read_ascii_arial_12(gt30l32s4w_handle_t *handle, uint16_t ch, uint8_t buf[26])
read ascii arial 12
uint8_t gt30l32s4w_read_ascii_8x16(gt30l32s4w_handle_t *handle, uint16_t ch, uint8_t buf[16])
read ascii 8x16
uint8_t gt30l32s4w_read_char_32x32(gt30l32s4w_handle_t *handle, uint16_t ch, uint8_t buf[128])
read char 32x32
uint8_t gt30l32s4w_basic_read_16(uint16_t ch, uint8_t buf[32], uint8_t *len)
basic example read 16
#define GT30L32S4W_BASIC_DEFAULT_MODE
gt30l32s4w basic example default definition
uint8_t gt30l32s4w_basic_read_ascii_8(uint16_t ch, uint8_t buf[8])
read ascii 8
uint8_t gt30l32s4w_basic_read_ascii_24_with_length(gt30l32s4w_basic_type_t type, uint16_t ch, uint8_t buf[74])
read ascii 24 with length
gt30l32s4w_basic_type_t
gt30l32s4w basic type enumeration definition
uint8_t gt30l32s4w_basic_read_ascii_16_with_length(gt30l32s4w_basic_type_t type, uint16_t ch, uint8_t buf[34])
read ascii 16 with length
uint8_t gt30l32s4w_basic_deinit(void)
basic example deinit
uint8_t gt30l32s4w_basic_read_32(uint16_t ch, uint8_t buf[128], uint8_t *len)
basic example read 32
uint8_t gt30l32s4w_basic_read_ascii_7(uint16_t ch, uint8_t buf[8])
read ascii 7
uint8_t gt30l32s4w_basic_read_ascii_32_with_length(gt30l32s4w_basic_type_t type, uint16_t ch, uint8_t buf[130])
read ascii 32 with length
uint8_t gt30l32s4w_basic_init(void)
basic example init
uint8_t gt30l32s4w_basic_print_pattern(gt30l32s4w_type_t type, uint8_t *buf, uint8_t len)
basic example print pattern
uint8_t gt30l32s4w_basic_read_ascii_12_with_length(gt30l32s4w_basic_type_t type, uint16_t ch, uint8_t buf[26])
read ascii 12 with length
uint8_t gt30l32s4w_basic_read_12(uint16_t ch, uint8_t buf[24], uint8_t *len)
basic example read 12
uint8_t gt30l32s4w_basic_read_24(uint16_t ch, uint8_t buf[72], uint8_t *len)
basic example read 24
@ GT30L32S4W_BASIC_TYPE_ARIAL
uint8_t gt30l32s4w_interface_spi_deinit(void)
interface spi bus deinit
void gt30l32s4w_interface_debug_print(const char *const fmt,...)
interface print format data
uint8_t gt30l32s4w_interface_spi_init(void)
interface spi bus init
void gt30l32s4w_interface_delay_ms(uint32_t ms)
interface delay ms
uint8_t gt30l32s4w_interface_spi_write_read(uint8_t *in_buf, uint32_t in_len, uint8_t *out_buf, uint32_t out_len)
interface spi bus write read