Skip to content

Commit 0942afe

Browse files
committed
Revert "ugfx/driver: remove flush flag"
This reverts commit 28d0ec4.
1 parent f346c29 commit 0942afe

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

components/ugfx/drivers/gdisp/CUBE0414/gdisp_lld_CUBE0414.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
#define GDISP_INITIAL_BACKLIGHT 100
4343
#endif
4444

45+
#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0)
46+
4547
#include "CUBE0414.h"
4648

4749
static const uint8_t ram_addr_table[64] = {
@@ -99,7 +101,11 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
99101

100102
#if GDISP_HARDWARE_FLUSH
101103
LLDSPEC void gdisp_lld_flush(GDisplay *g) {
104+
if (!(g->flags & GDISP_FLG_NEEDFLUSH)) {
105+
return;
106+
}
102107
refresh_gram(g, (uint8_t *)g->priv);
108+
g->flags &= ~GDISP_FLG_NEEDFLUSH;
103109
}
104110
#endif
105111

@@ -141,6 +147,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
141147
stream_write_cx = 0;
142148
stream_write_y = 0;
143149
stream_write_cy = 0;
150+
g->flags |= GDISP_FLG_NEEDFLUSH;
144151
}
145152
#endif
146153

components/ugfx/drivers/gdisp/ST7735/gdisp_lld_ST7735.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
#define GDISP_INITIAL_BACKLIGHT 255
4343
#endif
4444

45+
#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0)
46+
4547
#include "ST7735.h"
4648

4749
LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
@@ -167,7 +169,11 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
167169

168170
#if GDISP_HARDWARE_FLUSH
169171
LLDSPEC void gdisp_lld_flush(GDisplay *g) {
172+
if (!(g->flags & GDISP_FLG_NEEDFLUSH)) {
173+
return;
174+
}
170175
refresh_gram(g, (uint8_t *)g->priv);
176+
g->flags &= ~GDISP_FLG_NEEDFLUSH;
171177
}
172178
#endif
173179

@@ -202,6 +208,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
202208
stream_write_cx = 0;
203209
stream_write_y = 0;
204210
stream_write_cy = 0;
211+
g->flags |= GDISP_FLG_NEEDFLUSH;
205212
}
206213
#endif
207214

components/ugfx/drivers/gdisp/ST7789/gdisp_lld_ST7789.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
#define GDISP_INITIAL_BACKLIGHT 255
4343
#endif
4444

45+
#define GDISP_FLG_NEEDFLUSH (GDISP_FLG_DRIVER<<0)
46+
4547
#include "ST7789.h"
4648

4749
LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
@@ -152,7 +154,11 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
152154

153155
#if GDISP_HARDWARE_FLUSH
154156
LLDSPEC void gdisp_lld_flush(GDisplay *g) {
157+
if (!(g->flags & GDISP_FLG_NEEDFLUSH)) {
158+
return;
159+
}
155160
refresh_gram(g, (uint8_t *)g->priv);
161+
g->flags &= ~GDISP_FLG_NEEDFLUSH;
156162
}
157163
#endif
158164

@@ -187,6 +193,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
187193
stream_write_cx = 0;
188194
stream_write_y = 0;
189195
stream_write_cy = 0;
196+
g->flags |= GDISP_FLG_NEEDFLUSH;
190197
}
191198
#endif
192199

0 commit comments

Comments
 (0)