It was fairly easy to get the CFAF240320K-T-TS working to draw a full screen test pattern, etc., but I can't see how to set a single individual pixel at a location other than 0,0. For example, the following code should (in my mind) set the pixel location to 10, 10 and draw one green pixel, but any drawing always starts at 0,0.
Perhaps I'm doing something fundamentally wrong, but looking at the datasheet I had the impression you could set the starting location with 0x20 and 0x21, but perhaps not? Is there a straight-forward way to only draw single pixels and random locations (to draw fonts, etc.)? I'm sure there is ... I'm just hoping someone can point me in the right direction.
Code:
lcdDrawPixel(10, 10, GREEN);
void lcdSetCursor(uint16_t x, uint16_t y)
{
lcdWriteCmd(0x0020); // GRAM Address Set (Horizontal Address) (R20h)
lcdWriteData(x-1);
lcdWriteCmd(0x0021); // GRAM Address Set (Vertical Address) (R21h)
lcdWriteData(y-1);
}
void lcdDrawPixel(uint16_t x, uint16_t y, uint16_t color)
{
lcdSetCursor(x, y);
lcdWriteCmd(0x0022); // Write Data to GRAM (R22h)
lcdWriteData(color);
}
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.