aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gdisp/Nokia6610GE12/gdisp_lld_Nokia6610GE12.c
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2013-11-05 19:34:12 +1000
committerinmarket <andrewh@inmarket.com.au>2013-11-05 19:34:12 +1000
commita8e860678df38fdb44f94cacae52e8d54f4374ff (patch)
treeaa718324e163f6c4b9b06805674655dce17e2c96 /drivers/gdisp/Nokia6610GE12/gdisp_lld_Nokia6610GE12.c
parent250adaf028848c0aa0dfa2029b722274cb7a6d6a (diff)
downloaduGFX-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/Nokia6610GE12/gdisp_lld_Nokia6610GE12.c')
-rw-r--r--drivers/gdisp/Nokia6610GE12/gdisp_lld_Nokia6610GE12.c13
1 files changed, 8 insertions, 5 deletions
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;
}
}