aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gdisp/Nokia6610GE12/gdisp_lld.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gdisp/Nokia6610GE12/gdisp_lld.c')
-rw-r--r--drivers/gdisp/Nokia6610GE12/gdisp_lld.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/gdisp/Nokia6610GE12/gdisp_lld.c b/drivers/gdisp/Nokia6610GE12/gdisp_lld.c
index 9aa5ac53..25f26c69 100644
--- a/drivers/gdisp/Nokia6610GE12/gdisp_lld.c
+++ b/drivers/gdisp/Nokia6610GE12/gdisp_lld.c
@@ -69,7 +69,9 @@
/* Driver local variables. */
/*===========================================================================*/
-static color_t savecolor[GDISP_TOTAL_DISPLAYS];
+// 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)
#define GDISP_FLG_ODDBYTE (GDISP_FLG_DRIVER<<0)
@@ -96,7 +98,10 @@ static inline void set_viewport(GDisplay* g) {
/*===========================================================================*/
LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
- /* Initialise your display */
+ // No private area for this controller
+ g->priv = 0;
+
+ // Initialise the board interface
init_board(g);
// Hardware reset
@@ -140,18 +145,18 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
LLDSPEC void gdisp_lld_write_color(GDisplay *g) {
if ((g->flags & GDISP_FLG_ODDBYTE)) {
// Write the pair of pixels to the display
- write_data3(g, ((savecolor[g->controllerdisplay] >> 4) & 0xFF),
- (((savecolor[g->controllerdisplay] << 4) & 0xF0)|((g->p.color >> 8) & 0x0F)),
+ write_data3(g, ((savecolor(g) >> 4) & 0xFF),
+ (((savecolor(g) << 4) & 0xF0)|((g->p.color >> 8) & 0x0F)),
(g->p.color & 0xFF));
g->flags &= ~GDISP_FLG_ODDBYTE;
} else {
- savecolor[g->controllerdisplay] = g->p.color;
+ savecolor(g) = g->p.color;
g->flags |= GDISP_FLG_ODDBYTE;
}
}
LLDSPEC void gdisp_lld_write_stop(GDisplay *g) {
if ((g->flags & GDISP_FLG_ODDBYTE)) {
- write_data2(g, ((savecolor[g->controllerdisplay] >> 4) & 0xFF), ((savecolor[g->controllerdisplay] << 4) & 0xF0));
+ write_data2(g, ((savecolor(g) >> 4) & 0xFF), ((savecolor(g) << 4) & 0xF0));
write_index(g, NOP);
}
release_bus(g);