aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gdisp
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2013-10-02 16:30:06 +1000
committerinmarket <andrewh@inmarket.com.au>2013-10-02 16:30:06 +1000
commitd7d02395d0c1afe27bc39eeddc17899084c72de9 (patch)
tree55ce695c48c08f52aa8afbdbd92f7ad4ec3746aa /drivers/gdisp
parent884db04e8c13d9258c6aea10248e42615e10ab83 (diff)
downloaduGFX-d7d02395d0c1afe27bc39eeddc17899084c72de9.tar.gz
uGFX-d7d02395d0c1afe27bc39eeddc17899084c72de9.tar.bz2
uGFX-d7d02395d0c1afe27bc39eeddc17899084c72de9.zip
Updates to ported drivers to support new optimisation method.
Includes Bug fixes.
Diffstat (limited to 'drivers/gdisp')
-rw-r--r--drivers/gdisp/ILI9320/gdisp_lld.c43
-rw-r--r--drivers/gdisp/ILI9320/gdisp_lld_config.h1
-rw-r--r--drivers/gdisp/ILI9325/gdisp_lld.c42
-rw-r--r--drivers/gdisp/ILI9325/gdisp_lld_config.h1
-rw-r--r--drivers/gdisp/SSD1289/gdisp_lld.c37
-rw-r--r--drivers/gdisp/SSD1289/gdisp_lld_config.h1
6 files changed, 90 insertions, 35 deletions
diff --git a/drivers/gdisp/ILI9320/gdisp_lld.c b/drivers/gdisp/ILI9320/gdisp_lld.c
index d8bc411a..68081b96 100644
--- a/drivers/gdisp/ILI9320/gdisp_lld.c
+++ b/drivers/gdisp/ILI9320/gdisp_lld.c
@@ -57,31 +57,43 @@ uint32_t DISPLAY_CODE;
#define dummy_read() { volatile uint16_t dummy; dummy = read_data(); (void) dummy; }
#define write_reg(reg, data) { write_index(reg); write_data(data); }
-static void set_viewport(uint16_t x, uint16_t y, uint16_t cx, uint16_t cy) {
+static void set_cursor(GDISPDriver *g) {
switch(g->g.Orientation) {
case GDISP_ROTATE_0:
case GDISP_ROTATE_180:
- write_reg(0x0050, x);
- write_reg(0x0051, x + cx - 1);
- write_reg(0x0052, y);
- write_reg(0x0053, y + cy - 1);
- write_reg(0x0020, x);
- write_reg(0x0021, y);
+ write_reg(0x0020, g->p.x);
+ write_reg(0x0021, g->p.y);
break;
case GDISP_ROTATE_90:
case GDISP_ROTATE_270:
- write_reg(0x0050, y);
- write_reg(0x0051, y + cy - 1);
- write_reg(0x0052, x);
- write_reg(0x0053, x + cx - 1);
- write_reg(0x0020, y);
- write_reg(0x0021, x);
+ write_reg(0x0020, g->p.y);
+ write_reg(0x0021, g->p.x);
break;
}
write_index(0x0022);
}
+static void set_viewport(GDISPDriver *g) {
+ switch(g->g.Orientation) {
+ case GDISP_ROTATE_0:
+ case GDISP_ROTATE_180:
+ write_reg(0x0050, g->p.x);
+ write_reg(0x0051, g->p.x + g->p.cx - 1);
+ write_reg(0x0052, g->p.y);
+ write_reg(0x0053, g->p.y + g->p.cy - 1);
+ break;
+
+ case GDISP_ROTATE_90:
+ case GDISP_ROTATE_270:
+ write_reg(0x0050, g->p.y);
+ write_reg(0x0051, g->p.y + g->p.cy - 1);
+ write_reg(0x0052, g->p.x);
+ write_reg(0x0053, g->p.x + g->p.cx - 1);
+ break;
+ }
+}
+
LLDSPEC bool_t gdisp_lld_init(GDISPDriver *g) {
/* Initialise your display */
init_board();
@@ -181,12 +193,17 @@ LLDSPEC bool_t gdisp_lld_init(GDISPDriver *g) {
LLDSPEC void gdisp_lld_write_stop(GDISPDriver *g) {
release_bus();
}
+ LLDSPEC void gdisp_lld_write_pos(GDISPDriver *g) {
+ set_cursor(g);
+ }
+ #endif
#endif
#if GDISP_HARDWARE_STREAM_READ
LLDSPEC void gdisp_lld_read_start(GDISPDriver *g) {
acquire_bus();
set_viewport(g);
+ set_cursor(g);
setreadmode();
dummy_read();
}
diff --git a/drivers/gdisp/ILI9320/gdisp_lld_config.h b/drivers/gdisp/ILI9320/gdisp_lld_config.h
index 7cf7457a..02533e8b 100644
--- a/drivers/gdisp/ILI9320/gdisp_lld_config.h
+++ b/drivers/gdisp/ILI9320/gdisp_lld_config.h
@@ -27,6 +27,7 @@
#define GDISP_HARDWARE_STREAM_WRITE TRUE
#define GDISP_HARDWARE_STREAM_READ TRUE
+#define GDISP_HARDWARE_STREAM_POS TRUE
#define GDISP_HARDWARE_CONTROL TRUE
#define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB565
diff --git a/drivers/gdisp/ILI9325/gdisp_lld.c b/drivers/gdisp/ILI9325/gdisp_lld.c
index a30bea44..4795887e 100644
--- a/drivers/gdisp/ILI9325/gdisp_lld.c
+++ b/drivers/gdisp/ILI9325/gdisp_lld.c
@@ -61,29 +61,41 @@ uint32_t DISPLAY_CODE;
#define dummy_read() { volatile uint16_t dummy; dummy = read_data(); (void) dummy; }
#define write_reg(reg, data) { write_index(reg); write_data(data); }
+static void set_cursor(GDISPDriver *g) {
+ switch(g->g.Orientation) {
+ case GDISP_ROTATE_0:
+ case GDISP_ROTATE_180:
+ write_reg(0x0020, g->p.x);
+ write_reg(0x0021, g->p.y);
+ break;
+
+ case GDISP_ROTATE_90:
+ case GDISP_ROTATE_270:
+ write_reg(0x0020, g->p.y);
+ write_reg(0x0021, g->p.x);
+ break;
+ }
+ write_index(0x0022);
+}
+
static void set_viewport(GDISPDriver* g) {
switch(g->g.Orientation) {
case GDISP_ROTATE_0:
case GDISP_ROTATE_180:
- write_reg(0x0050, x);
- write_reg(0x0051, x + cx - 1);
- write_reg(0x0052, y);
- write_reg(0x0053, y + cy - 1);
- write_reg(0x0020, x);
- write_reg(0x0021, y);
+ write_reg(0x0050, g->p.x);
+ write_reg(0x0051, g->p.x + g->p.cx - 1);
+ write_reg(0x0052, g->p.y);
+ write_reg(0x0053, g->p.y + g->p.cy - 1);
break;
case GDISP_ROTATE_90:
case GDISP_ROTATE_270:
- write_reg(0x0050, y);
- write_reg(0x0051, y + cy - 1);
- write_reg(0x0052, x);
- write_reg(0x0053, x + cx - 1);
- write_reg(0x0020, y);
- write_reg(0x0021, x);
+ write_reg(0x0050, g->p.y);
+ write_reg(0x0051, g->p.y + g->p.cy - 1);
+ write_reg(0x0052, g->p.x);
+ write_reg(0x0053, g->p.x + g->p.cx - 1);
break;
}
- write_reg(0x0022, color);
}
LLDSPEC bool_t gdisp_lld_init(GDISPDriver *g) {
@@ -182,12 +194,16 @@ LLDSPEC bool_t gdisp_lld_init(GDISPDriver *g) {
LLDSPEC void gdisp_lld_write_stop(GDISPDriver *g) {
release_bus();
}
+ LLDSPEC void gdisp_lld_write_pos(GDISPDriver *g) {
+ set_cursor(g);
+ }
#endif
#if GDISP_HARDWARE_STREAM_READ
LLDSPEC void gdisp_lld_read_start(GDISPDriver *g) {
acquire_bus();
set_viewport(g);
+ set_cursor(g);
setreadmode();
dummy_read();
}
diff --git a/drivers/gdisp/ILI9325/gdisp_lld_config.h b/drivers/gdisp/ILI9325/gdisp_lld_config.h
index 572b8361..aabf768f 100644
--- a/drivers/gdisp/ILI9325/gdisp_lld_config.h
+++ b/drivers/gdisp/ILI9325/gdisp_lld_config.h
@@ -27,6 +27,7 @@
#define GDISP_HARDWARE_STREAM_WRITE TRUE
#define GDISP_HARDWARE_STREAM_READ TRUE
+#define GDISP_HARDWARE_STREAM_POS TRUE
#define GDISP_HARDWARE_CONTROL TRUE
#define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB565
diff --git a/drivers/gdisp/SSD1289/gdisp_lld.c b/drivers/gdisp/SSD1289/gdisp_lld.c
index d2808604..09122d2f 100644
--- a/drivers/gdisp/SSD1289/gdisp_lld.c
+++ b/drivers/gdisp/SSD1289/gdisp_lld.c
@@ -43,6 +43,28 @@
#define dummy_read() { volatile uint16_t dummy; dummy = read_data(); (void) dummy; }
#define write_reg(reg, data) { write_index(reg); write_data(data); }
+static void set_cursor(GDISPDriver *g) {
+ switch(g->g.Orientation) {
+ case GDISP_ROTATE_0:
+ write_reg(0x004e, g->p.x & 0x00FF);
+ write_reg(0x004f, g->p.y & 0x01FF);
+ break;
+ case GDISP_ROTATE_90:
+ write_reg(0x004e, g->p.y & 0x00FF);
+ write_reg(0x004f, (GDISP_SCREEN_HEIGHT-1-g->p.x) & 0x01FF);
+ break;
+ case GDISP_ROTATE_180:
+ write_reg(0x004e, (GDISP_SCREEN_WIDTH-1-g->p.x) & 0x00FF);
+ write_reg(0x004f, (GDISP_SCREEN_HEIGHT-1-g->p.y) & 0x01FF);
+ break;
+ case GDISP_ROTATE_270:
+ write_reg(0x004e, (GDISP_SCREEN_WIDTH-1-g->p.y) & 0x00FF);
+ write_reg(0x004f, g->p.x & 0x01FF);
+ break;
+ }
+ write_index(0x0022);
+}
+
static void set_viewport(GDISPDriver* g) {
/* Reg 0x44 - Horizontal RAM address position
* Upper Byte - HEA
@@ -60,33 +82,24 @@ static void set_viewport(GDISPDriver* g) {
write_reg(0x44, (((g->p.x+g->p.cx-1) << 8) & 0xFF00 ) | (g->p.x & 0x00FF));
write_reg(0x45, g->p.y & 0x01FF);
write_reg(0x46, (g->p.y+g->p.cy-1) & 0x01FF);
- write_reg(0x004e, g->p.x & 0x00FF);
- write_reg(0x004f, g->p.y & 0x01FF);
break;
case GDISP_ROTATE_90:
write_reg(0x44, (((g->p.y+g->p.cy-1) << 8) & 0xFF00 ) | (g->p.y & 0x00FF));
write_reg(0x45, (GDISP_SCREEN_HEIGHT-(g->p.x+g->p.cx)) & 0x01FF);
write_reg(0x46, (GDISP_SCREEN_HEIGHT-1-g->p.x) & 0x01FF);
- write_reg(0x004e, g->p.y & 0x00FF);
- write_reg(0x004f, (GDISP_SCREEN_HEIGHT-1-g->p.x) & 0x01FF);
break;
case GDISP_ROTATE_180:
write_reg(0x44, (((GDISP_SCREEN_WIDTH-1-g->p.x) & 0x00FF) << 8) | ((GDISP_SCREEN_WIDTH - (g->p.x+g->p.cx)) & 0x00FF));
write_reg(0x45, (GDISP_SCREEN_HEIGHT-(g->p.y+g->p.cy)) & 0x01FF);
write_reg(0x46, (GDISP_SCREEN_HEIGHT-1-g->p.y) & 0x01FF);
- write_reg(0x004e, (GDISP_SCREEN_WIDTH-1-g->p.x) & 0x00FF);
- write_reg(0x004f, (GDISP_SCREEN_HEIGHT-1-g->p.y) & 0x01FF);
break;
case GDISP_ROTATE_270:
write_cmd2(PASET, GDISP_RAM_Y_OFFSET+g->p.x, GDISP_RAM_Y_OFFSET+g->p.x+g->p.cx-1);
write_reg(0x44, (((GDISP_SCREEN_WIDTH-1-g->p.y) & 0x00FF) << 8) | ((GDISP_SCREEN_WIDTH-(g->p.y+g->p.cy)) & 0x00FF));
write_reg(0x45, g->p.x & 0x01FF);
write_reg(0x46, (g->p.x+g->p.cx-1) & 0x01FF);
- write_reg(0x004e, (GDISP_SCREEN_WIDTH-1-g->p.y) & 0x00FF);
- write_reg(0x004f, g->p.x & 0x01FF);
break;
}
- write_index(0x0022);
}
/*===========================================================================*/
@@ -179,12 +192,16 @@ LLDSPEC bool_t gdisp_lld_init(GDISPDriver *g) {
LLDSPEC void gdisp_lld_write_stop(GDISPDriver *g) {
release_bus();
}
+ LLDSPEC void gdisp_lld_stream_pos(GDISPDriver *g) {
+ set_cursor(g);
+ }
#endif
#if GDISP_HARDWARE_STREAM_READ
LLDSPEC void gdisp_lld_read_start(GDISPDriver *g) {
acquire_bus();
set_viewport(g);
+ set_cursor(g);
setreadmode();
dummy_read();
}
@@ -201,6 +218,7 @@ LLDSPEC bool_t gdisp_lld_init(GDISPDriver *g) {
LLDSPEC void gdisp_lld_fill_area(GDISPDriver *g) {
acquire_bus();
set_viewport(g);
+ set_cursor(g);
dma_with_noinc(&color, g->p.cx*g->p.cy)
release_bus();
}
@@ -215,6 +233,7 @@ LLDSPEC bool_t gdisp_lld_init(GDISPDriver *g) {
acquire_bus();
set_viewport(g);
+ set_cursor(g);
if (g->p.x2 == g->p.cx) {
dma_with_inc(buffer, g->p.cx*g->p.cy);
} else {
diff --git a/drivers/gdisp/SSD1289/gdisp_lld_config.h b/drivers/gdisp/SSD1289/gdisp_lld_config.h
index 9c00ce39..fc04a798 100644
--- a/drivers/gdisp/SSD1289/gdisp_lld_config.h
+++ b/drivers/gdisp/SSD1289/gdisp_lld_config.h
@@ -27,6 +27,7 @@
#define GDISP_HARDWARE_STREAM_WRITE TRUE
#define GDISP_HARDWARE_STREAM_READ TRUE
+#define GDISP_HARDWARE_STREAM_POS TRUE
#define GDISP_HARDWARE_CONTROL TRUE
#if defined(GDISP_USE_DMA)