aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gdisp
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gdisp')
-rw-r--r--drivers/gdisp/HX8347D/board_HX8347D_stm32f4discovery.h4
-rw-r--r--drivers/gdisp/HX8347D/gdisp_lld.c5
-rw-r--r--drivers/gdisp/ILI9320/board_ILI9320_olimex_pic32mx_lcd.h4
-rw-r--r--drivers/gdisp/ILI9320/board_ILI9320_olimex_stm32_lcd.h4
-rw-r--r--drivers/gdisp/ILI9320/gdisp_lld.c5
-rw-r--r--drivers/gdisp/ILI9325/board_ILI9325_hy_stm32_100p.h4
-rw-r--r--drivers/gdisp/ILI9325/gdisp_lld.c5
-rw-r--r--drivers/gdisp/ILI9481/board_ILI9481_firebullstm32f103.h4
-rw-r--r--drivers/gdisp/ILI9481/gdisp_lld.c5
-rw-r--r--drivers/gdisp/Nokia6610GE12/board_Nokia6610GE12_olimexsam7ex256.h4
-rw-r--r--drivers/gdisp/Nokia6610GE12/gdisp_lld.c17
-rw-r--r--drivers/gdisp/Nokia6610GE8/board_Nokia6610GE8_olimexsam7ex256.h4
-rw-r--r--drivers/gdisp/Nokia6610GE8/gdisp_lld.c35
-rw-r--r--drivers/gdisp/RA8875/board_RA8875_marlin.h4
-rw-r--r--drivers/gdisp/RA8875/gdisp_lld.c5
-rw-r--r--drivers/gdisp/S6D1121/board_S6D1121_olimex_e407.h4
-rw-r--r--drivers/gdisp/S6D1121/gdisp_lld.c5
-rw-r--r--drivers/gdisp/SSD1289/board_SSD1289_firebullstm32f103.h4
-rw-r--r--drivers/gdisp/SSD1289/board_SSD1289_stm32f4discovery.h4
-rw-r--r--drivers/gdisp/SSD1289/gdisp_lld.c5
-rw-r--r--drivers/gdisp/TestStub/gdisp_lld.c3
21 files changed, 86 insertions, 48 deletions
diff --git a/drivers/gdisp/HX8347D/board_HX8347D_stm32f4discovery.h b/drivers/gdisp/HX8347D/board_HX8347D_stm32f4discovery.h
index daabe75d..708e1a06 100644
--- a/drivers/gdisp/HX8347D/board_HX8347D_stm32f4discovery.h
+++ b/drivers/gdisp/HX8347D/board_HX8347D_stm32f4discovery.h
@@ -66,8 +66,8 @@ static const SPIConfig spi1cfg_16bit = {
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/HX8347D/gdisp_lld.c b/drivers/gdisp/HX8347D/gdisp_lld.c
index 8cdbb781..3851c8e1 100644
--- a/drivers/gdisp/HX8347D/gdisp_lld.c
+++ b/drivers/gdisp/HX8347D/gdisp_lld.c
@@ -62,7 +62,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
diff --git a/drivers/gdisp/ILI9320/board_ILI9320_olimex_pic32mx_lcd.h b/drivers/gdisp/ILI9320/board_ILI9320_olimex_pic32mx_lcd.h
index cf101aaf..5315127b 100644
--- a/drivers/gdisp/ILI9320/board_ILI9320_olimex_pic32mx_lcd.h
+++ b/drivers/gdisp/ILI9320/board_ILI9320_olimex_pic32mx_lcd.h
@@ -19,8 +19,8 @@
static 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/ILI9320/board_ILI9320_olimex_stm32_lcd.h b/drivers/gdisp/ILI9320/board_ILI9320_olimex_stm32_lcd.h
index 4738db61..8e79009a 100644
--- a/drivers/gdisp/ILI9320/board_ILI9320_olimex_stm32_lcd.h
+++ b/drivers/gdisp/ILI9320/board_ILI9320_olimex_stm32_lcd.h
@@ -20,8 +20,8 @@
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/ILI9320/gdisp_lld.c b/drivers/gdisp/ILI9320/gdisp_lld.c
index d4639617..bf82a88a 100644
--- a/drivers/gdisp/ILI9320/gdisp_lld.c
+++ b/drivers/gdisp/ILI9320/gdisp_lld.c
@@ -98,7 +98,10 @@ static void set_viewport(GDisplay *g) {
LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
uint16_t cver;
- /* Initialise your display */
+ // No private area for this controller
+ g->priv = 0;
+
+ // Initialise the board interface
init_board(g);
/* Hardware reset */
diff --git a/drivers/gdisp/ILI9325/board_ILI9325_hy_stm32_100p.h b/drivers/gdisp/ILI9325/board_ILI9325_hy_stm32_100p.h
index ae9e96fc..02949605 100644
--- a/drivers/gdisp/ILI9325/board_ILI9325_hy_stm32_100p.h
+++ b/drivers/gdisp/ILI9325/board_ILI9325_hy_stm32_100p.h
@@ -33,8 +33,8 @@
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/ILI9325/gdisp_lld.c b/drivers/gdisp/ILI9325/gdisp_lld.c
index 8a4b8603..6bb649b1 100644
--- a/drivers/gdisp/ILI9325/gdisp_lld.c
+++ b/drivers/gdisp/ILI9325/gdisp_lld.c
@@ -99,7 +99,10 @@ static void set_viewport(GDisplay* g) {
LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
uint16_t cver;
- /* Initialise your display */
+ // No private area for this controller
+ g->priv = 0;
+
+ // Initialise the board interface
init_board(g);
/* Hardware reset */
diff --git a/drivers/gdisp/ILI9481/board_ILI9481_firebullstm32f103.h b/drivers/gdisp/ILI9481/board_ILI9481_firebullstm32f103.h
index 9933d17b..52d8afda 100644
--- a/drivers/gdisp/ILI9481/board_ILI9481_firebullstm32f103.h
+++ b/drivers/gdisp/ILI9481/board_ILI9481_firebullstm32f103.h
@@ -27,8 +27,8 @@
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/ILI9481/gdisp_lld.c b/drivers/gdisp/ILI9481/gdisp_lld.c
index fc00be10..5af12986 100644
--- a/drivers/gdisp/ILI9481/gdisp_lld.c
+++ b/drivers/gdisp/ILI9481/gdisp_lld.c
@@ -71,7 +71,10 @@ static 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 */
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);
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
}
diff --git a/drivers/gdisp/RA8875/board_RA8875_marlin.h b/drivers/gdisp/RA8875/board_RA8875_marlin.h
index 88523060..da90d8f3 100644
--- a/drivers/gdisp/RA8875/board_RA8875_marlin.h
+++ b/drivers/gdisp/RA8875/board_RA8875_marlin.h
@@ -22,8 +22,8 @@
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/RA8875/gdisp_lld.c b/drivers/gdisp/RA8875/gdisp_lld.c
index 6697d9fd..7916ef3b 100644
--- a/drivers/gdisp/RA8875/gdisp_lld.c
+++ b/drivers/gdisp/RA8875/gdisp_lld.c
@@ -107,7 +107,10 @@ static inline void set_backlight(GDisplay* g, uint8_t percent) {
/*===========================================================================*/
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
diff --git a/drivers/gdisp/S6D1121/board_S6D1121_olimex_e407.h b/drivers/gdisp/S6D1121/board_S6D1121_olimex_e407.h
index ec367183..4f8d2f58 100644
--- a/drivers/gdisp/S6D1121/board_S6D1121_olimex_e407.h
+++ b/drivers/gdisp/S6D1121/board_S6D1121_olimex_e407.h
@@ -20,8 +20,8 @@
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/S6D1121/gdisp_lld.c b/drivers/gdisp/S6D1121/gdisp_lld.c
index 8b6a956c..f7e12591 100644
--- a/drivers/gdisp/S6D1121/gdisp_lld.c
+++ b/drivers/gdisp/S6D1121/gdisp_lld.c
@@ -117,7 +117,10 @@ static inline void set_viewport(GDisplay *g) {
}
LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
- /* initialize the hardware */
+ // No private area for this controller
+ g->priv = 0;
+
+ // Initialise the board interface
init_board(g);
/* Hardware reset */
diff --git a/drivers/gdisp/SSD1289/board_SSD1289_firebullstm32f103.h b/drivers/gdisp/SSD1289/board_SSD1289_firebullstm32f103.h
index 338d9799..3277a902 100644
--- a/drivers/gdisp/SSD1289/board_SSD1289_firebullstm32f103.h
+++ b/drivers/gdisp/SSD1289/board_SSD1289_firebullstm32f103.h
@@ -26,8 +26,8 @@
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/SSD1289/board_SSD1289_stm32f4discovery.h b/drivers/gdisp/SSD1289/board_SSD1289_stm32f4discovery.h
index d1e23c4a..81ce0512 100644
--- a/drivers/gdisp/SSD1289/board_SSD1289_stm32f4discovery.h
+++ b/drivers/gdisp/SSD1289/board_SSD1289_stm32f4discovery.h
@@ -36,8 +36,8 @@ static const PWMConfig pwmcfg = {
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/SSD1289/gdisp_lld.c b/drivers/gdisp/SSD1289/gdisp_lld.c
index 840a1753..698d3cfc 100644
--- a/drivers/gdisp/SSD1289/gdisp_lld.c
+++ b/drivers/gdisp/SSD1289/gdisp_lld.c
@@ -115,7 +115,10 @@ static 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
diff --git a/drivers/gdisp/TestStub/gdisp_lld.c b/drivers/gdisp/TestStub/gdisp_lld.c
index f9c421f5..1a5ad81f 100644
--- a/drivers/gdisp/TestStub/gdisp_lld.c
+++ b/drivers/gdisp/TestStub/gdisp_lld.c
@@ -32,6 +32,9 @@
#endif
LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
+ /* No board interface and no private driver area */
+ g->priv = g->board = 0;
+
/* Initialise the GDISP structure */
g->g.Width = GDISP_SCREEN_WIDTH;
g->g.Height = GDISP_SCREEN_HEIGHT;