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/Nokia6610GE12 | |
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/Nokia6610GE12')
-rw-r--r-- | drivers/gdisp/Nokia6610GE12/board_Nokia6610GE12_olimexsam7ex256.h | 4 | ||||
-rw-r--r-- | drivers/gdisp/Nokia6610GE12/gdisp_lld.c | 17 |
2 files changed, 13 insertions, 8 deletions
diff --git a/drivers/gdisp/Nokia6610GE12/board_Nokia6610GE12_olimexsam7ex256.h b/drivers/gdisp/Nokia6610GE12/board_Nokia6610GE12_olimexsam7ex256.h index 7aad94d3..05a48e47 100644 --- a/drivers/gdisp/Nokia6610GE12/board_Nokia6610GE12_olimexsam7ex256.h +++ b/drivers/gdisp/Nokia6610GE12/board_Nokia6610GE12_olimexsam7ex256.h @@ -59,8 +59,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/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); |