From a43a9b25f6f638c68c2a5612785b5e614f33ff1f Mon Sep 17 00:00:00 2001 From: ergosys Date: Thu, 11 Dec 2014 15:13:07 -0800 Subject: add missing bus acquisition --- drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/gdisp/SSD1306') diff --git a/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c b/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c index abea8365..d3f8ae2b 100644 --- a/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c +++ b/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c @@ -142,10 +142,12 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { if (!(g->flags & GDISP_FLG_NEEDFLUSH)) return; + acquire_bus(g); write_cmd(g, SSD1306_SETSTARTLINE | 0); for(i=0; i < GDISP_SCREEN_HEIGHT/8 * SSD1306_PAGE_WIDTH; i+=SSD1306_PAGE_WIDTH) write_data(g, RAM(g)+i, SSD1306_PAGE_WIDTH); + release_bus(g); } #endif -- cgit v1.2.3 From 96a5f5fbea7333443d9c0eeac57e3cb975494aa1 Mon Sep 17 00:00:00 2001 From: ergosys Date: Thu, 11 Dec 2014 15:56:55 -0800 Subject: fix GDISP_ROTATE_270 case --- drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/gdisp/SSD1306') diff --git a/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c b/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c index d3f8ae2b..f241270e 100644 --- a/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c +++ b/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c @@ -170,8 +170,8 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { y = GDISP_SCREEN_HEIGHT-1 - g->p.y; break; case GDISP_ROTATE_270: - x = GDISP_SCREEN_HEIGHT-1 - g->p.y; - x = g->p.x; + x = GDISP_SCREEN_WIDTH-1 - g->p.y; + y = g->p.x; break; } if (gdispColor2Native(g->p.color) != Black) @@ -201,7 +201,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { y = GDISP_SCREEN_HEIGHT-1 - g->p.y; break; case GDISP_ROTATE_270: - x = GDISP_SCREEN_HEIGHT-1 - g->p.y; + x = GDISP_SCREEN_WIDTH-1 - g->p.y; y = g->p.x; break; } -- cgit v1.2.3 From 3b12678e6ed14c7e78aae141cbc31994559e73ce Mon Sep 17 00:00:00 2001 From: ergosys Date: Thu, 11 Dec 2014 22:54:19 -0800 Subject: add hardware clear --- drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c | 10 ++++++++++ drivers/gdisp/SSD1306/gdisp_lld_config.h | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'drivers/gdisp/SSD1306') diff --git a/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c b/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c index f241270e..9670d2d0 100644 --- a/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c +++ b/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c @@ -151,6 +151,16 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { } #endif +#if GDISP_HARDWARE_CLEARS + LLDSPEC void gdisp_lld_clear(GDisplay *g) { + uint8_t fill = (g->p.color == Black) ? 0 : 0xff; + int bytes = GDISP_SCREEN_WIDTH * GDISP_SCREEN_HEIGHT/8; + int off; + for (off = 0; off < bytes; off++) + RAM(g)[off] = fill; + } +#endif + #if GDISP_HARDWARE_DRAWPIXEL LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) { coord_t x, y; diff --git a/drivers/gdisp/SSD1306/gdisp_lld_config.h b/drivers/gdisp/SSD1306/gdisp_lld_config.h index 2b805e86..9c502157 100644 --- a/drivers/gdisp/SSD1306/gdisp_lld_config.h +++ b/drivers/gdisp/SSD1306/gdisp_lld_config.h @@ -17,7 +17,8 @@ #define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing #define GDISP_HARDWARE_DRAWPIXEL TRUE #define GDISP_HARDWARE_PIXELREAD TRUE -#define GDISP_HARDWARE_CONTROL TRUE +#define GDISP_HARDWARE_CONTROL TRUE +#define GDISP_HARDWARE_CLEARS TRUE #define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_MONO -- cgit v1.2.3 From bdfafbcf9f7d247b85699818cd2a959178a24b64 Mon Sep 17 00:00:00 2001 From: ergosys Date: Fri, 12 Dec 2014 15:27:37 -0800 Subject: slightly faster flush and clear --- drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'drivers/gdisp/SSD1306') diff --git a/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c b/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c index 9670d2d0..2386c2d4 100644 --- a/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c +++ b/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c @@ -14,6 +14,7 @@ #include "src/gdisp/driver.h" #include "board_SSD1306.h" +#include // for memset /*===========================================================================*/ /* Driver local definitions. */ @@ -136,17 +137,22 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { #if GDISP_HARDWARE_FLUSH LLDSPEC void gdisp_lld_flush(GDisplay *g) { - unsigned i; + uint8_t * ram; + unsigned pages; // Don't flush if we don't need it. if (!(g->flags & GDISP_FLG_NEEDFLUSH)) return; + ram = RAM(g); + pages = GDISP_SCREEN_HEIGHT/8; acquire_bus(g); write_cmd(g, SSD1306_SETSTARTLINE | 0); - for(i=0; i < GDISP_SCREEN_HEIGHT/8 * SSD1306_PAGE_WIDTH; i+=SSD1306_PAGE_WIDTH) - write_data(g, RAM(g)+i, SSD1306_PAGE_WIDTH); + while (pages--) { + write_data(g, ram, SSD1306_PAGE_WIDTH); + ram += SSD1306_PAGE_WIDTH; + } release_bus(g); } #endif @@ -155,9 +161,8 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { LLDSPEC void gdisp_lld_clear(GDisplay *g) { uint8_t fill = (g->p.color == Black) ? 0 : 0xff; int bytes = GDISP_SCREEN_WIDTH * GDISP_SCREEN_HEIGHT/8; - int off; - for (off = 0; off < bytes; off++) - RAM(g)[off] = fill; + memset(RAM(g), fill, bytes); + g->flags |= GDISP_FLG_NEEDFLUSH; } #endif -- cgit v1.2.3