aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2015-02-07 00:07:49 +1000
committerinmarket <andrewh@inmarket.com.au>2015-02-07 00:07:49 +1000
commitf8c06e70a78914ac2e42b565050f5443bcecbb6f (patch)
tree754afb55a58b4dc8ca0e04dce3a00a72fd01ab4d /drivers
parent795b8a5e7dd88d920fd778cd03ad9c7b7825247e (diff)
downloaduGFX-f8c06e70a78914ac2e42b565050f5443bcecbb6f.tar.gz
uGFX-f8c06e70a78914ac2e42b565050f5443bcecbb6f.tar.bz2
uGFX-f8c06e70a78914ac2e42b565050f5443bcecbb6f.zip
Fixes to all monochrome drivers
TLS8204 driver is now operational
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gdisp/PCD8544/gdisp_lld_PCD8544.c29
-rw-r--r--drivers/gdisp/PCD8544/gdisp_lld_config.h1
-rw-r--r--drivers/gdisp/PCF8812/gdisp_lld_PCF8812.c29
-rw-r--r--drivers/gdisp/PCF8812/gdisp_lld_config.h1
-rw-r--r--drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c2
-rw-r--r--drivers/gdisp/SSD1306/gdisp_lld_config.h4
-rw-r--r--drivers/gdisp/ST7565/gdisp_lld_ST7565.c2
-rw-r--r--drivers/gdisp/TLS8204/gdisp_lld_TLS8204.c41
-rw-r--r--drivers/gdisp/TLS8204/gdisp_lld_config.h1
9 files changed, 104 insertions, 6 deletions
diff --git a/drivers/gdisp/PCD8544/gdisp_lld_PCD8544.c b/drivers/gdisp/PCD8544/gdisp_lld_PCD8544.c
index 67584576..ddc67be0 100644
--- a/drivers/gdisp/PCD8544/gdisp_lld_PCD8544.c
+++ b/drivers/gdisp/PCD8544/gdisp_lld_PCD8544.c
@@ -110,6 +110,8 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
write_data(g, RAM(g), GDISP_SCREEN_BYTES);
release_bus(g);
+
+ g->flags &= ~GDISP_FLG_NEEDFLUSH;
}
#endif
@@ -152,6 +154,33 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
}
#endif
+#if GDISP_HARDWARE_PIXELREAD
+ LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
+ coord_t x, y;
+
+ switch(g->g.Orientation) {
+ default:
+ case GDISP_ROTATE_0:
+ x = g->p.x;
+ y = g->p.y;
+ break;
+ case GDISP_ROTATE_90:
+ x = g->p.y;
+ y = GDISP_SCREEN_HEIGHT-1 - g->p.x;
+ break;
+ case GDISP_ROTATE_180:
+ x = GDISP_SCREEN_WIDTH-1 - g->p.x;
+ y = GDISP_SCREEN_HEIGHT-1 - g->p.y;
+ break;
+ case GDISP_ROTATE_270:
+ x = GDISP_SCREEN_WIDTH-1 - g->p.y;
+ y = g->p.x;
+ break;
+ }
+ return (RAM(g)[xyaddr(x, y)] & xybit(y)) ? White : Black;
+ }
+#endif
+
#if GDISP_NEED_CONTROL
LLDSPEC void gdisp_lld_control(GDisplay *g) {
switch(g->p.x) {
diff --git a/drivers/gdisp/PCD8544/gdisp_lld_config.h b/drivers/gdisp/PCD8544/gdisp_lld_config.h
index 6ad8a571..253b2aaf 100644
--- a/drivers/gdisp/PCD8544/gdisp_lld_config.h
+++ b/drivers/gdisp/PCD8544/gdisp_lld_config.h
@@ -16,6 +16,7 @@
#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing
#define GDISP_HARDWARE_DRAWPIXEL TRUE
+#define GDISP_HARDWARE_PIXELREAD TRUE
#define GDISP_HARDWARE_CONTROL TRUE
// Set this to your frame buffer pixel format.
diff --git a/drivers/gdisp/PCF8812/gdisp_lld_PCF8812.c b/drivers/gdisp/PCF8812/gdisp_lld_PCF8812.c
index cfb4ad83..f37bed0d 100644
--- a/drivers/gdisp/PCF8812/gdisp_lld_PCF8812.c
+++ b/drivers/gdisp/PCF8812/gdisp_lld_PCF8812.c
@@ -120,6 +120,8 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
write_data(g, RAM(g), GDISP_MATRIX_BYTES);
release_bus(g);
+
+ g->flags &= ~GDISP_FLG_NEEDFLUSH;
}
#endif
@@ -162,6 +164,33 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
}
#endif
+#if GDISP_HARDWARE_PIXELREAD
+ LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
+ coord_t x, y;
+
+ switch(g->g.Orientation) {
+ default:
+ case GDISP_ROTATE_0:
+ x = g->p.x;
+ y = g->p.y;
+ break;
+ case GDISP_ROTATE_90:
+ x = g->p.y;
+ y = GDISP_SCREEN_HEIGHT-1 - g->p.x;
+ break;
+ case GDISP_ROTATE_180:
+ x = GDISP_SCREEN_WIDTH-1 - g->p.x;
+ y = GDISP_SCREEN_HEIGHT-1 - g->p.y;
+ break;
+ case GDISP_ROTATE_270:
+ x = GDISP_SCREEN_WIDTH-1 - g->p.y;
+ y = g->p.x;
+ break;
+ }
+ return (RAM(g)[xyaddr(x, y)] & xybit(y)) ? White : Black;
+ }
+#endif
+
#if GDISP_NEED_CONTROL
LLDSPEC void gdisp_lld_control(GDisplay *g) {
switch(g->p.x) {
diff --git a/drivers/gdisp/PCF8812/gdisp_lld_config.h b/drivers/gdisp/PCF8812/gdisp_lld_config.h
index 6ad8a571..253b2aaf 100644
--- a/drivers/gdisp/PCF8812/gdisp_lld_config.h
+++ b/drivers/gdisp/PCF8812/gdisp_lld_config.h
@@ -16,6 +16,7 @@
#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing
#define GDISP_HARDWARE_DRAWPIXEL TRUE
+#define GDISP_HARDWARE_PIXELREAD TRUE
#define GDISP_HARDWARE_CONTROL TRUE
// Set this to your frame buffer pixel format.
diff --git a/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c b/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c
index a8980ce7..e163f8ca 100644
--- a/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c
+++ b/drivers/gdisp/SSD1306/gdisp_lld_SSD1306.c
@@ -154,6 +154,8 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
ram += SSD1306_PAGE_WIDTH;
}
release_bus(g);
+
+ g->flags &= ~GDISP_FLG_NEEDFLUSH;
}
#endif
diff --git a/drivers/gdisp/SSD1306/gdisp_lld_config.h b/drivers/gdisp/SSD1306/gdisp_lld_config.h
index dfb91f97..2d8b6602 100644
--- a/drivers/gdisp/SSD1306/gdisp_lld_config.h
+++ b/drivers/gdisp/SSD1306/gdisp_lld_config.h
@@ -17,8 +17,8 @@
#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing
#define GDISP_HARDWARE_DRAWPIXEL TRUE
#define GDISP_HARDWARE_PIXELREAD TRUE
-#define GDISP_HARDWARE_CONTROL TRUE
-#define GDISP_HARDWARE_FILLS TRUE
+#define GDISP_HARDWARE_CONTROL TRUE
+#define GDISP_HARDWARE_FILLS TRUE
#define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_MONO
diff --git a/drivers/gdisp/ST7565/gdisp_lld_ST7565.c b/drivers/gdisp/ST7565/gdisp_lld_ST7565.c
index 686d1aa2..dc0b1f84 100644
--- a/drivers/gdisp/ST7565/gdisp_lld_ST7565.c
+++ b/drivers/gdisp/ST7565/gdisp_lld_ST7565.c
@@ -155,6 +155,8 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
write_data(g, RAM(g) + (p*GDISP_SCREEN_WIDTH), GDISP_SCREEN_WIDTH);
}
release_bus(g);
+
+ g->flags &= ~GDISP_FLG_NEEDFLUSH;
}
#endif
diff --git a/drivers/gdisp/TLS8204/gdisp_lld_TLS8204.c b/drivers/gdisp/TLS8204/gdisp_lld_TLS8204.c
index 4450b8a3..2404fd4d 100644
--- a/drivers/gdisp/TLS8204/gdisp_lld_TLS8204.c
+++ b/drivers/gdisp/TLS8204/gdisp_lld_TLS8204.c
@@ -38,6 +38,8 @@
#define xyaddr(x, y) ((x) + ((y) >> 3) * GDISP_TLS8204_WIDTH)
#define xybit(y) (1 << ((y) & 7))
+#define LCD_START_LINE_ADDR (66-2)
+
/*===========================================================================*/
/* Driver exported functions. */
/*===========================================================================*/
@@ -73,17 +75,19 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
gfxSleepMilliseconds(100);
// H0H1 = 01
- write_cmd(g, TLS8204_SET_FUNC | TLS8204_H0_BIT);
- write_cmd(g, TLS8204_SET_BIAS_4);
+ write_cmd(g, TLS8204_SET_FUNC | TLS8204_H0_BIT);
+ write_cmd(g, TLS8204_SET_BIAS_6);
write_cmd(g, TLS8204_SET_Y_LSB_FIRST);
- write_cmd(g, TLS8204_SET_VLCD0_6 + ((GDISP_INITIAL_CONTRAST * 2 + 22) & 0x7F));
+ write_cmd(g, TLS8204_SET_VLCD0_6 | ((GDISP_INITIAL_CONTRAST * 2 + 22) & 0x7F));
+ write_cmd(g, TLS8204_SET_STARTLINE_S6 | ((LCD_START_LINE_ADDR>>6) & 0x01));
+ write_cmd(g, TLS8204_SET_STARTLINE_S0_5 | (LCD_START_LINE_ADDR & ((1<<6)-1)));
// H0H1 = 00
write_cmd(g, TLS8204_SET_FUNC);
write_cmd(g, TLS8204_SET_VLCD7 + ((GDISP_INITIAL_CONTRAST * 2 + 22) >> 7));
+ write_cmd(g, TLS8204_SET_DISPLAY_OFF);
write_cmd(g, TLS8204_SET_DISPLAY_NORMAL);
-
// Finish Init
post_init_board(g);
@@ -122,6 +126,8 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
}
release_bus(g);
+
+ g->flags &= ~GDISP_FLG_NEEDFLUSH;
}
#endif
@@ -164,6 +170,33 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
}
#endif
+#if GDISP_HARDWARE_PIXELREAD
+ LLDSPEC color_t gdisp_lld_get_pixel_color(GDisplay *g) {
+ coord_t x, y;
+
+ switch(g->g.Orientation) {
+ default:
+ case GDISP_ROTATE_0:
+ x = g->p.x;
+ y = g->p.y;
+ break;
+ case GDISP_ROTATE_90:
+ x = g->p.y;
+ y = GDISP_SCREEN_HEIGHT-1 - g->p.x;
+ break;
+ case GDISP_ROTATE_180:
+ x = GDISP_SCREEN_WIDTH-1 - g->p.x;
+ y = GDISP_SCREEN_HEIGHT-1 - g->p.y;
+ break;
+ case GDISP_ROTATE_270:
+ x = GDISP_SCREEN_WIDTH-1 - g->p.y;
+ y = g->p.x;
+ break;
+ }
+ return (RAM(g)[xyaddr(x, y)] & xybit(y)) ? White : Black;
+ }
+#endif
+
#if GDISP_NEED_CONTROL
LLDSPEC void gdisp_lld_control(GDisplay *g) {
switch(g->p.x) {
diff --git a/drivers/gdisp/TLS8204/gdisp_lld_config.h b/drivers/gdisp/TLS8204/gdisp_lld_config.h
index 6ad8a571..253b2aaf 100644
--- a/drivers/gdisp/TLS8204/gdisp_lld_config.h
+++ b/drivers/gdisp/TLS8204/gdisp_lld_config.h
@@ -16,6 +16,7 @@
#define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing
#define GDISP_HARDWARE_DRAWPIXEL TRUE
+#define GDISP_HARDWARE_PIXELREAD TRUE
#define GDISP_HARDWARE_CONTROL TRUE
// Set this to your frame buffer pixel format.