Hi,
I have TFT 2.4 shield connected to Arduino UNO.
I've downloaded library to use it and I'm trying to understand how its showing pixels on screen.
Here's some code:
#define CD_COMMAND *cdPort &= cdPinUnset
#define CD_DATA *cdPort |= cdPinSet
#define CS_ACTIVE *csPort &= csPinUnset
#define CS_IDLE *csPort |= csPinSet
#define write8inline(d) { \
PORTD = (PORTD & B00000011) | ((d) & B11111100); \
PORTB = (PORTB & B11111100) | ((d) & B00000011); \
WR_STROBE; }
void Adafruit_TFTLCD::drawPixel(int16_t x, int16_t y, uint16_t color) {
CS_ACTIVE;
setAddrWindow(x, y, _width-1, _height-1);
CS_ACTIVE;
CD_COMMAND;
write8(0x2C);
CD_DATA;
write8(color >> 8);
write8(color);
CS_IDLE;
}
Can you please help me understand what happens here?
What's the purpose of CS_ACTIVE, CD_COMMAND, CD_DATA and CS_IDLE?
What write8() is doing?
Cheers!