HW Lines
This commit is contained in:
parent
b12ba062e4
commit
58ec84eb6f
|
|
@ -194,6 +194,54 @@ void Adafruit_RA8875::drawPixel(int16_t x, int16_t y, uint16_t color)
|
|||
digitalWrite(_cs, HIGH);
|
||||
}
|
||||
|
||||
void Adafruit_RA8875::drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color)
|
||||
{
|
||||
/* Set X */
|
||||
writeCommand(0x91);
|
||||
writeData(x0);
|
||||
writeCommand(0x92);
|
||||
writeData(x0 >> 8);
|
||||
|
||||
/* Set Y */
|
||||
writeCommand(0x93);
|
||||
writeData(y0);
|
||||
writeCommand(0x94);
|
||||
writeData(y0 >> 8);
|
||||
|
||||
/* Set X1 */
|
||||
writeCommand(0x95);
|
||||
writeData(x1);
|
||||
writeCommand(0x96);
|
||||
writeData((x1) >> 8);
|
||||
|
||||
/* Set Y1 */
|
||||
writeCommand(0x97);
|
||||
writeData(y1);
|
||||
writeCommand(0x98);
|
||||
writeData((y1) >> 8);
|
||||
|
||||
/* Set Color */
|
||||
writeCommand(0x63);
|
||||
writeData((color & 0xf800) >> 11);
|
||||
writeCommand(0x64);
|
||||
writeData((color & 0x07e0) >> 5);
|
||||
writeCommand(0x65);
|
||||
writeData((color & 0x001f));
|
||||
|
||||
/* Draw! */
|
||||
writeCommand(RA8875_DCR);
|
||||
writeData(0x80);
|
||||
|
||||
/* Wait for the command to finish */
|
||||
bool finished = false;
|
||||
while (!finished)
|
||||
{
|
||||
uint8_t temp = readReg(RA8875_DCR);
|
||||
if (!(temp & RA8875_DCR_LINESQUTRI_STATUS))
|
||||
finished = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Adafruit_RA8875::drawRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color)
|
||||
{
|
||||
rectHelper(x, y, x+w, y+h, color, false);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class Adafruit_RA8875 : public Adafruit_GFX {
|
|||
|
||||
/* Adafruit_GFX functions */
|
||||
void drawPixel(int16_t x, int16_t y, uint16_t color);
|
||||
//void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color);
|
||||
void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color);
|
||||
//void drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color);
|
||||
//void drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color);
|
||||
void drawRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color);
|
||||
|
|
|
|||
Loading…
Reference in New Issue