本文整理汇总了C++中Adafruit_ILI9341类的典型用法代码示例。如果您正苦于以下问题:C++ Adafruit_ILI9341类的具体用法?C++ Adafruit_ILI9341怎么用?C++ Adafruit_ILI9341使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Adafruit_ILI9341类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
void Textbox::draw() {
if (_fillBackground) {
tft.fillRect(_pos.x, _pos.y, _size.w, _size.h, bgColor);
_fillBackground = false;
}
if (fontSize == 1) {
tft.setFont(&Inconsolata_g5pt7b);
} else {
tft.setFont(&Inconsolata_g8pt7b);
}
const char *valStr = _value;
size_t valLength = strlen(valStr);
if (_lastValLength > 0) {
if (strcmp(_lastVal, valStr) == 0) {
return;
}
tft.setCursor(_pos.x, _pos.y +_size.h-2);
tft.setTextColor(bgColor);
tft.print(_lastVal);
}
tft.setCursor(_pos.x, _pos.y +_size.h-2);
tft.setTextColor(fontColor);
tft.print(valStr);
tft.setFont(&Inconsolata_g5pt7b);
strcpy(_lastVal, valStr);
_lastValLength = valLength;
}
示例2: testFillScreen
unsigned long testFillScreen() {
unsigned long start = micros();
tft.fillScreen(ILI9341_BLACK);
tft.fillScreen(ILI9341_RED);
tft.fillScreen(ILI9341_GREEN);
tft.fillScreen(ILI9341_BLUE);
tft.fillScreen(ILI9341_BLACK);
return micros() - start;
}
示例3: testFastLines
unsigned long testFastLines(uint16_t color1, uint16_t color2) {
unsigned long start;
int x, y, w = tft.width(), h = tft.height();
tft.fillScreen(ILI9341_BLACK);
start = micros();
for (y = 0; y < h; y += 5) tft.drawFastHLine(0, y, w, color1);
for (x = 0; x < w; x += 5) tft.drawFastVLine(x, 0, h, color2);
return micros() - start;
}
示例4: testFilledCircles
unsigned long testFilledCircles(uint8_t radius, uint16_t color) {
unsigned long start;
int x, y, w = tft.width(), h = tft.height(), r2 = radius * 2;
tft.fillScreen(ILI9341_BLACK);
start = micros();
for (x = radius; x < w; x += r2) {
for (y = radius; y < h; y += r2) {
tft.fillCircle(x, y, radius, color);
}
}
return micros() - start;
}
示例5: setup
void setup(void) {
Serial.println(F("Touch Paint!"));
tft.begin();
if (!ts.begin()) {
Serial.println("Couldn't start touchscreen controller");
while (1);
}
Serial.println("Touchscreen started");
tft.fillScreen(ILI9341_BLACK);
// make the color selection boxes
tft.fillRect(0, 0, BOXSIZE, BOXSIZE, ILI9341_RED);
tft.fillRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, ILI9341_YELLOW);
tft.fillRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, ILI9341_GREEN);
tft.fillRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, ILI9341_CYAN);
tft.fillRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, ILI9341_BLUE);
tft.fillRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, ILI9341_MAGENTA);
// select the current color 'red'
tft.drawRect(0, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
currentcolor = ILI9341_RED;
}
示例6: setup
void setup() {
Serial.begin(38400);
Serial.println("handset");
tft.begin();
tft.fillScreen(ILI9341_BLACK);
setupLog();
radio = new CC1101Radio();
radio->listen(onMessageReceived);
pipe = new Pipeline();
pipe->segueTo(new DashboardViewController());
}
示例7: testCircles
unsigned long testCircles(uint8_t radius, uint16_t color) {
unsigned long start;
int x, y, r2 = radius * 2,
w = tft.width() + radius,
h = tft.height() + radius;
// Screen is not cleared for this one -- this is
// intentional and does not affect the reported time.
start = micros();
for (x = 0; x < w; x += r2) {
for (y = 0; y < h; y += r2) {
tft.drawCircle(x, y, radius, color);
}
}
return micros() - start;
}
示例8: SignalHandler
//--------------------------------------------------------------------------
// SignalHandler - Try to free up things like servos if we abort.
//--------------------------------------------------------------------------
void SignalHandler(int sig){
printf("Caught signal %d\n", sig);
tft.end(); // try to cleanup.
exit(1);
}
示例9: testTriangles
unsigned long testTriangles() {
unsigned long start;
int n, i, cx = tft.width() / 2 - 1,
cy = tft.height() / 2 - 1;
tft.fillScreen(ILI9341_BLACK);
n = min(cx, cy);
start = micros();
for (i = 0; i < n; i += 5) {
tft.drawTriangle(
cx, cy - i, // peak
cx - i, cy + i, // bottom left
cx + i, cy + i, // bottom right
tft.Color565(0, 0, i));
}
return micros() - start;
}
示例10: testRandomRects
unsigned long testRandomRects() {
unsigned long start;
int r, g, b, t, x, y, size = 16;
float i = 0.0f;
float pi = 3.1459; // 180 degrees
start = micros();
for (i = 0.0f; i < 2 * pi; i += (pi / 360.0)) {
r = (sin(i) * 127) + 128;
g = (sin(i + ((2 * pi) / 3.0)) * 127) + 128;
b = (sin(i + ((4 * pi) / 3.0)) * 127) + 128;
y = random(320 / size);
x = random(240 / size);
tft.fillRect(x * size, y*size, size, size, tft.Color565(r, g, b));
}
return micros() - start;
}
示例11: print_item
/************************************
* Name : print_item
* Purpuse :
* Inputs : None
* Outputs : None
* Returns : None
************************************/
int print_item(int line, char *iname, float value, char *unit)
{
int stPos;
if (line <= 0) return -1;
stPos = (line-1)*PERIOD;
tft.fillRect(0, stPos, 240, TEXTSIZE, ILI9341_BLACK);
tft.setCursor(2, stPos);
tft.setTextColor(ILI9341_WHITE);
tft.setTextSize(FONTSIZE);
tft.print(iname);
tft.print(value, 2);
tft.print(" ");
tft.print(unit);
}
示例12: drawLabel
void Stat::drawLabel() {
if (!_hideLabel) {
tft.setFont(&Inconsolata_g8pt7b);
tft.setCursor(_pos.x, _pos.y+1+CURSOR_Y_LARGE);
tft.setTextColor(ILI9341_WHITE);
tft.print(_labelText);
}
tft.fillRect(_value.x, _value.y, _controlWidth, 17, tft.color565(10, 10, 10));
}
示例13: testFilledRoundRects
unsigned long testFilledRoundRects() {
unsigned long start;
int i, i2,
cx = tft.width() / 2 - 1,
cy = tft.height() / 2 - 1;
tft.fillScreen(ILI9341_BLACK);
start = micros();
for (i = min(tft.width(), tft.height()); i > 20; i -= 6) {
i2 = i / 2;
tft.fillRoundRect(cx - i2, cy - i2, i, i, i / 8, tft.Color565(0, i, 0));
}
return micros() - start;
}
示例14: testRoundRects
unsigned long testRoundRects() {
unsigned long start;
int w, i, i2,
cx = tft.width() / 2 - 1,
cy = tft.height() / 2 - 1;
tft.fillScreen(ILI9341_BLACK);
w = min(tft.width(), tft.height());
start = micros();
for (i = 0; i < w; i += 6) {
i2 = i / 2;
tft.drawRoundRect(cx - i2, cy - i2, i, i, i / 8, tft.Color565(i, 0, 0));
}
return micros() - start;
}
示例15: testFilledTriangles
unsigned long testFilledTriangles() {
unsigned long start, t = 0;
int i, cx = tft.width() / 2 - 1,
cy = tft.height() / 2 - 1;
tft.fillScreen(ILI9341_BLACK);
start = micros();
for (i = min(cx, cy); i > 10; i -= 5) {
start = micros();
tft.fillTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
tft.Color565(0, i, i));
t += micros() - start;
tft.drawTriangle(cx, cy - i, cx - i, cy + i, cx + i, cy + i,
tft.Color565(i, i, 0));
}
return t;
}