XWOS API  4.0
XWOS C/C++ API参考手册
载入中...
搜索中...
未找到
driver.c
浏览该文件的文档.
1
21#include <xwos/standard.h>
22#include <xwos/lib/xwbop.h>
23#include <string.h>
27
28static __xwbsp_code
30 const xwu8_t * data, xwsz_t size,
31 xwtm_t to)
32{
33 struct xwds_st7735_driver * drv;
34
35 drv = xwds_cast(struct xwds_st7735_driver *, st7735->spip.dev.drv);
36 return drv->write(st7735, reg, data, &size, to);
37}
38
39static __xwbsp_code
41 xwu8_t * buf, xwsz_t size,
42 xwtm_t to)
43{
44 struct xwds_st7735_driver * drv;
45
46 drv = xwds_cast(struct xwds_st7735_driver *, st7735->spip.dev.drv);
47 return drv->read(st7735, reg, buf, &size, to);
48}
49
50/******** ******** base driver ******** ********/
55};
56
59 /* software reset */
60 {XWDS_ST7735_SWRESET, 0, {0},},
61 /* Out of sleep mode */
62 {XWDS_ST7735_SLPOUT, 0, {0},},
63 /* Framerate ctrl - normal mode. Rate = fosc/(1x2+40) * (LINE+2C+2D) */
64 {XWDS_ST7735_FRMCTR1, 3, {0x01, 0x2C, 0x2D},},
65 /* Framerate ctrl - idle mode. Rate = fosc/(1x2+40) * (LINE+2C+2D) */
66 {XWDS_ST7735_FRMCTR2, 3, {0x01, 0x2C, 0x2D},},
67 /* Framerate - partial mode. Dot/Line inversion mode */
68 {XWDS_ST7735_FRMCTR3, 6, {0x01, 0x2C, 0x2D, 0x01, 0x2C, 0x2D},},
69 /* Display inversion ctrl: No inversion */
70 {XWDS_ST7735_INVCTR, 1, {0x07},},
71 /* Power control1 set GVDD: -4.6V, AUTO mode. */
72 {XWDS_ST7735_PWCTR1, 3, {0xA2, 0x02, 0x84},},
73 /* Power control2 set VGH/VGL: VGH25=2.4C VGSEL=-10 VGH=3 * AVDD */
74 {XWDS_ST7735_PWCTR2, 1, {0xC5},},
75 /* Power control3 normal mode(Full color): Op-amp current small, booster voltage */
76 {XWDS_ST7735_PWCTR3, 2, {0x0A, 0x00},},
77 /* Power control4 idle mode(8-colors): Op-amp current small & medium low */
78 {XWDS_ST7735_PWCTR4, 2, {0x8A, 0x2A},},
79 /* Power control5 partial mode + full colors */
80 {XWDS_ST7735_PWCTR5, 2, {0x8A, 0xEE},},
81 /* VCOMH VoltageVCOM control 1: VCOMH=0x0E=2.850 */
82 {XWDS_ST7735_VMCTR1, 1, {0x0E},},
83 /* Gamma Adjustments (pos. polarity).
84 Not entirely necessary, but provides accurate colors. */
86 {0x02, 0x1C, 0x07, 0x12, 0x37, 0x32, 0x29, 0x2D,
87 0x29, 0x25, 0x2B, 0x39, 0x00, 0x01, 0x03, 0x10},
88 /* {0x0F, 0x1A, 0x0F, 0x18, 0x2F, 0x28, 0x20, 0x22,
89 0x1F, 0x1B, 0x23, 0x37, 0x00, 0x07, 0x02, 0x10}, */
90 },
91 /* Gamma Adjustments (neg. polarity).
92 Not entirely necessary, but provides accurate colors. */
94 {0x03, 0x1d, 0x07, 0x06, 0x2E, 0x2C, 0x29, 0x2D,
95 0x2E, 0x2E, 0x37, 0x3F, 0x00, 0x00, 0x02, 0x10},
96 /* {0x0F, 0x1B, 0x0F, 0x17, 0x33, 0x2C, 0x29, 0x2E,
97 0x30, 0x30, 0x39, 0x3F, 0x00, 0x07, 0x03, 0x10}, */
98 },
99 /* Normal Display Mode On */
100 {XWDS_ST7735_NORON, 0, {0},},
101};
102
105{
106 struct xwds_st7735 * st7735;
107 struct xwds_st7735_parameter * param;
108 struct xwds_st7735_driver * drv;
109 const struct xwds_st7735_cmd_table * init;
110 xwu8_t buffer[4];
111 xwsq_t i;
112 xwtm_t to;
113 xwer_t rc;
114
115 st7735 = xwds_cast(struct xwds_st7735 *, dev);
116 param = &st7735->parameter;
117 drv = xwds_cast(struct xwds_st7735_driver *, st7735->spip.dev.drv);
119
120 if (!((drv) && (drv->write) && (drv->read))) {
121 rc = -EINVAL;
122 goto err_drv;
123 }
128 rc = -EINVAL;
129 goto err_param;
130 }
131 if (!(XWDS_ST7735_FORMAT_RBG565 == param->pixelformat)) {
132 rc = -EINVAL;
133 goto err_param;
134 }
135 if (!((XWDS_ST7735_INVERSION_OFF == param->inversion) ||
136 (XWDS_ST7735_INVERSION_ON == param->inversion))) {
137 rc = -EINVAL;
138 goto err_param;
139 }
140 if (!((XWDS_ST7735_RGBSEQ_RGB == param->rgbseq) ||
141 (XWDS_ST7735_RGBSEQ_BGR == param->rgbseq))) {
142 rc = -EINVAL;
143 goto err_param;
144 }
145
146 /* Init process */
147 to = XWTM_MAX;
148 for (i = 0; i < xw_array_size(xwds_st7735_init_table); i++) {
149 rc = xwds_st7735_write(st7735,
150 init[i].reg, init[i].data, init[i].size,
151 to);
152 if (rc < 0) {
153 goto err_write;
154 }
155 }
156
157 /* Set color mode */
158 buffer[0] = param->pixelformat;
159 rc = xwds_st7735_write(st7735,
160 XWDS_ST7735_COLMOD, buffer, 1,
161 to);
162 if (rc < 0) {
163 goto err_write;
164 }
165
166 /* Set inversion mode */
167 if (XWDS_ST7735_INVERSION_ON == param->inversion) {
168 rc = xwds_st7735_write(st7735,
170 to);
171 } else {
172 rc = xwds_st7735_write(st7735,
174 to);
175 }
176 if (rc < 0) {
177 goto err_write;
178 }
179
180 /* Set the display orientation & RGB seq */
181 buffer[0] = param->orientation | param->rgbseq;
182 rc = xwds_st7735_write(st7735,
183 XWDS_ST7735_MADCTL, buffer, 1,
184 to);
185 if (rc < 0) {
186 goto err_write;
187 }
188
189 /* Column Address Set */
190 buffer[0] = 0;
191 buffer[1] = param->width_offset;
192 buffer[2] = 0;
193 buffer[3] = param->width + param->width_offset - 1;
194 rc = xwds_st7735_write(st7735,
195 XWDS_ST7735_CASET, buffer, 4,
196 to);
197 if (rc < 0) {
198 goto err_write;
199 }
200
201 /* Row Address Set */
202 buffer[0] = 0;
203 buffer[1] = param->height_offset;
204 buffer[2] = 0;
205 buffer[3] = param->height + param->height_offset - 1;
206 rc = xwds_st7735_write(st7735,
207 XWDS_ST7735_RASET, buffer, 4,
208 to);
209 if (rc < 0) {
210 goto err_write;
211 }
212
213 /* Display On */
214 rc = xwds_st7735_write(st7735,
216 to);
217 if (rc < 0) {
218 goto err_write;
219 }
220
221 /* Set brightness */
222 rc = xwds_st7735_set_brightness(st7735, param->brightness);
223 if (rc < 0) {
224 goto err_set_brightness;
225 }
226 return XWOK;
227
228err_set_brightness:
229err_write:
230err_param:
231err_drv:
232 return rc;
233}
234
237 /* enter sleep mode */
238 {XWDS_ST7735_SLPIN, 0, {0},},
239};
240
243{
244 struct xwds_st7735 * st7735;
245 const struct xwds_st7735_cmd_table * deinit;
246 xwsq_t i;
247 xwtm_t to;
248 xwer_t rc;
249
250 st7735 = xwds_cast(struct xwds_st7735 *, dev);
252 to = XWTM_MAX;
253 for (i = 0; i < xw_array_size(xwds_st7735_deinit_table); i++) {
254 rc = xwds_st7735_write(st7735,
255 deinit[i].reg, deinit[i].data, deinit[i].size,
256 to);
257 if (rc < 0) {
258 goto err_write;
259 }
260 }
261 return XWOK;
262
263err_write:
264 return rc;
265}
266
267#if defined(XWCDCFG_ds_PM) && (1 == XWCDCFG_ds_PM)
270{
271 return xwds_st7735_drv_start(dev);
272}
273
276{
277 return xwds_st7735_drv_stop(dev);
278}
279#endif
280
281/******** ******** ******** APIs ******** ******** ********/
284{
285 xwer_t rc;
286
287 XWDS_VALIDATE(st7735, "nullptr", -EFAULT);
288 XWDS_VALIDATE(id, "nullptr", -EFAULT);
289
290 rc = xwds_st7735_grab(st7735);
291 if (rc < 0) {
292 goto err_st7735_grab;
293 }
294 rc = xwds_st7735_read(st7735, XWDS_ST7735_RDDID, (xwu8_t *)id, 4, to);
295 xwds_st7735_put(st7735);
296 return XWOK;
297
298err_st7735_grab:
299 return rc;
300}
301
304 xwu8_t st[5],
305 xwtm_t to)
306{
307 xwer_t rc;
308
309 XWDS_VALIDATE(st7735, "nullptr", -EFAULT);
310 XWDS_VALIDATE(id, "nullptr", -EFAULT);
311
312 rc = xwds_st7735_grab(st7735);
313 if (rc < 0) {
314 goto err_st7735_grab;
315 }
316 rc = xwds_st7735_read(st7735, XWDS_ST7735_RDDST, st, 5, to);
317 xwds_st7735_put(st7735);
318 return XWOK;
319
320err_st7735_grab:
321 return rc;
322}
323
326 xwu8_t madctl[2],
327 xwtm_t to)
328{
329 xwer_t rc;
330
331 XWDS_VALIDATE(st7735, "nullptr", -EFAULT);
332 XWDS_VALIDATE(id, "nullptr", -EFAULT);
333
334 rc = xwds_st7735_grab(st7735);
335 if (rc < 0) {
336 goto err_st7735_grab;
337 }
338 rc = xwds_st7735_read(st7735, XWDS_ST7735_RDDMADCTL, madctl, 2, to);
339 xwds_st7735_put(st7735);
340 return XWOK;
341
342err_st7735_grab:
343 return rc;
344}
345
348 xwu8_t colmod[2],
349 xwtm_t to)
350{
351 xwer_t rc;
352
353 XWDS_VALIDATE(st7735, "nullptr", -EFAULT);
354 XWDS_VALIDATE(id, "nullptr", -EFAULT);
355
356 rc = xwds_st7735_grab(st7735);
357 if (rc < 0) {
358 goto err_st7735_grab;
359 }
360 rc = xwds_st7735_read(st7735, XWDS_ST7735_RDDCOLMOD, colmod, 2, to);
361 xwds_st7735_put(st7735);
362 return XWOK;
363
364err_st7735_grab:
365 return rc;
366}
367
370{
371 XWDS_VALIDATE(st7735, "nullptr", -EFAULT);
372
373 return xwds_st7735_write(st7735,
375 to);
376}
377
380{
381 XWDS_VALIDATE(st7735, "nullptr", -EFAULT);
382
383 return xwds_st7735_write(st7735,
385 to);
386}
387
390{
391 struct xwds_st7735_driver * drv;
392 xwer_t rc;
393
394 XWDS_VALIDATE(st7735, "nullptr", -EFAULT);
395
396 drv = xwds_cast(struct xwds_st7735_driver *, st7735->spip.dev.drv);
397 if ((drv) && (drv->set_brightness)) {
398 rc = drv->set_brightness(st7735, brightness);
399 if (XWOK == rc) {
400 st7735->parameter.brightness = brightness;
401 }
402 } else {
403 rc = -ENOSYS;
404 }
405 return rc;
406}
407
409void xwds_st7735_get_brightness(struct xwds_st7735 * st7735, xwu32_t * brightness)
410{
411 XWDS_VALIDATE(st7735, "nullptr", -EFAULT);
412 XWDS_VALIDATE(brightness, "nullptr", -EFAULT);
413
414 *brightness = st7735->parameter.brightness;
415}
416
419 xwu8_t orientation, xwtm_t to)
420{
421 struct xwds_st7735_parameter * param;
422 xwu8_t tmp;
423 xwer_t rc;
424
425 XWDS_VALIDATE(st7735, "nullptr", -EFAULT);
426
431 "nullptr", -EINVAL);
432
433 param = &st7735->parameter;
434 tmp = orientation;
435 rc = xwds_st7735_write(st7735,
436 XWDS_ST7735_MADCTL, &tmp, 1,
437 to);
438 if (rc < 0) {
439 goto err_write;
440 }
441
446 tmp = param->width;
447 param->width = param->height;
448 param->height = tmp;
449 tmp = param->width_offset;
450 param->width_offset = param->height_offset;
451 param->height_offset = tmp;
452 }
453 } else {
456 tmp = param->width;
457 param->width = param->height;
458 param->height = tmp;
459 tmp = param->width_offset;
460 param->width_offset = param->height_offset;
461 param->height_offset = tmp;
462 }
463 }
464 param->orientation = orientation;
465 return XWOK;
466
467err_write:
468 return rc;
469}
470
473{
474 XWDS_VALIDATE(st7735, "nullptr", -EFAULT);
475 XWDS_VALIDATE(orientation, "nullptr", -EFAULT);
476
478}
479
482 xwtm_t to)
483{
484 struct xwds_st7735_parameter * param;
485 xwu8_t buffer[4];
486 xwer_t rc;
487
488 XWDS_VALIDATE(st7735, "nullptr", -EFAULT);
489
490 param = &st7735->parameter;
491
492 XWDS_VALIDATE((x < param->width), "nullptr", -ERANGE);
493 XWDS_VALIDATE((y < param->height), "nullptr", -ERANGE);
494
495 /* Column Address Set */
496 buffer[0] = 0;
497 buffer[1] = x + param->width_offset;
498 buffer[2] = 0;
499 buffer[3] = param->width + param->width_offset - 1;
500 rc = xwds_st7735_write(st7735,
501 XWDS_ST7735_CASET, buffer, 4,
502 to);
503 if (rc < 0) {
504 goto err_write;
505 }
506
507 /* Row Address Set */
508 buffer[0] = 0;
509 buffer[1] = y + param->height_offset;
510 buffer[2] = 0;
511 buffer[3] = param->height + param->height_offset - 1;
512 rc = xwds_st7735_write(st7735,
513 XWDS_ST7735_RASET, buffer, 4,
514 to);
515 if (rc < 0) {
516 goto err_write;
517 }
518 return XWOK;
519
520err_write:
521 return rc;
522}
523
527 xwtm_t to)
528{
529 struct xwds_st7735_parameter * param;
530 xwu8_t buffer[4];
531 xwer_t rc;
532
533 XWDS_VALIDATE(st7735, "nullptr", -EFAULT);
534 XWDS_VALIDATE((x < width), "nullptr", -ERANGE);
535 XWDS_VALIDATE((y < height), "nullptr", -ERANGE);
536
537 param = &st7735->parameter;
538
539 XWDS_VALIDATE((width < param->width), "nullptr", -ERANGE);
540 XWDS_VALIDATE((height < param->height), "nullptr", -ERANGE);
541
542 /* Column Address Set */
543 buffer[0] = 0;
544 buffer[1] = x + param->width_offset;
545 buffer[2] = 0;
546 buffer[3] = width + param->width_offset - 1;
547 rc = xwds_st7735_write(st7735,
548 XWDS_ST7735_CASET, buffer, 4,
549 to);
550 if (rc < 0) {
551 goto err_write;
552 }
553
554 /* Row Address Set */
555 buffer[0] = 0;
556 buffer[1] = y + param->height_offset;
557 buffer[2] = 0;
558 buffer[3] = height + param->height_offset - 1;
559 rc = xwds_st7735_write(st7735,
560 XWDS_ST7735_RASET, buffer, 4,
561 to);
562 if (rc < 0) {
563 goto err_write;
564 }
565 return XWOK;
566
567err_write:
568 return rc;
569}
570
572xwer_t xwds_st7735_invert_color(struct xwds_st7735 * st7735, bool inv, xwtm_t to)
573{
574 xwer_t rc;
575
576 XWDS_VALIDATE(st7735, "nullptr", -EFAULT);
577
578 if (inv) {
579 rc = xwds_st7735_write(st7735,
581 to);
582 } else {
583 rc = xwds_st7735_write(st7735,
585 to);
586 }
587 return rc;
588}
589
592 xwu8_t x, xwu8_t y,
593 xwu16_t color, xwtm_t to)
594{
595 xwu8_t buffer[2];
596 xwer_t rc;
597
598 XWDS_VALIDATE(st7735, "nullptr", -EFAULT);
599
600 rc = xwds_st7735_set_cursor(st7735, x, y, to);
601 if (rc < 0) {
602 goto err_set_cursor;
603 }
604 buffer[0] = color >> 8;
605 buffer[1] = color & 0xFF;
606 rc = xwds_st7735_write(st7735,
607 XWDS_ST7735_RAMWR, buffer, 2,
608 to);
609
610err_set_cursor:
611 return rc;
612}
613
617 xwu16_t color, xwtm_t to)
618{
619 xwer_t rc;
620 xwsz_t i, total, wrsz;
621 xwu8_t fb[64];
622 xwu8_t colorh, colorl;
623
624 XWDS_VALIDATE(st7735, "nullptr", -EFAULT);
625
626 colorh = color >> 8;
627 colorl = color & 0xFF;
628 for (i = 0; i < sizeof(fb); i = i + 2) {
629 fb[i] = colorh;
630 fb[i + 1] = colorl;
631 }
632 rc = xwds_st7735_set_window(st7735, x, y, width, height, to);
633 if (rc < 0) {
634 goto err_set_window;
635 }
636 total = (xwsz_t)width * (xwsz_t)height * (xwsz_t)2;
637 wrsz = 0;
638 while (wrsz < total) {
639 if (wrsz + sizeof(fb) < total) {
640 i = sizeof(fb);
641 } else {
642 i = total - wrsz;
643 }
644 rc = xwds_st7735_write(st7735,
645 XWDS_ST7735_RAMWR, fb, i,
646 to);
647 if (rc < 0) {
648 goto err_write;
649 }
650 wrsz += i;
651 }
652 return XWOK;
653
654err_write:
655err_set_window:
656 return rc;
657}
658
662 const xwu8_t img[], xwtm_t to)
663{
664 xwer_t rc;
665 xwsz_t total;
666
667 XWDS_VALIDATE(st7735, "nullptr", -EFAULT);
668 XWDS_VALIDATE(image, "nullptr", -EFAULT);
669
670 rc = xwds_st7735_set_window(st7735, x, y, width, height, to);
671 if (rc < 0) {
672 goto err_set_window;
673 }
674
675 total = (xwsz_t)width * (xwsz_t)height * (xwsz_t)2;
676 rc = xwds_st7735_write(st7735,
677 XWDS_ST7735_RAMWR, img, total,
678 to);
679
680err_set_window:
681 return rc;
682}
#define xwds_cast(type, dev)
Definition standard.h:40
#define XWDS_VALIDATE(exp, errstr,...)
Definition standard.h:51
static xwer_t xwds_st7735_put(struct xwds_st7735 *st7735)
ST7735 API:减少对象的引用计数
Definition device.h:205
static xwer_t xwds_st7735_grab(struct xwds_st7735 *st7735)
ST7735 API:增加对象的引用计数
Definition device.h:193
@ XWDS_ST7735_INVERSION_OFF
Definition device.h:137
@ XWDS_ST7735_INVERSION_ON
Definition device.h:138
@ XWDS_ST7735_RGBSEQ_BGR
Definition device.h:146
@ XWDS_ST7735_RGBSEQ_RGB
Definition device.h:145
@ XWDS_ST7735_FORMAT_RBG565
Definition device.h:130
@ XWDS_ST7735_PWCTR5
Definition device.h:92
@ XWDS_ST7735_SWRESET
Definition device.h:55
@ XWDS_ST7735_PWCTR3
Definition device.h:90
@ XWDS_ST7735_FRMCTR1
Definition device.h:84
@ XWDS_ST7735_GMCTRN1
Definition device.h:104
@ XWDS_ST7735_MADCTL
Definition device.h:80
@ XWDS_ST7735_RDDCOLMOD
Definition device.h:60
@ XWDS_ST7735_INVON
Definition device.h:68
@ XWDS_ST7735_GMCTRP1
Definition device.h:103
@ XWDS_ST7735_DISPOFF
Definition device.h:70
@ XWDS_ST7735_RDDMADCTL
Definition device.h:59
@ XWDS_ST7735_VMCTR1
Definition device.h:93
@ XWDS_ST7735_RDDST
Definition device.h:57
@ XWDS_ST7735_FRMCTR3
Definition device.h:86
@ XWDS_ST7735_RASET
Definition device.h:73
@ XWDS_ST7735_PWCTR1
Definition device.h:88
@ XWDS_ST7735_INVCTR
Definition device.h:87
@ XWDS_ST7735_NORON
Definition device.h:66
@ XWDS_ST7735_SLPOUT
Definition device.h:64
@ XWDS_ST7735_FRMCTR2
Definition device.h:85
@ XWDS_ST7735_RDDID
Definition device.h:56
@ XWDS_ST7735_CASET
Definition device.h:72
@ XWDS_ST7735_RAMWR
Definition device.h:74
@ XWDS_ST7735_INVOFF
Definition device.h:67
@ XWDS_ST7735_PWCTR4
Definition device.h:91
@ XWDS_ST7735_DISPON
Definition device.h:71
@ XWDS_ST7735_SLPIN
Definition device.h:63
@ XWDS_ST7735_COLMOD
Definition device.h:83
@ XWDS_ST7735_PWCTR2
Definition device.h:89
@ XWDS_ST7735_ORIENTATION_LANDSCAPE_ROT180
Definition device.h:123
@ XWDS_ST7735_ORIENTATION_LANDSCAPE
Definition device.h:122
@ XWDS_ST7735_ORIENTATION_PORTRAIT_ROT180
Definition device.h:121
@ XWDS_ST7735_ORIENTATION_PORTRAIT
Definition device.h:120
#define __xwbsp_rodata
Definition compiler.h:251
#define __xwbsp_code
Definition compiler.h:231
#define __xwbsp_api
Definition compiler.h:235
#define EINVAL
Invalid argument
Definition errno.h:52
#define EFAULT
Bad address
Definition errno.h:44
#define ENOSYS
Function not implemented
Definition errno.h:110
#define XWOK
No error
Definition errno.h:182
#define ERANGE
Result too large
Definition errno.h:64
xws64_t xwtm_t
XWOS系统时间 (有符号)
Definition type.h:742
#define XWTM_MAX
xwtm_t 的最大值
Definition type.h:755
signed long xwer_t
Definition type.h:554
#define NULL
Definition type.h:28
unsigned long xwsz_t
Definition type.h:339
uint8_t xwu8_t
Definition type.h:194
unsigned long xwsq_t
Definition type.h:445
uint16_t xwu16_t
Definition type.h:230
uint32_t xwu32_t
Definition type.h:266
#define xw_array_size(ay)
获取结构体数组中结构体的个数
Definition standard.h:48
SPI LCD Controller ST7735 Device
xwer_t xwds_st7735_display_on(struct xwds_st7735 *st7735, xwtm_t to)
ST7735 API:开启显示
Definition driver.c:369
xwer_t xwds_st7735_drv_start(struct xwds_device *dev)
ST7735基本驱动:启动设备
Definition driver.c:104
xwer_t xwds_st7735_read_colmod(struct xwds_st7735 *st7735, xwu8_t colmod[2], xwtm_t to)
ST7735 API:读取RDDCOLMOD寄存器的值
Definition driver.c:347
void xwds_st7735_get_orientation(struct xwds_st7735 *st7735, xwu8_t *orientation)
ST7735 API:读取显示方向
Definition driver.c:472
xwer_t xwds_st7735_draw(struct xwds_st7735 *st7735, xwu8_t x, xwu8_t y, xwu8_t width, xwu8_t height, const xwu8_t img[], xwtm_t to)
ST7735 API:绘制位图
Definition driver.c:660
static xwer_t xwds_st7735_read(struct xwds_st7735 *st7735, xwu8_t reg, xwu8_t *buf, xwsz_t size, xwtm_t to)
Definition driver.c:40
const struct xwds_st7735_cmd_table xwds_st7735_init_table[]
Definition driver.c:58
xwer_t xwds_st7735_set_cursor(struct xwds_st7735 *st7735, xwu8_t x, xwu8_t y, xwtm_t to)
ST7735 API:设置光标坐标
Definition driver.c:481
xwer_t xwds_st7735_drv_suspend(struct xwds_device *dev)
ST7735基本驱动:继续设备
Definition driver.c:275
xwer_t xwds_st7735_drv_resume(struct xwds_device *dev)
ST7735基本驱动:暂停设备
Definition driver.c:269
xwer_t xwds_st7735_drv_stop(struct xwds_device *dev)
ST7735基本驱动:停止设备
Definition driver.c:242
xwer_t xwds_st7735_invert_color(struct xwds_st7735 *st7735, bool inv, xwtm_t to)
ST7735 API:设置是否翻转颜色
Definition driver.c:572
const struct xwds_st7735_cmd_table xwds_st7735_deinit_table[]
Definition driver.c:236
xwer_t xwds_st7735_set_window(struct xwds_st7735 *st7735, xwu8_t x, xwu8_t y, xwu8_t width, xwu8_t height, xwtm_t to)
ST7735 API:设置窗口
Definition driver.c:525
xwer_t xwds_st7735_fill_rect(struct xwds_st7735 *st7735, xwu8_t x, xwu8_t y, xwu8_t width, xwu8_t height, xwu16_t color, xwtm_t to)
ST7735 API:绘制矩形
Definition driver.c:615
void xwds_st7735_get_brightness(struct xwds_st7735 *st7735, xwu32_t *brightness)
ST7735 API:读取亮度
Definition driver.c:409
static xwer_t xwds_st7735_write(struct xwds_st7735 *st7735, xwu8_t reg, const xwu8_t *data, xwsz_t size, xwtm_t to)
Definition driver.c:29
xwer_t xwds_st7735_read_status(struct xwds_st7735 *st7735, xwu8_t st[5], xwtm_t to)
ST7735 API:读取状态
Definition driver.c:303
xwer_t xwds_st7735_display_off(struct xwds_st7735 *st7735, xwtm_t to)
ST7735 API:关闭显示
Definition driver.c:379
xwer_t xwds_st7735_read_id(struct xwds_st7735 *st7735, xwu32_t *id, xwtm_t to)
ST7735 API:读取ID
Definition driver.c:283
xwer_t xwds_st7735_set_brightness(struct xwds_st7735 *st7735, xwu32_t brightness)
ST7735 API:设置亮度
Definition driver.c:389
xwer_t xwds_st7735_read_madctl(struct xwds_st7735 *st7735, xwu8_t madctl[2], xwtm_t to)
ST7735 API:读取RDDMADCTL寄存器的值
Definition driver.c:325
xwer_t xwds_st7735_set_orientation(struct xwds_st7735 *st7735, xwu8_t orientation, xwtm_t to)
ST7735 API:设置显示方向
Definition driver.c:418
xwer_t xwds_st7735_set_pixel(struct xwds_st7735 *st7735, xwu8_t x, xwu8_t y, xwu16_t color, xwtm_t to)
ST7735 API:设置点的颜色
Definition driver.c:591
SPI LCD Controller ST7735 Driver
玄武设备栈:SPI:外设
设备(所有设备的基类)
Definition device.h:127
const struct xwds_driver * drv
Definition device.h:133
struct xwds_device dev
Definition peripheral.h:48
xwu8_t data[16]
Definition driver.c:54
ST7735驱动函数表
Definition driver.h:38
xwer_t(* set_brightness)(struct xwds_st7735 *, xwu32_t)
Definition driver.h:46
xwer_t(* read)(struct xwds_st7735 *, xwu8_t, xwu8_t *, xwsz_t *, xwtm_t)
Definition driver.h:43
xwer_t(* write)(struct xwds_st7735 *, xwu8_t, const xwu8_t *, xwsz_t *, xwtm_t)
Definition driver.h:40
ST7735 参数
Definition device.h:152
ST7735 设备
Definition device.h:167
struct xwds_spip spip
Definition device.h:168
struct xwds_st7735_parameter parameter
Definition device.h:171
XWOS通用库:位操作
XWOS的标准头文件