SSD2119: orientation control
All angles supported: 0, 90, 180, 270.
This commit is contained in:
parent
bbdd57d9c1
commit
e5543face9
2 changed files with 16 additions and 16 deletions
|
@ -111,6 +111,7 @@ static void set_viewport(coord_t x, coord_t y, coord_t cx, coord_t cy) {
|
||||||
* Lower 9 bits gives 0-511 range in each value, HSA and HEA respectively
|
* Lower 9 bits gives 0-511 range in each value, HSA and HEA respectively
|
||||||
* 0 <= HSA <= HEA <= 0x13F
|
* 0 <= HSA <= HEA <= 0x13F
|
||||||
*/
|
*/
|
||||||
|
|
||||||
switch(GDISP.Orientation) {
|
switch(GDISP.Orientation) {
|
||||||
case GDISP_ROTATE_0:
|
case GDISP_ROTATE_0:
|
||||||
write_reg(SSD2119_REG_V_RAM_POS, (((y + cy - 1) << 8) & 0xFF00 ) | (y & 0x00FF));
|
write_reg(SSD2119_REG_V_RAM_POS, (((y + cy - 1) << 8) & 0xFF00 ) | (y & 0x00FF));
|
||||||
|
@ -128,7 +129,7 @@ static void set_viewport(coord_t x, coord_t y, coord_t cx, coord_t cy) {
|
||||||
write_reg(SSD2119_REG_H_RAM_END, (GDISP_SCREEN_WIDTH - x - 1) & 0x01FF);
|
write_reg(SSD2119_REG_H_RAM_END, (GDISP_SCREEN_WIDTH - x - 1) & 0x01FF);
|
||||||
break;
|
break;
|
||||||
case GDISP_ROTATE_270:
|
case GDISP_ROTATE_270:
|
||||||
write_reg(SSD2119_REG_V_RAM_POS, (((y + cy - 1) << 8) & 0xFF00 ) | (x & 0x00FF));
|
write_reg(SSD2119_REG_V_RAM_POS, (((x + cx - 1) << 8) & 0xFF00 ) | (x & 0x00FF));
|
||||||
write_reg(SSD2119_REG_H_RAM_START, (y & 0x01FF));
|
write_reg(SSD2119_REG_H_RAM_START, (y & 0x01FF));
|
||||||
write_reg(SSD2119_REG_H_RAM_END, (y + cy - 1) & 0x01FF);
|
write_reg(SSD2119_REG_H_RAM_END, (y + cy - 1) & 0x01FF);
|
||||||
break;
|
break;
|
||||||
|
@ -524,7 +525,6 @@ void gdisp_lld_draw_pixel(coord_t x, coord_t y, color_t color) {
|
||||||
* GDISP_CONTROL_BACKLIGHT - Takes an int from 0 to 100. For a driver
|
* GDISP_CONTROL_BACKLIGHT - Takes an int from 0 to 100. For a driver
|
||||||
* that only supports off/on anything other
|
* that only supports off/on anything other
|
||||||
* than zero is on.
|
* than zero is on.
|
||||||
* GDISP_CONTROL_CONTRAST - Takes an int from 0 to 100.
|
|
||||||
*
|
*
|
||||||
* @param[in] what What to do.
|
* @param[in] what What to do.
|
||||||
* @param[in] value The value to use (always cast to a void *).
|
* @param[in] value The value to use (always cast to a void *).
|
||||||
|
@ -600,9 +600,10 @@ void gdisp_lld_draw_pixel(coord_t x, coord_t y, color_t color) {
|
||||||
switch((gdisp_orientation_t)value) {
|
switch((gdisp_orientation_t)value) {
|
||||||
case GDISP_ROTATE_0:
|
case GDISP_ROTATE_0:
|
||||||
acquire_bus();
|
acquire_bus();
|
||||||
write_reg(0x0001, 0x2B3F);
|
/* TB = 0 */
|
||||||
|
write_reg(SSD2119_REG_OUTPUT_CTRL, 0x30EF);
|
||||||
/* ID = 11 AM = 0 */
|
/* ID = 11 AM = 0 */
|
||||||
write_reg(0x0011, 0x6070);
|
write_reg(SSD2119_REG_ENTRY_MODE, 0x6830);
|
||||||
release_bus();
|
release_bus();
|
||||||
GDISP.Height = GDISP_SCREEN_HEIGHT;
|
GDISP.Height = GDISP_SCREEN_HEIGHT;
|
||||||
GDISP.Width = GDISP_SCREEN_WIDTH;
|
GDISP.Width = GDISP_SCREEN_WIDTH;
|
||||||
|
@ -610,9 +611,10 @@ void gdisp_lld_draw_pixel(coord_t x, coord_t y, color_t color) {
|
||||||
|
|
||||||
case GDISP_ROTATE_90:
|
case GDISP_ROTATE_90:
|
||||||
acquire_bus();
|
acquire_bus();
|
||||||
write_reg(0x0001, 0x293F);
|
/* TB = 1 */
|
||||||
/* ID = 11 AM = 1 */
|
write_reg(SSD2119_REG_OUTPUT_CTRL, 0x32EF);
|
||||||
write_reg(0x0011, 0x6078);
|
/* ID = 10 AM = 1 */
|
||||||
|
write_reg(SSD2119_REG_ENTRY_MODE, 0x6828);
|
||||||
release_bus();
|
release_bus();
|
||||||
GDISP.Height = GDISP_SCREEN_WIDTH;
|
GDISP.Height = GDISP_SCREEN_WIDTH;
|
||||||
GDISP.Width = GDISP_SCREEN_HEIGHT;
|
GDISP.Width = GDISP_SCREEN_HEIGHT;
|
||||||
|
@ -620,9 +622,10 @@ void gdisp_lld_draw_pixel(coord_t x, coord_t y, color_t color) {
|
||||||
|
|
||||||
case GDISP_ROTATE_180:
|
case GDISP_ROTATE_180:
|
||||||
acquire_bus();
|
acquire_bus();
|
||||||
write_reg(0x0001, 0x2B3F);
|
/* TB = 0 */
|
||||||
/* ID = 01 AM = 0 */
|
write_reg(SSD2119_REG_OUTPUT_CTRL, 0x30EF);
|
||||||
write_reg(0x0011, 0x6040);
|
/* ID = 00 AM = 0 */
|
||||||
|
write_reg(SSD2119_REG_ENTRY_MODE, 0x6800);
|
||||||
release_bus();
|
release_bus();
|
||||||
GDISP.Height = GDISP_SCREEN_HEIGHT;
|
GDISP.Height = GDISP_SCREEN_HEIGHT;
|
||||||
GDISP.Width = GDISP_SCREEN_WIDTH;
|
GDISP.Width = GDISP_SCREEN_WIDTH;
|
||||||
|
@ -630,9 +633,10 @@ void gdisp_lld_draw_pixel(coord_t x, coord_t y, color_t color) {
|
||||||
|
|
||||||
case GDISP_ROTATE_270:
|
case GDISP_ROTATE_270:
|
||||||
acquire_bus();
|
acquire_bus();
|
||||||
write_reg(0x0001, 0x293F);
|
/* TB = 1 */
|
||||||
|
write_reg(SSD2119_REG_OUTPUT_CTRL, 0x32EF);
|
||||||
/* ID = 01 AM = 1 */
|
/* ID = 01 AM = 1 */
|
||||||
write_reg(0x0011, 0x6048);
|
write_reg(SSD2119_REG_ENTRY_MODE, 0x6818);
|
||||||
release_bus();
|
release_bus();
|
||||||
GDISP.Height = GDISP_SCREEN_WIDTH;
|
GDISP.Height = GDISP_SCREEN_WIDTH;
|
||||||
GDISP.Width = GDISP_SCREEN_HEIGHT;
|
GDISP.Width = GDISP_SCREEN_HEIGHT;
|
||||||
|
@ -658,8 +662,6 @@ void gdisp_lld_draw_pixel(coord_t x, coord_t y, color_t color) {
|
||||||
GDISP.Backlight = (unsigned)value;
|
GDISP.Backlight = (unsigned)value;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case GDISP_CONTROL_CONTRAST:
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,5 @@
|
||||||
#define SSD2119_REG_X_RAM_ADDR 0x4E
|
#define SSD2119_REG_X_RAM_ADDR 0x4E
|
||||||
#define SSD2119_REG_Y_RAM_ADDR 0x4F
|
#define SSD2119_REG_Y_RAM_ADDR 0x4F
|
||||||
|
|
||||||
/* TODO: SSD2119 commands */
|
|
||||||
|
|
||||||
#endif /* _SSD2119_H */
|
#endif /* _SSD2119_H */
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
Loading…
Add table
Reference in a new issue