i found an error in above mentioned driver!
If you rotate the LCD i.e. GDISP_ROTATE_90, lld_lcdSetCursor(uint16_t x, uint16_t y) malfunctions. This results in no pixels displaying beyond x=255 coordinates.
The reason is wrong address calculation and trying to write a 9 bit value to reg 0x0020 which in effect only takes 8 bit (see ILI9320 data sheet).
I tried the following fix doing away with the now unnecessary address calculation too (i left the commented original lines):
Code: Select all
static void lld_lcdSetCursor(uint16_t x, uint16_t y) {
// uint32_t addr;
// addr = y * 0x100 + x;
switch(GDISP.Orientation) {
case GDISP_ROTATE_0:
// lld_lcdWriteReg(0x0020, addr & 0xff); /* low addr */
// lld_lcdWriteReg(0x0021, (addr >> 8) & 0x1ff); /* high addr */
lld_lcdWriteReg(0x0020, x); /* Horizontal 8 valid bits. */
lld_lcdWriteReg(0x0021, y); /* Vertical 9 valid bits. */
break;
case GDISP_ROTATE_90:
// lld_lcdWriteReg(0x0020, (addr >> 8) & 0x1ff); /* low addr */
// lld_lcdWriteReg(0x0021, addr & 0xff); /* high addr */
lld_lcdWriteReg(0x0020, y); /* Horizontal 8 valid bits. */
lld_lcdWriteReg(0x0021, x); /* Vertical 9 valid bits. */
break;
case GDISP_ROTATE_180:
break;
case GDISP_ROTATE_270:
break;
}
}
It works for both GDISP_ROTATE_0 and GDISP_ROTATE_90 ok now.
I hope this is of any help for the community.
@ Tectu - Great job
Best regards to all
Wolf