Browse Source

Changed gdisp_lld_write_color to call write_pixel instead of write_data; changed gdisp_lld_init to support different pixel formats; added gdisp_lld_fill_area

kapacuk 1 year ago
parent
commit
d2b30416fc
1 changed files with 31 additions and 9 deletions
  1. 31 9
      drivers/gdisp/ILI9488/gdisp_lld_ILI9488.c

+ 31 - 9
drivers/gdisp/ILI9488/gdisp_lld_ILI9488.c

@@ -46,8 +46,8 @@
46 46
 /* Driver local functions.                                                   */
47 47
 /*===========================================================================*/
48 48
 static void dummy_read(GDisplay* g) {
49
-  volatile gU16 dummy;
50
-  dummy = read_data(g);
49
+  volatile gColor dummy;
50
+  dummy = read_pixel(g);
51 51
   (void)dummy;
52 52
 }
53 53
 
@@ -64,7 +64,7 @@ static void set_viewport(GDisplay* g) {
64 64
   write_data(g, ((g->p.y + g->p.cy - 1) >> 8) & 0x00FF);
65 65
   write_data(g, ((g->p.y + g->p.cy - 1) >> 0) & 0x00FF);
66 66
 
67
-	write_index(g, 0x2C);
67
+  write_index(g, 0x2C);
68 68
 }
69 69
 
70 70
 /*===========================================================================*/
@@ -137,7 +137,17 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
137 137
 	write_data(g, 0x08);
138 138
 
139 139
 	write_index(g, 0x3A);
140
+#if GDISP_LLD_PIXELFORMAT == GDISP_PIXELFORMAT_RGB565
140 141
 	write_data(g, 0x55);
142
+#elif GDISP_LLD_PIXELFORMAT == GDISP_PIXELFORMAT_RGB666
143
+	write_data(g, 0x66);
144
+#elif GDISP_LLD_PIXELFORMAT == GDISP_PIXELFORMAT_RGB888
145
+	write_data(g, 0x77);
146
+#elif GDISP_LLD_PIXELFORMAT == GDISP_PIXELFORMAT_RGB111
147
+	write_data(g, 0x11);
148
+#else  /* GDISP_LLD_PIXELFORMAT */
149
+#error "Unsupported pixel format, check your board_ILI9488.h"
150
+#endif /* GDISP_LLD_PIXELFORMAT */
141 151
 
142 152
 	write_index(g, 0xE0);
143 153
 	write_data(g, 0x00);
@@ -204,13 +214,13 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
204 214
 	}
205 215
 
206 216
 	LLDSPEC	void gdisp_lld_write_color(GDisplay *g) {
207
-		write_data(g, gdispColor2Native(g->p.color));
217
+		write_pixel(g, gdispColor2Native(g->p.color));
208 218
 	}
209 219
 
210 220
 	LLDSPEC	void gdisp_lld_write_stop(GDisplay *g) {
211 221
 		release_bus(g);
212 222
 	}
213
-#endif
223
+#endif /* GDISP_HARDWARE_STREAM_WRITE */
214 224
 
215 225
 #if GDISP_HARDWARE_STREAM_READ
216 226
 	LLDSPEC	void gdisp_lld_read_start(GDisplay *g) {
@@ -221,17 +231,29 @@ LLDSPEC gBool gdisp_lld_init(GDisplay *g) {
221 231
 	}
222 232
 
223 233
 	LLDSPEC	gColor gdisp_lld_read_color(GDisplay *g) {
224
-		gU16	data;
234
+		gColor	pixel;
225 235
 
226
-		data = read_data(g);
227
-		return gdispNative2Color(data);
236
+		pixel = read_pixel(g);
237
+		return gdispNative2Color(pixel);
228 238
 	}
229 239
 
230 240
 	LLDSPEC	void gdisp_lld_read_stop(GDisplay *g) {
231 241
 		setwritemode(g);
232 242
 		release_bus(g);
233 243
 	}
234
-#endif
244
+#endif /* GDISP_HARDWARE_STREAM_READ */
245
+
246
+#if GDISP_HARDWARE_FILLS
247
+void gdisp_lld_fill_area(GDisplay *g) {
248
+	LLDCOLOR_TYPE c = gdispColor2Native(g->p.color);
249
+
250
+	acquire_bus(g);
251
+        set_viewport(g);
252
+        uint32_t size = g->p.cx*g->p.cy;
253
+        write_multiple_pixels(g, c, size);
254
+	release_bus(g);
255
+}
256
+#endif /* GDISP_HARDWARE_FILLS */
235 257
 
236 258
 #if GDISP_NEED_CONTROL && GDISP_HARDWARE_CONTROL
237 259
 	LLDSPEC void gdisp_lld_control(GDisplay *g) {