diff options
Diffstat (limited to 'drivers/gdisp/SSD1289/gdisp_lld.c')
| -rw-r--r-- | drivers/gdisp/SSD1289/gdisp_lld.c | 36 |
1 files changed, 26 insertions, 10 deletions
diff --git a/drivers/gdisp/SSD1289/gdisp_lld.c b/drivers/gdisp/SSD1289/gdisp_lld.c index 49600349..6b7069c9 100644 --- a/drivers/gdisp/SSD1289/gdisp_lld.c +++ b/drivers/gdisp/SSD1289/gdisp_lld.c @@ -95,7 +95,7 @@ static __inline void set_cursor(coord_t x, coord_t y) { }
}
-static __inline void set_viewport(coord_t x, coord_t y, coord_t cx, coord_t cy) {
+void set_viewport(coord_t x, coord_t y, coord_t cx, coord_t cy) {
set_cursor(x, y);
@@ -134,6 +134,19 @@ static __inline void set_viewport(coord_t x, coord_t y, coord_t cx, coord_t cy) set_cursor(x, y);
}
+void reset_viewport(void) {
+ switch(GDISP.Orientation) {
+ case GDISP_ROTATE_0:
+ case GDISP_ROTATE_180:
+ set_viewport(0, 0, GDISP_SCREEN_WIDTH, GDISP_SCREEN_HEIGHT);
+ break;
+ case GDISP_ROTATE_90:
+ case GDISP_ROTATE_270:
+ set_viewport(0, 0, GDISP_SCREEN_HEIGHT, GDISP_SCREEN_WIDTH);
+ break;
+ }
+}
+
/*===========================================================================*/
/* Driver interrupt handlers. */
/*===========================================================================*/
@@ -167,9 +180,9 @@ bool_t GDISP_LLD(init)(void) { acquire_bus();
write_reg(0x0000,0x0001); delay(5);
- write_reg(0x0003,0xA8A4); delay(5);
- write_reg(0x000C,0x0000); delay(5);
- write_reg(0x000D,0x080C); delay(5);
+ write_reg(0x0003,0xA8A4); delay(5);
+ write_reg(0x000C,0x0000); delay(5);
+ write_reg(0x000D,0x080C); delay(5);
write_reg(0x000E,0x2B00); delay(5);
write_reg(0x001E,0x00B0); delay(5);
write_reg(0x0001,0x2B3F); delay(5);
@@ -277,14 +290,15 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) { * @notapi
*/
void GDISP_LLD(clear)(color_t color) {
- unsigned i;
+ unsigned i;
acquire_bus();
- set_cursor(0, 0);
- stream_start();
- for(i = 0; i < GDISP_SCREEN_WIDTH * GDISP_SCREEN_HEIGHT; i++)
- write_data(color);
- stream_stop();
+ reset_viewport();
+ set_cursor(0, 0);
+ stream_start();
+ for(i = 0; i < GDISP_SCREEN_WIDTH * GDISP_SCREEN_HEIGHT; i++)
+ write_data(color);
+ stream_stop();
release_bus();
}
#endif
@@ -485,6 +499,7 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) { * @notapi
*/
void GDISP_LLD(control)(unsigned what, void *value) {
+ acquire_bus();
switch(what) {
case GDISP_CONTROL_POWER:
if (GDISP.Powermode == (gdisp_powermode_t)value)
@@ -557,6 +572,7 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) { case GDISP_CONTROL_CONTRAST:
*/
}
+ release_bus();
}
#endif
|
