diff options
author | inmarket <andrewh@inmarket.com.au> | 2013-10-21 15:13:10 +1000 |
---|---|---|
committer | inmarket <andrewh@inmarket.com.au> | 2013-10-21 15:13:10 +1000 |
commit | 0535c67eab412e72223bc06a528c5bf7cd4aeb22 (patch) | |
tree | 1349ae0420683f03ed09ca6d8aca52acbc7af9b5 /drivers/gdisp/Nokia6610GE8 | |
parent | 0b9db701a1d52c8a6d63ca692619b0dde47805d1 (diff) | |
download | uGFX-0535c67eab412e72223bc06a528c5bf7cd4aeb22.tar.gz uGFX-0535c67eab412e72223bc06a528c5bf7cd4aeb22.tar.bz2 uGFX-0535c67eab412e72223bc06a528c5bf7cd4aeb22.zip |
Add support for a driver private area (as well as a board private area)
Diffstat (limited to 'drivers/gdisp/Nokia6610GE8')
-rw-r--r-- | drivers/gdisp/Nokia6610GE8/board_Nokia6610GE8_olimexsam7ex256.h | 4 | ||||
-rw-r--r-- | drivers/gdisp/Nokia6610GE8/gdisp_lld.c | 35 |
2 files changed, 24 insertions, 15 deletions
diff --git a/drivers/gdisp/Nokia6610GE8/board_Nokia6610GE8_olimexsam7ex256.h b/drivers/gdisp/Nokia6610GE8/board_Nokia6610GE8_olimexsam7ex256.h index ebd038d5..6cbcc5ab 100644 --- a/drivers/gdisp/Nokia6610GE8/board_Nokia6610GE8_olimexsam7ex256.h +++ b/drivers/gdisp/Nokia6610GE8/board_Nokia6610GE8_olimexsam7ex256.h @@ -71,8 +71,8 @@ static bool_t pwmRunning = FALSE; */ static inline void init_board(GDisplay *g) { - // As we are not using multiple displays we set g->priv to NULL as we don't use it. - g->priv = 0; + // As we are not using multiple displays we set g->board to NULL as we don't use it. + g->board = 0; switch(g->controllerdisplay) { case 0: // Set up for Display 0 diff --git a/drivers/gdisp/Nokia6610GE8/gdisp_lld.c b/drivers/gdisp/Nokia6610GE8/gdisp_lld.c index 4906ee78..1bc7282a 100644 --- a/drivers/gdisp/Nokia6610GE8/gdisp_lld.c +++ b/drivers/gdisp/Nokia6610GE8/gdisp_lld.c @@ -110,10 +110,13 @@ /*===========================================================================*/ #if GDISP_HARDWARE_STREAM_WRITE - static color_t savecolor[GDISP_TOTAL_DISPLAYS]; - #if GDISP_GE8_BROKEN_CONTROLLER - static color_t firstcolor[GDISP_TOTAL_DISPLAYS]; - #endif + typedef struct dvrPriv { + color_t savecolor; + #if GDISP_GE8_BROKEN_CONTROLLER + color_t firstcolor; + #endif + } dvrPriv; + #define PRIV ((dvrPriv *)g->priv) #endif #define GDISP_FLG_ODDBYTE (GDISP_FLG_DRIVER<<0) @@ -164,7 +167,13 @@ static inline void set_viewport(GDisplay* g) { /*===========================================================================*/ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { - /* Initialise your display */ + #if GDISP_HARDWARE_STREAM_WRITE + g->priv = gfxAlloc(sizeof(dvrPriv)); + #else + g->priv = 0; + #endif + + // Initialise the board interface init_board(g); // Hardware reset @@ -224,18 +233,18 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { LLDSPEC void gdisp_lld_write_color(GDisplay *g) { #if GDISP_GE8_BROKEN_CONTROLLER if (!(g->flags & GDISP_FLG_RUNBYTE)) { - firstcolor[g->controllerdisplay] = g->p.color; + PRIV->firstcolor = g->p.color; g->flags |= GDISP_FLG_RUNBYTE; } #endif 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, ((PRIV->savecolor >> 4) & 0xFF), + (((PRIV->savecolor << 4) & 0xF0)|((g->p.color >> 8) & 0x0F)), (g->p.color & 0xFF)); g->flags &= ~GDISP_FLG_ODDBYTE; } else { - savecolor[g->controllerdisplay] = g->p.color; + PRIV->savecolor = g->p.color; g->flags |= GDISP_FLG_ODDBYTE; } } @@ -260,11 +269,11 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) { * user application uses the streaming calls and then terminates the stream early or after buffer wrap. * Since this is such an unlikely situation we just don't handle it. */ - write_data3(g, ((savecolor[g->controllerdisplay] >> 4) & 0xFF), - (((savecolor[g->controllerdisplay] << 4) & 0xF0)|((firstcolor[g->controllerdisplay] >> 8) & 0x0F)), - (firstcolor[g->controllerdisplay] & 0xFF)); + write_data3(g, ((PRIV->savecolor >> 4) & 0xFF), + (((PRIV->savecolor << 4) & 0xF0)|((PRIV->firstcolor >> 8) & 0x0F)), + (PRIV->firstcolor & 0xFF)); #else - write_data2(g, ((savecolor[g->controllerdisplay] >> 4) & 0xFF), ((savecolor[g->controllerdisplay] << 4) & 0xF0)); + write_data2(g, ((PRIV->savecolor >> 4) & 0xFF), ((PRIV->savecolor << 4) & 0xF0)); write_index(g, NOP); #endif } |