Added HW accelerated curves
This commit is contained in:
parent
cc22b46b79
commit
cdc2165f73
|
|
@ -297,6 +297,16 @@ void Adafruit_RA8875::fillEllipse(int16_t xCenter, int16_t yCenter, int16_t long
|
|||
ellipseHelper(xCenter, yCenter, longAxis, shortAxis, color, true);
|
||||
}
|
||||
|
||||
void Adafruit_RA8875::drawCurve(int16_t xCenter, int16_t yCenter, int16_t longAxis, int16_t shortAxis, uint8_t curvePart, uint16_t color)
|
||||
{
|
||||
curveHelper(xCenter, yCenter, longAxis, shortAxis, curvePart, color, false);
|
||||
}
|
||||
|
||||
void Adafruit_RA8875::fillCurve(int16_t xCenter, int16_t yCenter, int16_t longAxis, int16_t shortAxis, uint8_t curvePart, uint16_t color)
|
||||
{
|
||||
curveHelper(xCenter, yCenter, longAxis, shortAxis, curvePart, color, true);
|
||||
}
|
||||
|
||||
void Adafruit_RA8875::circleHelper(int16_t x0, int16_t y0, int16_t r, uint16_t color, bool filled)
|
||||
{
|
||||
/* Set X */
|
||||
|
|
@ -511,6 +521,57 @@ void Adafruit_RA8875::ellipseHelper(int16_t xCenter, int16_t yCenter, int16_t lo
|
|||
}
|
||||
}
|
||||
|
||||
void Adafruit_RA8875::curveHelper(int16_t xCenter, int16_t yCenter, int16_t longAxis, int16_t shortAxis, uint8_t curvePart, uint16_t color, bool filled)
|
||||
{
|
||||
/* Set Center Point */
|
||||
writeCommand(0xA5);
|
||||
writeData(xCenter);
|
||||
writeCommand(0xA6);
|
||||
writeData(xCenter >> 8);
|
||||
writeCommand(0xA7);
|
||||
writeData(yCenter);
|
||||
writeCommand(0xA8);
|
||||
writeData(yCenter >> 8);
|
||||
|
||||
/* Set Long and Short Axis */
|
||||
writeCommand(0xA1);
|
||||
writeData(longAxis);
|
||||
writeCommand(0xA2);
|
||||
writeData(longAxis >> 8);
|
||||
writeCommand(0xA3);
|
||||
writeData(shortAxis);
|
||||
writeCommand(0xA4);
|
||||
writeData(shortAxis >> 8);
|
||||
|
||||
/* Set Color */
|
||||
writeCommand(0x63);
|
||||
writeData((color & 0xf800) >> 11);
|
||||
writeCommand(0x64);
|
||||
writeData((color & 0x07e0) >> 5);
|
||||
writeCommand(0x65);
|
||||
writeData((color & 0x001f));
|
||||
|
||||
/* Draw! */
|
||||
writeCommand(0xA0);
|
||||
if (filled)
|
||||
{
|
||||
writeData(0xD0 | (curvePart & 0x03));
|
||||
}
|
||||
else
|
||||
{
|
||||
writeData(0x90 | (curvePart & 0x03));
|
||||
}
|
||||
|
||||
/* Wait for the command to finish */
|
||||
bool finished = false;
|
||||
while (!finished)
|
||||
{
|
||||
uint8_t temp = readReg(0xA0);
|
||||
if (!(temp & 0x80))
|
||||
finished = true;
|
||||
}
|
||||
}
|
||||
|
||||
/************************* Mid Level ***********************************/
|
||||
|
||||
void Adafruit_RA8875::GPIOX(boolean on) {
|
||||
|
|
|
|||
|
|
@ -62,6 +62,8 @@ class Adafruit_RA8875 : public Adafruit_GFX {
|
|||
void fillTriangle(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color);
|
||||
void drawEllipse(int16_t xCenter, int16_t yCenter, int16_t longAxis, int16_t shortAxis, uint16_t color);
|
||||
void fillEllipse(int16_t xCenter, int16_t yCenter, int16_t longAxis, int16_t shortAxis, uint16_t color);
|
||||
void drawCurve(int16_t xCenter, int16_t yCenter, int16_t longAxis, int16_t shortAxis, uint8_t curvePart, uint16_t color);
|
||||
void fillCurve(int16_t xCenter, int16_t yCenter, int16_t longAxis, int16_t shortAxis, uint8_t curvePart, uint16_t color);
|
||||
|
||||
/* Backlight */
|
||||
void GPIOX(boolean on);
|
||||
|
|
@ -95,6 +97,7 @@ class Adafruit_RA8875 : public Adafruit_GFX {
|
|||
void rectHelper (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color, bool filled);
|
||||
void triangleHelper(int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, uint16_t color, bool filled);
|
||||
void ellipseHelper(int16_t xCenter, int16_t yCenter, int16_t longAxis, int16_t shortAxis, uint16_t color, bool filled);
|
||||
void curveHelper(int16_t xCenter, int16_t yCenter, int16_t longAxis, int16_t shortAxis, uint8_t curvePart, uint16_t color, bool filled);
|
||||
|
||||
uint8_t _cs, _rst;
|
||||
uint16_t _width, _height;
|
||||
|
|
|
|||
Loading…
Reference in New Issue