diff --git a/demos/notepad/main.c b/demos/notepad/main.c index 40071719..65247b09 100644 --- a/demos/notepad/main.c +++ b/demos/notepad/main.c @@ -36,7 +36,7 @@ void drawScreen(void) { uint16_t colorsize = COLOR_SIZE; uint16_t pensize = PEN_SIZE; - gdispSetOrientation(GDISP_ROTATE_90); + gdispSetOrientation(landscape); gdispClear(White); gdispDrawString(gdispGetWidth()-gdispGetStringWidth(msg, &fontUI2Double)-3, 3, msg, &fontUI2Double, Black); diff --git a/drivers/gdisp/Nokia6610/gdisp_lld.c b/drivers/gdisp/Nokia6610/gdisp_lld.c index 12ceb819..ae069e8c 100644 --- a/drivers/gdisp/Nokia6610/gdisp_lld.c +++ b/drivers/gdisp/Nokia6610/gdisp_lld.c @@ -255,7 +255,7 @@ bool_t GDISP_LLD(init)(void) { /* Initialise the GDISP structure to match */ GDISP.Width = SCREEN_WIDTH; GDISP.Height = SCREEN_HEIGHT; - GDISP.Orientation = GDISP_ROTATE_0; + GDISP.Orientation = portrait; GDISP.Powermode = powerOn; GDISP.Backlight = 100; GDISP.Contrast = INITIAL_CONTRAST; @@ -539,22 +539,22 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) { // WriteSpiData(0x48); // no mirror Y (temporary to satisfy Olimex bmptoarray utility) // WriteSpiData(0xC8); // restore to (mirror x and y, reverse rgb) switch((gdisp_orientation_t)value) { - case GDISP_ROTATE_0: + case portrait: /* Code here */ GDISP.Height = SCREEN_HEIGHT; GDISP.Width = SCREEN_WIDTH; break; - case GDISP_ROTATE_90: + case landscape: /* Code here */ GDISP.Height = SCREEN_WIDTH; GDISP.Width = SCREEN_HEIGHT; break; - case GDISP_ROTATE_0Inv: + case portraitInv: /* Code here */ GDISP.Height = SCREEN_HEIGHT; GDISP.Width = SCREEN_WIDTH; break; - case GDISP_ROTATE_90Inv: + case landscapeInv: /* Code here */ GDISP.Height = SCREEN_WIDTH; GDISP.Width = SCREEN_HEIGHT; diff --git a/drivers/gdisp/S6D1121/gdisp_lld.c b/drivers/gdisp/S6D1121/gdisp_lld.c index d32070c8..76fe941f 100644 --- a/drivers/gdisp/S6D1121/gdisp_lld.c +++ b/drivers/gdisp/S6D1121/gdisp_lld.c @@ -180,7 +180,7 @@ bool_t GDISP_LLD(init)(void) { /* Now initialise the GDISP structure */ GDISP.Width = SCREEN_WIDTH; GDISP.Height = SCREEN_HEIGHT; - GDISP.Orientation = GDISP_ROTATE_0; + GDISP.Orientation = portrait; GDISP.Powermode = powerOn; GDISP.Backlight = 100; GDISP.Contrast = 50; @@ -456,25 +456,25 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) { if (GDISP.Orientation == (gdisp_orientation_t)value) return; switch((gdisp_orientation_t)value) { - case GDISP_ROTATE_0: + case portrait: lld_lcdWriteReg(0x0001,0x0127); lld_lcdWriteReg(0x03, 0b0011); GDISP.Height = SCREEN_HEIGHT; GDISP.Width = SCREEN_WIDTH; break; - case GDISP_ROTATE_90: + case landscape: lld_lcdWriteReg(0x0001,0x0027); lld_lcdWriteReg(0x0003, 0b1011); GDISP.Height = SCREEN_WIDTH; GDISP.Width = SCREEN_HEIGHT; break; - case GDISP_ROTATE_0Inv: + case portraitInv: lld_lcdWriteReg(0x0001,0x0127); lld_lcdWriteReg(0x0003, 0b0000); GDISP.Height = SCREEN_HEIGHT; GDISP.Width = SCREEN_WIDTH; break; - case GDISP_ROTATE_90Inv: + case landscapeInv: lld_lcdWriteReg(0x0001,0x0027); lld_lcdWriteReg(0x0003, 0b1000); GDISP.Height = SCREEN_WIDTH; diff --git a/drivers/gdisp/S6D1121/s6d1121_lld.c.h b/drivers/gdisp/S6D1121/s6d1121_lld.c.h index b4b24469..1d7ede61 100644 --- a/drivers/gdisp/S6D1121/s6d1121_lld.c.h +++ b/drivers/gdisp/S6D1121/s6d1121_lld.c.h @@ -182,19 +182,19 @@ static void lld_lcdSetCursor(coord_t x, coord_t y) { * R21h - 9 bit */ switch(GDISP.Orientation) { - case GDISP_ROTATE_0Inv: + case portraitInv: lld_lcdWriteReg(0x0020, (SCREEN_WIDTH-1-x) & 0x00FF); lld_lcdWriteReg(0x0021, (SCREEN_HEIGHT-1-y) & 0x01FF); break; - case GDISP_ROTATE_0: + case portrait: lld_lcdWriteReg(0x0020, x & 0x00FF); lld_lcdWriteReg(0x0021, y & 0x01FF); break; - case GDISP_ROTATE_90: + case landscape: lld_lcdWriteReg(0x0020, y & 0x00FF); lld_lcdWriteReg(0x0021, x & 0x01FF); break; - case GDISP_ROTATE_90Inv: + case landscapeInv: lld_lcdWriteReg(0x0020, (SCREEN_WIDTH - y - 1) & 0x00FF); lld_lcdWriteReg(0x0021, (SCREEN_HEIGHT - x - 1) & 0x01FF); break; @@ -208,22 +208,22 @@ static void lld_lcdSetViewPort(uint16_t x, uint16_t y, uint16_t cx, uint16_t cy) */ switch(GDISP.Orientation) { - case GDISP_ROTATE_0: + case portrait: lld_lcdWriteReg(0x46, (((x+cx-1) << 8) & 0xFF00 ) | (x & 0x00FF)); lld_lcdWriteReg(0x48, y & 0x01FF); lld_lcdWriteReg(0x47, (y+cy-1) & 0x01FF); break; - case GDISP_ROTATE_90: + case landscape: lld_lcdWriteReg(0x46, (((x+cx-1) << 8) & 0xFF00) | ((y+cy) & 0x00FF)); lld_lcdWriteReg(0x48, x & 0x01FF); lld_lcdWriteReg(0x47, (x+cx-1) & 0x01FF); break; - case GDISP_ROTATE_0Inv: + case portraitInv: lld_lcdWriteReg(0x46, (((SCREEN_WIDTH-x-1) & 0x00FF) << 8) | ((SCREEN_WIDTH - (x+cx)) & 0x00FF)); lld_lcdWriteReg(0x48, (SCREEN_HEIGHT-(y+cy)) & 0x01FF); lld_lcdWriteReg(0x47, (SCREEN_HEIGHT-y-1) & 0x01FF); break; - case GDISP_ROTATE_90Inv: + case landscapeInv: lld_lcdWriteReg(0x46, (((SCREEN_WIDTH - y - 1) & 0x00FF) << 8) | ((SCREEN_WIDTH - (y+cy)) & 0x00FF)); lld_lcdWriteReg(0x48, (SCREEN_HEIGHT - (x+cx)) & 0x01FF); lld_lcdWriteReg(0x47, (SCREEN_HEIGHT - x - 1) & 0x01FF); @@ -235,12 +235,12 @@ static void lld_lcdSetViewPort(uint16_t x, uint16_t y, uint16_t cx, uint16_t cy) static void lld_lcdResetViewPort(void) { switch(GDISP.Orientation) { - case GDISP_ROTATE_0: - case GDISP_ROTATE_0Inv: + case portrait: + case portraitInv: lld_lcdSetViewPort(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); break; - case GDISP_ROTATE_90: - case GDISP_ROTATE_90Inv: + case landscape: + case landscapeInv: lld_lcdSetViewPort(0, 0, SCREEN_HEIGHT, SCREEN_WIDTH); break; } diff --git a/drivers/gdisp/SSD1289/gdisp_lld.c b/drivers/gdisp/SSD1289/gdisp_lld.c index 2b2afb60..b8d36ab0 100644 --- a/drivers/gdisp/SSD1289/gdisp_lld.c +++ b/drivers/gdisp/SSD1289/gdisp_lld.c @@ -121,7 +121,7 @@ bool_t GDISP_LLD(init)(void) { /* Initialise the GDISP structure */ GDISP.Width = SCREEN_WIDTH; GDISP.Height = SCREEN_HEIGHT; - GDISP.Orientation = GDISP_ROTATE_0; + GDISP.Orientation = portrait; GDISP.Powermode = powerOn; GDISP.Backlight = 100; GDISP.Contrast = 50; @@ -407,28 +407,28 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) { if (GDISP.Orientation == (gdisp_orientation_t)value) return; switch((gdisp_orientation_t)value) { - case GDISP_ROTATE_0: + case portrait: lld_lcdWriteReg(0x0001, 0x2B3F); /* ID = 11 AM = 0 */ lld_lcdWriteReg(0x0011, 0x6070); GDISP.Height = SCREEN_HEIGHT; GDISP.Width = SCREEN_WIDTH; break; - case GDISP_ROTATE_90: + case landscape: lld_lcdWriteReg(0x0001, 0x293F); /* ID = 11 AM = 1 */ lld_lcdWriteReg(0x0011, 0x6078); GDISP.Height = SCREEN_WIDTH; GDISP.Width = SCREEN_HEIGHT; break; - case GDISP_ROTATE_0Inv: + case portraitInv: lld_lcdWriteReg(0x0001, 0x2B3F); /* ID = 01 AM = 0 */ lld_lcdWriteReg(0x0011, 0x6040); GDISP.Height = SCREEN_HEIGHT; GDISP.Width = SCREEN_WIDTH; break; - case GDISP_ROTATE_90Inv: + case landscapeInv: lld_lcdWriteReg(0x0001, 0x293F); /* ID = 01 AM = 1 */ lld_lcdWriteReg(0x0011, 0x6048); diff --git a/drivers/gdisp/SSD1289/ssd1289_lld.c.h b/drivers/gdisp/SSD1289/ssd1289_lld.c.h index fc71b9cc..e59b388c 100644 --- a/drivers/gdisp/SSD1289/ssd1289_lld.c.h +++ b/drivers/gdisp/SSD1289/ssd1289_lld.c.h @@ -265,19 +265,19 @@ static void lld_lcdSetCursor(uint16_t x, uint16_t y) { * Use a bit mask to make sure they are not set too high */ switch(GDISP.Orientation) { - case GDISP_ROTATE_0Inv: + case portraitInv: lld_lcdWriteReg(0x004e, (SCREEN_WIDTH-1-x) & 0x00FF); lld_lcdWriteReg(0x004f, (SCREEN_HEIGHT-1-y) & 0x01FF); break; - case GDISP_ROTATE_0: + case portrait: lld_lcdWriteReg(0x004e, x & 0x00FF); lld_lcdWriteReg(0x004f, y & 0x01FF); break; - case GDISP_ROTATE_90: + case landscape: lld_lcdWriteReg(0x004e, y & 0x00FF); lld_lcdWriteReg(0x004f, x & 0x01FF); break; - case GDISP_ROTATE_90Inv: + case landscapeInv: lld_lcdWriteReg(0x004e, (SCREEN_WIDTH - y - 1) & 0x00FF); lld_lcdWriteReg(0x004f, (SCREEN_HEIGHT - x - 1) & 0x01FF); break; @@ -297,22 +297,22 @@ static void lld_lcdSetViewPort(uint16_t x, uint16_t y, uint16_t cx, uint16_t cy) */ switch(GDISP.Orientation) { - case GDISP_ROTATE_0: + case portrait: lld_lcdWriteReg(0x44, (((x+cx-1) << 8) & 0xFF00 ) | (x & 0x00FF)); lld_lcdWriteReg(0x45, y & 0x01FF); lld_lcdWriteReg(0x46, (y+cy-1) & 0x01FF); break; - case GDISP_ROTATE_90: + case landscape: lld_lcdWriteReg(0x44, (((x+cx-1) << 8) & 0xFF00) | ((y+cy) & 0x00FF)); lld_lcdWriteReg(0x45, x & 0x01FF); lld_lcdWriteReg(0x46, (x+cx-1) & 0x01FF); break; - case GDISP_ROTATE_0Inv: + case portraitInv: lld_lcdWriteReg(0x44, (((SCREEN_WIDTH-x-1) & 0x00FF) << 8) | ((SCREEN_WIDTH - (x+cx)) & 0x00FF)); lld_lcdWriteReg(0x45, (SCREEN_HEIGHT-(y+cy)) & 0x01FF); lld_lcdWriteReg(0x46, (SCREEN_HEIGHT-y-1) & 0x01FF); break; - case GDISP_ROTATE_90Inv: + case landscapeInv: lld_lcdWriteReg(0x44, (((SCREEN_WIDTH - y - 1) & 0x00FF) << 8) | ((SCREEN_WIDTH - (y+cy)) & 0x00FF)); lld_lcdWriteReg(0x45, (SCREEN_HEIGHT - (x+cx)) & 0x01FF); lld_lcdWriteReg(0x46, (SCREEN_HEIGHT - x - 1) & 0x01FF); diff --git a/drivers/gdisp/SSD1963/gdisp_lld.c b/drivers/gdisp/SSD1963/gdisp_lld.c index 76bdb683..8f64c955 100644 --- a/drivers/gdisp/SSD1963/gdisp_lld.c +++ b/drivers/gdisp/SSD1963/gdisp_lld.c @@ -308,7 +308,7 @@ bool_t GDISP_LLD(init)(void) { /* Initialise the GDISP structure to match */ GDISP.Width = SCREEN_WIDTH; GDISP.Height = SCREEN_HEIGHT; - GDISP.Orientation = GDISP_ROTATE_90; + GDISP.Orientation = landscape; GDISP.Powermode = powerOn; GDISP.Backlight = 100; GDISP.Contrast = 50; @@ -563,22 +563,22 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) { if (GDISP.Orientation == (gdisp_orientation_t)value) return; switch((gdisp_orientation_t)value) { - case GDISP_ROTATE_0: + case portrait: /* Code here */ GDISP.Height = SCREEN_HEIGHT; GDISP.Width = SCREEN_WIDTH; break; - case GDISP_ROTATE_90: + case landscape: /* Code here */ GDISP.Height = SCREEN_WIDTH; GDISP.Width = SCREEN_HEIGHT; break; - case GDISP_ROTATE_0Inv: + case portraitInv: /* Code here */ GDISP.Height = SCREEN_HEIGHT; GDISP.Width = SCREEN_WIDTH; break; - case GDISP_ROTATE_90Inv: + case landscapeInv: /* Code here */ GDISP.Height = SCREEN_WIDTH; GDISP.Width = SCREEN_HEIGHT; diff --git a/drivers/gdisp/TestStub/gdisp_lld.c b/drivers/gdisp/TestStub/gdisp_lld.c index 5a8a1b19..8e658fae 100644 --- a/drivers/gdisp/TestStub/gdisp_lld.c +++ b/drivers/gdisp/TestStub/gdisp_lld.c @@ -50,7 +50,7 @@ bool_t GDISP_LLD(init)(void) { /* Initialise the GDISP structure */ GDISP.Width = 128; GDISP.Height = 128; - GDISP.Orientation = GDISP_ROTATE_0; + GDISP.Orientation = portrait; GDISP.Powermode = powerOff; GDISP.Backlight = 100; GDISP.Contrast = 50; diff --git a/include/gdisp_lld.h b/include/gdisp_lld.h index 80cb6b00..64720913 100644 --- a/include/gdisp_lld.h +++ b/include/gdisp_lld.h @@ -553,7 +553,7 @@ typedef const struct font *font_t; /** * @brief Type for the screen orientation. */ -typedef enum orientation {GDISP_ROTATE_0, GDISP_ROTATE_90, GDISP_ROTATE_0Inv, GDISP_ROTATE_90Inv} gdisp_orientation_t; +typedef enum orientation {portrait, landscape, portraitInv, landscapeInv} gdisp_orientation_t; /** * @brief Type for the available power modes for the screen. */ diff --git a/src/touchpad.c b/src/touchpad.c index 9d1c1278..f0da743c 100644 --- a/src/touchpad.c +++ b/src/touchpad.c @@ -154,13 +154,13 @@ uint16_t tpReadX(void) { y = cal.ym * _tpReadRealY() + cal.yn; switch(gdispGetOrientation()) { - case GDISP_ROTATE_0: + case portrait: return x; - case GDISP_ROTATE_90: + case landscape: return SCREEN_HEIGHT - y; - case GDISP_ROTATE_0Inv: + case portraitInv: return SCREEN_WIDTH - x; - case GDISP_ROTATE_90Inv: + case landscapeInv: return y; } @@ -181,13 +181,13 @@ uint16_t tpReadY(void) { y = cal.ym * _tpReadRealY() + cal.yn; switch(gdispGetOrientation()) { - case GDISP_ROTATE_0: + case portrait: return y; - case GDISP_ROTATE_90: + case landscape: return x; - case GDISP_ROTATE_0Inv: + case portraitInv: return SCREEN_HEIGHT - y; - case GDISP_ROTATE_90Inv: + case landscapeInv: return SCREEN_WIDTH - x; } diff --git a/templates/gdispXXXXX/gdisp_lld.c b/templates/gdispXXXXX/gdisp_lld.c index 0df36596..f9a159ed 100644 --- a/templates/gdispXXXXX/gdisp_lld.c +++ b/templates/gdispXXXXX/gdisp_lld.c @@ -75,7 +75,7 @@ bool_t GDISP_LLD(init)(void) { /* Initialise the GDISP structure to match */ GDISP.Width = SCREEN_WIDTH; GDISP.Height = SCREEN_HEIGHT; - GDISP.Orientation = GDISP_ROTATE_0; + GDISP.Orientation = portrait; GDISP.Powermode = powerOn; GDISP.Backlight = 100; GDISP.Contrast = 50; @@ -465,22 +465,22 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) { if (GDISP.Orientation == (gdisp_orientation_t)value) return; switch((gdisp_orientation_t)value) { - case GDISP_ROTATE_0: + case portrait: /* Code here */ GDISP.Height = SCREEN_HEIGHT; GDISP.Width = SCREEN_WIDTH; break; - case GDISP_ROTATE_90: + case landscape: /* Code here */ GDISP.Height = SCREEN_WIDTH; GDISP.Width = SCREEN_HEIGHT; break; - case GDISP_ROTATE_0Inv: + case portraitInv: /* Code here */ GDISP.Height = SCREEN_HEIGHT; GDISP.Width = SCREEN_WIDTH; break; - case GDISP_ROTATE_90Inv: + case landscapeInv: /* Code here */ GDISP.Height = SCREEN_WIDTH; GDISP.Width = SCREEN_HEIGHT;