diff options
author | inmarket <andrewh@inmarket.com.au> | 2013-11-05 19:34:12 +1000 |
---|---|---|
committer | inmarket <andrewh@inmarket.com.au> | 2013-11-05 19:34:12 +1000 |
commit | a8e860678df38fdb44f94cacae52e8d54f4374ff (patch) | |
tree | aa718324e163f6c4b9b06805674655dce17e2c96 /drivers/gdisp | |
parent | 250adaf028848c0aa0dfa2029b722274cb7a6d6a (diff) | |
download | uGFX-a8e860678df38fdb44f94cacae52e8d54f4374ff.tar.gz uGFX-a8e860678df38fdb44f94cacae52e8d54f4374ff.tar.bz2 uGFX-a8e860678df38fdb44f94cacae52e8d54f4374ff.zip |
New GDISP now supports multiple controllers with different pixel formats.
You can now have a main color display and a secondary monochrome display.
You can now optionally set GDISP_PIXELFORMAT to any color or grayscale format for your application and the driver will internally convert to the display hardware format.
Diffstat (limited to 'drivers/gdisp')
-rw-r--r-- | drivers/gdisp/ED060SC4/gdisp_lld_ED060SC4.c | 2 | ||||
-rw-r--r-- | drivers/gdisp/HX8347D/gdisp_lld_HX8347D.c | 2 | ||||
-rw-r--r-- | drivers/gdisp/ILI9320/gdisp_lld_ILI9320.c | 7 | ||||
-rw-r--r-- | drivers/gdisp/ILI9325/gdisp_lld_ILI9325.c | 7 | ||||
-rw-r--r-- | drivers/gdisp/ILI9341/gdisp_lld_ILI9341.c | 7 | ||||
-rw-r--r-- | drivers/gdisp/ILI9481/gdisp_lld_ILI9481.c | 7 | ||||
-rw-r--r-- | drivers/gdisp/Nokia6610GE12/gdisp_lld_Nokia6610GE12.c | 13 | ||||
-rw-r--r-- | drivers/gdisp/Nokia6610GE8/gdisp_lld_Nokia6610GE8.c | 39 | ||||
-rw-r--r-- | drivers/gdisp/RA8875/gdisp_lld_RA8875.c | 2 | ||||
-rw-r--r-- | drivers/gdisp/S6D1121/gdisp_lld_S6D1121.c | 7 | ||||
-rw-r--r-- | drivers/gdisp/SSD1289/gdisp_lld_SSD1289.c | 16 | ||||
-rw-r--r-- | drivers/gdisp/SSD1289/gdisp_lld_config.h | 7 | ||||
-rw-r--r-- | drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c | 2 | ||||
-rw-r--r-- | drivers/gdisp/SSD1963/gdisp_lld_SSD1963.c | 2 | ||||
-rw-r--r-- | drivers/gdisp/SSD2119/gdisp_lld_SSD2119.c | 16 | ||||
-rw-r--r-- | drivers/gdisp/SSD2119/gdisp_lld_config.h | 5 | ||||
-rw-r--r-- | drivers/gdisp/ST7565/gdisp_lld_ST7565.c | 2 |
17 files changed, 99 insertions, 44 deletions
diff --git a/drivers/gdisp/ED060SC4/gdisp_lld_ED060SC4.c b/drivers/gdisp/ED060SC4/gdisp_lld_ED060SC4.c index 14e7f88a..3ab1de79 100644 --- a/drivers/gdisp/ED060SC4/gdisp_lld_ED060SC4.c +++ b/drivers/gdisp/ED060SC4/gdisp_lld_ED060SC4.c @@ -524,7 +524,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { bitpos = (6 - 2 * (dx % EINK_PPB)); byte = block->data[dy][dx / EINK_PPB]; byte &= ~(PIXELMASK << bitpos); - if (g->p.color != Black) + if (COLOR2NATIVE(g->p.color) != Black) byte |= PIXEL_WHITE << bitpos; else byte |= PIXEL_BLACK << bitpos; diff --git a/drivers/gdisp/HX8347D/gdisp_lld_HX8347D.c b/drivers/gdisp/HX8347D/gdisp_lld_HX8347D.c index fecf115c..4514b495 100644 --- a/drivers/gdisp/HX8347D/gdisp_lld_HX8347D.c +++ b/drivers/gdisp/HX8347D/gdisp_lld_HX8347D.c @@ -167,7 +167,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { busmode16(g); } LLDSPEC void gdisp_lld_write_color(GDisplay *g) { - write_ram16(g, g->p.color); + write_ram16(g, COLOR2NATIVE(g->p.color)); } LLDSPEC void gdisp_lld_write_stop(GDisplay *g) { busmode8(g); diff --git a/drivers/gdisp/ILI9320/gdisp_lld_ILI9320.c b/drivers/gdisp/ILI9320/gdisp_lld_ILI9320.c index a18c2d82..e65e0a77 100644 --- a/drivers/gdisp/ILI9320/gdisp_lld_ILI9320.c +++ b/drivers/gdisp/ILI9320/gdisp_lld_ILI9320.c @@ -204,7 +204,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { #endif } LLDSPEC void gdisp_lld_write_color(GDisplay *g) { - write_data(g, g->p.color); + write_data(g, COLOR2NATIVE(g->p.color)); } LLDSPEC void gdisp_lld_write_stop(GDisplay *g) { release_bus(g); @@ -225,7 +225,10 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { dummy_read(g); } LLDSPEC color_t gdisp_lld_read_color(GDisplay *g) { - return read_data(g); + uint16_t data; + + data = read_data(g); + return NATIVE2COLOR(data); } LLDSPEC void gdisp_lld_read_stop(GDisplay *g) { setwritemode(g); diff --git a/drivers/gdisp/ILI9325/gdisp_lld_ILI9325.c b/drivers/gdisp/ILI9325/gdisp_lld_ILI9325.c index 75b4cd13..ffd67cf7 100644 --- a/drivers/gdisp/ILI9325/gdisp_lld_ILI9325.c +++ b/drivers/gdisp/ILI9325/gdisp_lld_ILI9325.c @@ -200,7 +200,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { set_viewport(g); } LLDSPEC void gdisp_lld_write_color(GDisplay *g) { - write_data(g, g->p.color); + write_data(g, COLOR2NATIVE(g->p.color)); } LLDSPEC void gdisp_lld_write_stop(GDisplay *g) { release_bus(g); @@ -219,7 +219,10 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { dummy_read(g); } LLDSPEC color_t gdisp_lld_read_color(GDisplay *g) { - return read_data(g); + uint16_t data; + + data = read_data(g); + return NATIVE2COLOR(data); } LLDSPEC void gdisp_lld_read_stop(GDisplay *g) { setwritemode(g); diff --git a/drivers/gdisp/ILI9341/gdisp_lld_ILI9341.c b/drivers/gdisp/ILI9341/gdisp_lld_ILI9341.c index 33ca68d4..2513c48d 100644 --- a/drivers/gdisp/ILI9341/gdisp_lld_ILI9341.c +++ b/drivers/gdisp/ILI9341/gdisp_lld_ILI9341.c @@ -246,7 +246,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { write_index(g, 0x2C); } LLDSPEC void gdisp_lld_write_color(GDisplay *g) { - write_data16(g, g->p.color); + write_data16(g, COLOR2NATIVE(g->p.color)); } LLDSPEC void gdisp_lld_write_stop(GDisplay *g) { release_bus(g); @@ -262,7 +262,10 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { dummy_read(g); } LLDSPEC color_t gdisp_lld_read_color(GDisplay *g) { - return read_data(g); + uint16_t data; + + data = read_data(g); + return NATIVE2COLOR(data); } LLDSPEC void gdisp_lld_read_stop(GDisplay *g) { setwritemode(g); diff --git a/drivers/gdisp/ILI9481/gdisp_lld_ILI9481.c b/drivers/gdisp/ILI9481/gdisp_lld_ILI9481.c index 49e28b23..2b2f0917 100644 --- a/drivers/gdisp/ILI9481/gdisp_lld_ILI9481.c +++ b/drivers/gdisp/ILI9481/gdisp_lld_ILI9481.c @@ -211,7 +211,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { set_viewport(g); } LLDSPEC void gdisp_lld_write_color(GDisplay *g) { - write_data(g, g->p.color); + write_data(g, COLOR2NATIVE(g->p.color)); } LLDSPEC void gdisp_lld_write_stop(GDisplay *g) { release_bus(g); @@ -226,7 +226,10 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { dummy_read(g); } LLDSPEC color_t gdisp_lld_read_color(GDisplay *g) { - return read_data(g); + uint16_t data; + + data = read_data(g); + return NATIVE2COLOR(data); } LLDSPEC void gdisp_lld_read_stop(GDisplay *g) { setwritemode(g); diff --git a/drivers/gdisp/Nokia6610GE12/gdisp_lld_Nokia6610GE12.c b/drivers/gdisp/Nokia6610GE12/gdisp_lld_Nokia6610GE12.c index d1086c46..28a2fceb 100644 --- a/drivers/gdisp/Nokia6610GE12/gdisp_lld_Nokia6610GE12.c +++ b/drivers/gdisp/Nokia6610GE12/gdisp_lld_Nokia6610GE12.c @@ -70,8 +70,8 @@ /*===========================================================================*/ // Use the priv pointer itself to save our color. This save allocating ram for it -// and works provided sizeof(color_t) <= sizeof(void *) -#define savecolor(g) (*(color_t *)&g->priv) +// and works provided sizeof(uint16_t) <= sizeof(void *) +#define savecolor(g) (*(uint16_t *)&g->priv) #define GDISP_FLG_ODDBYTE (GDISP_FLG_DRIVER<<0) @@ -143,14 +143,17 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->flags &= ~GDISP_FLG_ODDBYTE; } LLDSPEC void gdisp_lld_write_color(GDisplay *g) { + uint16_t c; + + c = COLOR2NATIVE(g->p.color); if ((g->flags & GDISP_FLG_ODDBYTE)) { // Write the pair of pixels to the display write_data3(g, ((savecolor(g) >> 4) & 0xFF), - (((savecolor(g) << 4) & 0xF0)|((g->p.color >> 8) & 0x0F)), - (g->p.color & 0xFF)); + (((savecolor(g) << 4) & 0xF0)|((c >> 8) & 0x0F)), + (c & 0xFF)); g->flags &= ~GDISP_FLG_ODDBYTE; } else { - savecolor(g) = g->p.color; + savecolor(g) = c; g->flags |= GDISP_FLG_ODDBYTE; } } diff --git a/drivers/gdisp/Nokia6610GE8/gdisp_lld_Nokia6610GE8.c b/drivers/gdisp/Nokia6610GE8/gdisp_lld_Nokia6610GE8.c index e0cfb997..f6ce4278 100644 --- a/drivers/gdisp/Nokia6610GE8/gdisp_lld_Nokia6610GE8.c +++ b/drivers/gdisp/Nokia6610GE8/gdisp_lld_Nokia6610GE8.c @@ -111,9 +111,9 @@ #if GDISP_HARDWARE_STREAM_WRITE typedef struct dvrPriv { - color_t savecolor; + uint16_t savecolor; #if GDISP_GE8_BROKEN_CONTROLLER - color_t firstcolor; + uint16_t firstcolor; #endif } dvrPriv; #define PRIV ((dvrPriv *)g->priv) @@ -231,20 +231,23 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { g->flags &= ~(GDISP_FLG_ODDBYTE|GDISP_FLG_RUNBYTE); } LLDSPEC void gdisp_lld_write_color(GDisplay *g) { + uint16_t c; + + c = COLOR2NATIVE(g->p.color); #if GDISP_GE8_BROKEN_CONTROLLER if (!(g->flags & GDISP_FLG_RUNBYTE)) { - PRIV->firstcolor = g->p.color; + PRIV->firstcolor = c; g->flags |= GDISP_FLG_RUNBYTE; } #endif if ((g->flags & GDISP_FLG_ODDBYTE)) { // Write the pair of pixels to the display write_data3(g, ((PRIV->savecolor >> 4) & 0xFF), - (((PRIV->savecolor << 4) & 0xF0)|((g->p.color >> 8) & 0x0F)), - (g->p.color & 0xFF)); + (((PRIV->savecolor << 4) & 0xF0)|((c >> 8) & 0x0F)), + (c & 0xFF)); g->flags &= ~GDISP_FLG_ODDBYTE; } else { - PRIV->savecolor = g->p.color; + PRIV->savecolor = c; g->flags |= GDISP_FLG_ODDBYTE; } } @@ -284,9 +287,12 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { #if GDISP_HARDWARE_DRAWPIXEL LLDSPEC void gdisp_lld_draw_pixel(GDisplay *g) { + uint16_t c; + + c = COLOR2NATIVE(g->p.color); acquire_bus(g); set_viewport(g); - write_data3(g, 0, (g->p.color>>8) & 0x0F, g->p.color & 0xFF); + write_data3(g, 0, (c>>8) & 0x0F, c & 0xFF); release_bus(g); } #endif @@ -295,15 +301,17 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { #if GDISP_HARDWARE_FILLS LLDSPEC void gdisp_lld_fill_area(GDisplay *g) { - unsigned tuples; + unsigned tuples; + uint16_t c; tuples = (g->p.cx*g->p.cy+1)>>1; // With an odd sized area we over-print by one pixel. // This extra pixel overwrites the first pixel (harmless as it is the same colour) + c = COLOR2NATIVE(g->p.color); acquire_bus(g); set_viewport(g); while(tuples--) - write_data3(g, ((g->p.color >> 4) & 0xFF), (((g->p.color << 4) & 0xF0)|((g->p.color >> 8) & 0x0F)), (g->p.color & 0xFF)); + write_data3(g, ((c >> 4) & 0xFF), (((c << 4) & 0xF0)|((c >> 8) & 0x0F)), (c & 0xFF)); release_bus(g); } #endif @@ -311,7 +319,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { #if GDISP_HARDWARE_BITFILLS LLDSPEC void gdisp_lld_blit_area(GDisplay *g) { coord_t lg, x, y; - color_t c1, c2; + uint16_t c1, c2; unsigned tuples; const pixel_t *buffer; #if GDISP_PACKED_PIXELS @@ -328,7 +336,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { acquire_bus(g); set_viewport(g); - /* to surpress compiler warnings */ + /* to suppress compiler warnings */ x = 0; y = 0; @@ -356,7 +364,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { while(tuples--) { /* Get a pixel */ - c1 = *p++; + c1 = COLOR2NATIVE(*p++); /* Check for line or buffer wrapping */ if (++x >= g->p.cx) { @@ -369,7 +377,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { } /* Get the next pixel */ - c2 = *p++; + c2 = COLOR2NATIVE(*p++); /* Check for line or buffer wrapping */ if (++x >= g->p.cx) { @@ -385,7 +393,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { write_data3(g, ((c1 >> 4) & 0xFF), (((c1 << 4) & 0xF0)|((c2 >> 8) & 0x0F)), (c2 & 0xFF)); } - #else + #elif GDISP_PIXELFORMAT == GDISP_LLD_PIXELFORMAT // Although this controller uses packed pixels, we may have to feed it into // the controller with different packing to the source bitmap @@ -440,6 +448,9 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { /* Write the pair of pixels to the display */ write_data3(g, ((c1 >> 4) & 0xFF), (((c1 << 4) & 0xF0)|((c2 >> 8) & 0x0F)), (c2 & 0xFF)); } + + #else + #error "Packed pixels is broken if you are not running native pixel format" #endif /* All done */ diff --git a/drivers/gdisp/RA8875/gdisp_lld_RA8875.c b/drivers/gdisp/RA8875/gdisp_lld_RA8875.c index fb81c43a..d28670c6 100644 --- a/drivers/gdisp/RA8875/gdisp_lld_RA8875.c +++ b/drivers/gdisp/RA8875/gdisp_lld_RA8875.c @@ -184,7 +184,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { set_viewport(g); } LLDSPEC void gdisp_lld_write_color(GDisplay *g) { - write_data(g, g->p.color); + write_data(g, COLOR2NATIVE(g->p.color)); } LLDSPEC void gdisp_lld_write_stop(GDisplay *g) { release_bus(g); diff --git a/drivers/gdisp/S6D1121/gdisp_lld_S6D1121.c b/drivers/gdisp/S6D1121/gdisp_lld_S6D1121.c index cbaa7199..cca9d67e 100644 --- a/drivers/gdisp/S6D1121/gdisp_lld_S6D1121.c +++ b/drivers/gdisp/S6D1121/gdisp_lld_S6D1121.c @@ -221,7 +221,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { set_viewport(g); } LLDSPEC void gdisp_lld_write_color(GDisplay *g) { - write_data(g, g->p.color); + write_data(g, COLOR2NATIVE(g->p.color)); } LLDSPEC void gdisp_lld_write_stop(GDisplay *g) { release_bus(g); @@ -240,7 +240,10 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { dummy_read(g); } LLDSPEC color_t gdisp_lld_read_color(GDisplay *g) { - return read_data(g); + uint16_t data; + + data = read_data(g); + return NATIVE2COLOR(data); } LLDSPEC void gdisp_lld_read_stop(GDisplay *g) { setwritemode(g); diff --git a/drivers/gdisp/SSD1289/gdisp_lld_SSD1289.c b/drivers/gdisp/SSD1289/gdisp_lld_SSD1289.c index 6692e7d7..a33b6564 100644 --- a/drivers/gdisp/SSD1289/gdisp_lld_SSD1289.c +++ b/drivers/gdisp/SSD1289/gdisp_lld_SSD1289.c @@ -200,7 +200,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { #endif } LLDSPEC void gdisp_lld_write_color(GDisplay *g) { - write_data(g, g->p.color); + write_data(g, COLOR2NATIVE(g->p.color)); } LLDSPEC void gdisp_lld_write_stop(GDisplay *g) { release_bus(g); @@ -221,7 +221,10 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { dummy_read(g); } LLDSPEC color_t gdisp_lld_read_color(GDisplay *g) { - return read_data(g); + uint16_t data; + + data = read_data(g); + return NATIVE2COLOR(data); } LLDSPEC void gdisp_lld_read_stop(GDisplay *g) { setwritemode(g); @@ -231,15 +234,22 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { #if GDISP_HARDWARE_FILLS && defined(GDISP_USE_DMA) LLDSPEC void gdisp_lld_fill_area(GDisplay *g) { + uint16_t c; + + c = COLOR2NATIVE(g->p.color); acquire_bus(g); set_viewport(g); set_cursor(g); - dma_with_noinc(g, &color, g->p.cx*g->p.cy) + dma_with_noinc(g, &c, g->p.cx*g->p.cy) release_bus(g); } #endif #if GDISP_HARDWARE_BITFILLS && defined(GDISP_USE_DMA) + #if GDISP_PIXELFORMAT != GDISP_LLD_PIXELFORMAT + #error "GDISP: SSD1289: BitBlit is only available in RGB565 pixel format" + #endif + LLDSPEC void gdisp_lld_blit_area(GDisplay *g) { pixel_t *buffer; coord_t ycnt; diff --git a/drivers/gdisp/SSD1289/gdisp_lld_config.h b/drivers/gdisp/SSD1289/gdisp_lld_config.h index 4cf5fa5c..a9166553 100644 --- a/drivers/gdisp/SSD1289/gdisp_lld_config.h +++ b/drivers/gdisp/SSD1289/gdisp_lld_config.h @@ -28,8 +28,11 @@ #define GDISP_HARDWARE_CONTROL TRUE #if defined(GDISP_USE_DMA)
- #define GDISP_HARDWARE_FILLS TRUE
- #define GDISP_HARDWARE_BITFILLS TRUE + #define GDISP_HARDWARE_FILLS TRUE + #if !defined(GDISP_PIXELFORMAT) || GDISP_PIXELFORMAT == 0x2565 + // Hardware BitBlts are only supported in native pixel format on this controller
+ #define GDISP_HARDWARE_BITFILLS TRUE + #endif #endif
#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_RGB565
diff --git a/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c b/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c index bd3e386d..b72ba781 100644 --- a/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c +++ b/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c @@ -176,7 +176,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { x = g->p.x; break; } - if (g->p.color != Black) + if (COLOR2NATIVE(g->p.color) != Black) RAM(g)[xyaddr(x, y)] |= xybit(y); else RAM(g)[xyaddr(x, y)] &= ~xybit(y); diff --git a/drivers/gdisp/SSD1963/gdisp_lld_SSD1963.c b/drivers/gdisp/SSD1963/gdisp_lld_SSD1963.c index b94c1a40..eb1b9b15 100644 --- a/drivers/gdisp/SSD1963/gdisp_lld_SSD1963.c +++ b/drivers/gdisp/SSD1963/gdisp_lld_SSD1963.c @@ -188,7 +188,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { set_viewport(g); } LLDSPEC void gdisp_lld_write_color(GDisplay *g) { - write_data(g, g->p.color); + write_data(g, COLOR2NATIVE(g->p.color)); } LLDSPEC void gdisp_lld_write_stop(GDisplay *g) { release_bus(g); diff --git a/drivers/gdisp/SSD2119/gdisp_lld_SSD2119.c b/drivers/gdisp/SSD2119/gdisp_lld_SSD2119.c index df05fc2c..9594ff95 100644 --- a/drivers/gdisp/SSD2119/gdisp_lld_SSD2119.c +++ b/drivers/gdisp/SSD2119/gdisp_lld_SSD2119.c @@ -238,7 +238,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay* g) { set_viewport(g); } LLDSPEC void gdisp_lld_write_color(GDisplay* g) { - write_data(g, g->p.color); + write_data(g, COLOR2NATIVE(g->p.color)); } LLDSPEC void gdisp_lld_write_stop(GDisplay* g) { release_bus(g); @@ -257,7 +257,10 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay* g) { dummy_read(g); } LLDSPEC color_t gdisp_lld_read_color(GDisplay* g) { - return read_data(g); + uint16_t data; + + data = read_data(g); + return NATIVE2COLOR(data); } LLDSPEC void gdisp_lld_read_stop(GDisplay* g) { setwritemode(g); @@ -267,15 +270,22 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay* g) { #if GDISP_HARDWARE_FILLS && defined(GDISP_USE_DMA) LLDSPEC void gdisp_lld_fill_area(GDisplay* g) { + uint16_t c; + + c = COLOR2NATIVE(g->p.color); acquire_bus(g); set_viewport(g); set_cursor(g); - dma_with_noinc(g, &g->p.color, g->p.cx * g->p.cy); + dma_with_noinc(g, &c, g->p.cx * g->p.cy); release_bus(g); } #endif #if GDISP_HARDWARE_BITFILLS && defined(GDISP_USE_DMA) + #if GDISP_PIXELFORMAT != GDISP_LLD_PIXELFORMAT + #error "GDISP: SSD2119: BitBlit is only available in RGB565 pixel format" + #endif + LLDSPEC void gdisp_lld_blit_area(GDisplay* g) { pixel_t* buffer; coord_t ynct; diff --git a/drivers/gdisp/SSD2119/gdisp_lld_config.h b/drivers/gdisp/SSD2119/gdisp_lld_config.h index a974c623..ec034bef 100644 --- a/drivers/gdisp/SSD2119/gdisp_lld_config.h +++ b/drivers/gdisp/SSD2119/gdisp_lld_config.h @@ -29,7 +29,10 @@ #if defined(GDISP_USE_DMA) #define GDISP_HARDWARE_FILLS TRUE - #define GDISP_HARDWARE_BITFILLS TRUE + #if !defined(GDISP_PIXELFORMAT) || GDISP_PIXELFORMAT == 0x2565 + // Hardware BitBlts are only supported in native pixel format on this controller + #define GDISP_HARDWARE_BITFILLS TRUE + #endif #endif #define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_RGB565 diff --git a/drivers/gdisp/ST7565/gdisp_lld_ST7565.c b/drivers/gdisp/ST7565/gdisp_lld_ST7565.c index bd8c7b74..2bb5406f 100644 --- a/drivers/gdisp/ST7565/gdisp_lld_ST7565.c +++ b/drivers/gdisp/ST7565/gdisp_lld_ST7565.c @@ -167,7 +167,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { y = g->p.x; break; } - if (g->p.color != Black) + if (COLOR2NATIVE(g->p.color) != Black) RAM(g)[xyaddr(x, y)] |= xybit(y); else RAM(g)[xyaddr(x, y)] &= ~xybit(y); |