ILI9320 landscape mode
This commit is contained in:
parent
fa82491a0b
commit
7b2e0d06d4
4 changed files with 40 additions and 13 deletions
|
@ -237,8 +237,23 @@ static void lld_lcdSetCursor(uint16_t x, uint16_t y) {
|
|||
|
||||
addr = y * 0x100 + x;
|
||||
|
||||
lld_lcdWriteReg(0x0020, addr & 0xff); /* low addr */
|
||||
lld_lcdWriteReg(0x0021, (addr >> 8) & 0x1ff); /* high addr */
|
||||
switch(GDISP.Orientation) {
|
||||
case GDISP_ROTATE_0:
|
||||
lld_lcdWriteReg(0x0020, addr & 0xff); /* low addr */
|
||||
lld_lcdWriteReg(0x0021, (addr >> 8) & 0x1ff); /* high addr */
|
||||
break;
|
||||
|
||||
case GDISP_ROTATE_90:
|
||||
lld_lcdWriteReg(0x0020, (addr >> 8) & 0x1ff); /* low addr */
|
||||
lld_lcdWriteReg(0x0021, addr & 0xff); /* high addr */
|
||||
break;
|
||||
|
||||
case GDISP_ROTATE_180:
|
||||
break;
|
||||
|
||||
case GDISP_ROTATE_270:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void lld_lcdSetViewPort(uint16_t x, uint16_t y, uint16_t cx, uint16_t cy) {
|
||||
|
@ -251,6 +266,10 @@ static void lld_lcdSetViewPort(uint16_t x, uint16_t y, uint16_t cx, uint16_t cy)
|
|||
break;
|
||||
|
||||
case GDISP_ROTATE_90:
|
||||
lld_lcdWriteReg(0x0050, y);
|
||||
lld_lcdWriteReg(0x0051, y + cy - 1);
|
||||
lld_lcdWriteReg(0x0052, x);
|
||||
lld_lcdWriteReg(0x0053, x + cx - 1);
|
||||
break;
|
||||
|
||||
case GDISP_ROTATE_180:
|
||||
|
@ -265,7 +284,16 @@ static void lld_lcdSetViewPort(uint16_t x, uint16_t y, uint16_t cx, uint16_t cy)
|
|||
}
|
||||
|
||||
static __inline void lld_lcdResetViewPort(void) {
|
||||
/* ToDo */
|
||||
switch(GDISP.Orientation) {
|
||||
case GDISP_ROTATE_0:
|
||||
case GDISP_ROTATE_180:
|
||||
lld_lcdSetViewPort(0, 0, GDISP_SCREEN_WIDTH, GDISP_SCREEN_HEIGHT);
|
||||
break;
|
||||
case GDISP_ROTATE_90:
|
||||
case GDISP_ROTATE_270:
|
||||
lld_lcdSetViewPort(0, 0, GDISP_SCREEN_HEIGHT, GDISP_SCREEN_WIDTH);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
|
||||
|
@ -479,20 +507,20 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
|
|||
GDISP.Powermode = (gdisp_powermode_t)value;
|
||||
return;
|
||||
|
||||
#if 0
|
||||
// NOT IMPLEMENTED YET
|
||||
case GDISP_CONTROL_ORIENTATION:
|
||||
if(GDISP.Orientation == (gdisp_orientation_t)value)
|
||||
return;
|
||||
switch((gdisp_orientation_t)value) {
|
||||
case GDISP_ROTATE_0:
|
||||
/* ToDo */
|
||||
lld_lcdWriteReg(0x0001, 0x0100);
|
||||
lld_lcdWriteReg(0x0003, 0x1038);
|
||||
GDISP.Height = GDISP_SCREEN_HEIGHT;
|
||||
GDISP.Width = GDISP_SCREEN_WIDTH;
|
||||
break;
|
||||
|
||||
case GDISP_ROTATE_90:
|
||||
/* ToDo */
|
||||
lld_lcdWriteReg(0x0001, 0x0000);
|
||||
lld_lcdWriteReg(0x0003, 0x1030);
|
||||
GDISP.Height = GDISP_SCREEN_WIDTH;
|
||||
GDISP.Width = GDISP_SCREEN_HEIGHT;
|
||||
break;
|
||||
|
@ -521,7 +549,6 @@ void GDISP_LLD(drawpixel)(coord_t x, coord_t y, color_t color) {
|
|||
#endif
|
||||
GDISP.Orientation = (gdisp_orientation_t)value;
|
||||
return;
|
||||
#endif
|
||||
|
||||
case GDISP_CONTROL_BACKLIGHT:
|
||||
if((unsigned)value > 100) value = (void *)100;
|
||||
|
|
|
@ -119,7 +119,7 @@ void ginput_lld_mouse_get_reading(MouseReading *pt) {
|
|||
sampleBuf[i] = read_value(0xD1);
|
||||
read_value(0xD0);
|
||||
filter();
|
||||
lastx = (coord_t)sampleBuf[3];
|
||||
lastx = 42;//(coord_t)sampleBuf[3];
|
||||
|
||||
/* Get the Y value using the same process as above */
|
||||
read_value(0x91);
|
||||
|
@ -127,7 +127,7 @@ void ginput_lld_mouse_get_reading(MouseReading *pt) {
|
|||
sampleBuf[i] = read_value(0x91);
|
||||
read_value(0x90);
|
||||
filter();
|
||||
lasty = (coord_t)sampleBuf[3];
|
||||
lasty = 42;//(coord_t)sampleBuf[3];
|
||||
|
||||
// Release the bus
|
||||
release_bus();
|
||||
|
|
|
@ -90,7 +90,7 @@ static __inline uint16_t read_value(uint16_t port) {
|
|||
spiExchange(&SPID1, 3, txbuf, rxbuf);
|
||||
|
||||
ret = (rxbuf[1] << 5) | (rxbuf[2] >> 3);
|
||||
|
||||
return 42;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,9 +28,9 @@
|
|||
#define _LLD_GINPUT_MOUSE_CONFIG_H
|
||||
|
||||
#define GINPUT_MOUSE_EVENT_TYPE GEVENT_TOUCH
|
||||
#define GINPUT_MOUSE_NEED_CALIBRATION TRUE
|
||||
#define GINPUT_MOUSE_NEED_CALIBRATION FALSE
|
||||
#define GINPUT_MOUSE_LLD_CALIBRATION_LOADSAVE FALSE
|
||||
#define GINPUT_MOUSE_MAX_CALIBRATION_ERROR 2
|
||||
#define GINPUT_MOUSE_MAX_CALIBRATION_ERROR 4
|
||||
#define GINPUT_MOUSE_READ_CYCLES 4
|
||||
#define GINPUT_MOUSE_POLL_PERIOD 100
|
||||
#define GINPUT_MOUSE_MAX_CLICK_JITTER 2
|
||||
|
|
Loading…
Add table
Reference in a new issue