本文整理汇总了C++中Adafruit_ILI9341::color565方法的典型用法代码示例。如果您正苦于以下问题:C++ Adafruit_ILI9341::color565方法的具体用法?C++ Adafruit_ILI9341::color565怎么用?C++ Adafruit_ILI9341::color565使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Adafruit_ILI9341
的用法示例。
在下文中一共展示了Adafruit_ILI9341::color565方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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));
}
示例2: 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;
}
示例3: drawValue
void Stat::drawValue() {
char valStr[8];
size_t valLength;
if (validReadingi(_stat)) {
valLength = (size_t) sprintf(valStr, "%d", _stat);
} else {
valLength = (size_t) sprintf(valStr, "-- ");
}
if (_lastValLength > 0) {
if (_lastValDrawn == _stat) {
return;
}
tft.setCursor(_value.x, _value.y + 1 + CURSOR_Y_LARGE);
tft.setFont(&Inconsolata_g8pt7b);
tft.setTextColor(tft.color565(10, 10, 10));
tft.print(_lastVal);
if (valLength != _lastValLength) {
tft.setFont(&Inconsolata_g5pt7b);
tft.print(_unitText);
}
}
tft.setCursor(_value.x, _value.y+1+CURSOR_Y_LARGE);
tft.setFont(&Inconsolata_g8pt7b);
tft.setTextColor(ILI9341_WHITE, tft.color565(10, 10, 10));
tft.print(valStr);
tft.setFont(&Inconsolata_g5pt7b);
if (valLength != _lastValLength) {
tft.setFont(&Inconsolata_g5pt7b);
tft.print(_unitText);
}
memcpy(_lastVal, valStr, valLength+1);
_lastValDrawn = _stat;
_lastValLength = valLength;
}
示例4: 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;
}
示例5: 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;
}
示例6: 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;
}
示例7: drawChart
void Stat::drawChart() {
if (_redrawChart) {
_cur = 0;
tft.fillRect(_chart.x, _chart.y - 1 /* catch the top of the unit of the axis */,
_chartWidth, 32 /* to catch the bottom of the unit on the axis */,
ILI9341_BLACK);
tft.setCursor(_chart.x + 27 - ((int16_t) strlen(_labelText) * 6), _chart.y + 12+CURSOR_Y_SMALL);
tft.setTextColor(ILI9341_WHITE);
tft.setFont(&Inconsolata_g5pt7b);
tft.print(_labelText);
tft.setCursor(_chart.x + _chartWidth - 45, _chart.y+CURSOR_Y_SMALL);
tft.print(_max == INT_MIN ? 0 : _max);
if (_unitText) {
tft.setTextColor(_chartColor);
tft.setCursor(_chart.x + _chartWidth - 45, _chart.y + 12+CURSOR_Y_SMALL);
tft.print(_unitText);
tft.setTextColor(ILI9341_WHITE);
}
tft.setCursor(_chart.x + _chartWidth - 45, _chart.y + 24+CURSOR_Y_SMALL);
tft.print(_min == INT_MAX ? 0 : _min);
tft.setFont(&Inconsolata_g8pt7b);
_redrawChart = false;
tft.fillRect(_chart.x + 30, _chart.y, _chartWidth - 80, 30, tft.color565(10, 10, 10));
}
for ( ; _cur < _end; _cur++) {
if (invalidReadingi(_historical[_cur])) {
tft.drawFastVLine(_chart.x+30+_cur, _chart.y, 30, ILI9341_MAROON);
continue;
}
int norm = (int) map(_historical[_cur], _min, _max, 0, 29);
int x = _chart.x+30+_cur;
int y = _chart.y+29-norm;
tft.fillRect(x, y, 1, 1, _chartColor);
}
}