TFT_eSPI core library
リンク
- Welcome
https://doc-tft-espi.readthedocs.io/
- Getting Started
https://doc-tft-espi.readthedocs.io/starting/ - ディスプレイの基礎
https://doc-tft-espi.readthedocs.io/fundamentals/ - グラフィックとUI
https://doc-tft-espi.readthedocs.io/graphics/ - 例とリソース
https://doc-tft-espi.readthedocs.io/examples/
デバイスのセットアップ
- TFT_eSPI
TFT_eSPI のインスタンスを定義する
https://doc-tft-espi.readthedocs.io/tft_espi/methods/constructor/ - begin
https://doc-tft-espi.readthedocs.io/tft_espi/methods/begin/ - init
TFTディスプレイのレジスタをリセットして初期化する
https://doc-tft-espi.readthedocs.io/tft_espi/methods/init/ - setRotation
BMP描画の場合、画面の向きをm = 0-3または4-7で回転します
void TFT_eSPI::setRotation(uint8_t m)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/setrotation/ - getRotation
回転値を返す
#include <TFT_eSPI.h>
TFT_eSPI tft = TFT_eSPI();
void setup() {
tft.init();
tft.setRotation(1);
tft.fillScreen(TFT_BLACK);
tft.setCursor(0, 0);
tft.setTextColor(TFT_WHITE);
tft.setTextSize(2);
tft.setTextFont(2); // Set the text font to font number 2
tft.println("Hello World!");
}
void loop() {
// nothing to do here, just display the "Hello World!" message
}
画面制御
- fillScreen
画面を定義した色にクリアします。
void TFT_eSPI::fillScreen(uint32_t color)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/fillscreen/# - getCursorX / getCursorY
現在のカーソルの位置を読み取ります。
int16_t TFT_eSPI::getCursorX(void)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/getcursor/ - height / width
ディスプレイのピクセルの高さまたは幅を返す
int16_t TFT_eSPI::height(void)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/height_width/ - setViewport
TFT画面のクリッピング領域を設定する
void TFT_eSPI::setViewport(int32_t x, int32_t y, int32_t w, int32_t h, bool vpDatum)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/setviewport/ - setWindow
ピクセルのストリームを受信する領域を定義する - setOrigin
グラフィックスの原点を左上隅を基準とした x,y の位置に設定します
描画(点)
- drawPixel
任意の位置に単一のピクセルを配置するか、画面または背景ピクセルの色とブレンドされたピクセルを描画します。
void TFT_eSPI::drawPixel(int32_t x, int32_t y, uint32_t color)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/drawpixel/ - drawSpot
ax,ayに半径rのアンチエイリアスされた塗りつぶされた円を描画します。サブピクセル単位の位置決めを実現するため、座標は浮動小数点数です。
void TFT::eSPI::drawSpot(float ax, float ay, float r, uint32_t fg_color, uint32_t bg_color = 0x00FFFFFF)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/drawspot/ - readPixel
1 ピクセルからピクセルカラーを読み取ります。
uint16_t TFT_eSPI::readPixel(int32_t x0, int32_t y0)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/readpixel/
描画(線)
- drawFastVLine / drawFastHLine
水平線と垂直線を描きます。
void TFT_eSPI::drawFastHLine(int32_t x, int32_t y, int32_t w, uint32_t color)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/drawfastline/ - drawLine
任意の 2 点間に線を描きます。
void TFT_eSPI::drawLine(int32_t x0, int32_t y0, int32_t x1, int32_t y1, uint32_t color)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/drawline/ - drawWedgeLine / drawWideLine
幅広の線を描きます。
void TFT_eSPI::drawWedgeLine(float ax, float ay, float bx, float by, float ar, float br, uint32_t fg_color, uint32_t bg_color = 0x00FFFFFF)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/drawwedgewideline/ - pushColor
1ピクセルを置く
描画(図形)
- drawArc / drawSmoothArc
アンチエイリアスの有無にかかわらず、6時の位置から時計回りに円弧を描きます。
void TFT_eSPI::drawArc(int32_t x, int32_t y, int32_t r, int32_t ir, uint32_t startAngle, uint32_t endAngle, uint32_t fg_color, uint32_t bg_color, bool smoothArc = true)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/drawarc/ - drawCircle / drawSmoothCircle
最適化された中点円アルゴリズムを使用して円のアウトラインを描画します。
void TFT_eSPI::drawCircle(int32_t x, int32_t y, int32_t r, uint32_t color)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/drawcircle/ - drawEllipse
楕円の輪郭を描きます。
void TFT_eSPI::drawEllipse(int16_t x0, int16_t y0, int32_t rx, int32_t ry, uint16_t color)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/drawellipse/ - drawRect / drawRoundRect / drawSmoothRoundRect
長方形のアウトライン、角の丸い長方形のアウトライン、またはアンチエイリアスされた角丸長方形を描画します。
void TFT_eSPI::drawRect(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/drawrect/ - drawTriangle
任意の 3 つの点を使用して三角形の輪郭を描きます。
void TFT_eSPI::drawTriangle(int32_t x0, int32_t y0,int32_t x1, int32_t y1,int32_t x2, int32_t y2,uint32_t color)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/drawtriangle/
画像・塗りつぶし図形
- drawBitmap /
drawXBitmap
保存されている画像を描画します。
void TFT_eSPI::drawBitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/drawbitmap/ - fillCircle / fillSmoothCircle
塗りつぶされた円またはアンチエイリアスされた塗りつぶされた円を描画します。
void TFT_eSPI::fillCircle(int32_t x, int32_t y, int32_t r, uint32_t color)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/fillcircle/ - fillEllipse
塗りつぶされた楕円を描きます。
void TFT_eSPI::drawEllipse(int16_t x0, int16_t y0, int32_t rx, int32_t ry, uint16_t color)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/fillellipse/ - fillRect / fillRoundRect / fillSmoothRoundRect
固定色で塗りつぶされた四角形を描画します。
void TFT_eSPI::fillRect(int32_t x, int32_t y, int32_t w, int32_t h, uint32_t color)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/fillrect/ - fillRectHGradient / fillRectVGradient
水平方向と垂直方向の色のグラデーションで塗りつぶされた四角形を描画します。
void TFT_eSPI::fillRectHGradient(int16_t x, int16_t y, int16_t w, int16_t h, uint32_t color1, uint32_t color2)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/fillrectgradient/ - fillTriangle
任意の 3 つの点を使用して塗りつぶされた三角形を描きます。
void TFT_eSPI::fillTriangle(int32_t x0, int32_t y0,int32_t x1, int32_t y1,int32_t x2, int32_t y2,uint32_t color)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/filltriangle/
文字列・数字
- setCursor
テキスト カーソルの x,y 位置、またはテキスト カーソルの x,y 位置とフォントを設定します。
void TFT_eSPI::setCursor(int16_t x, int16_t y, uint8_t font)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/setcursor/ - setTextColor
フォントの前景色(背景は透明)または背景色を設定します。
void TFT_eSPI::setTextColor(uint16_t color)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/settextcolor/ - setTextDatum
テキスト位置の参照データを設定します。
void TFT_eSPI::setTextDatum(uint8_t d)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/settextdatum/ - setTextPadding
パディング幅を定義します (古いテキストと数字を消去するのに役立ちます)。
void TFT_eSPI::setTextPadding(uint16_t x_width)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/settextpadding/ - setTextSize
テキスト サイズを設定します。(1~7)
void TFT_eSPI::setTextSize(uint8_t s)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/settextsize/ - setTextWrap
テキストを行末で折り返すかどうかを定義します。
void TFT_eSPI::setTextWrap(bool wrapX, bool wrapY)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/settextwrap/ - print
print() は、画面の現在の位置に次の値を表示します。その後、カーソルは値表示の末尾に移動します。
void TFT_eSPI::print(val, format)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/print/ - println
println() は値の後に「改行」を追加します。そのため、カーソルは現在のテキストの行頭の位置に応じて、次の行の左端の位置に戻ります。
void TFT_eSPI::println(val, format)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/print/ - drawChar
1 つの文字を画面に描画します。
void TFT_eSPI::drawChar(int32_t x, int32_t y, uint16_t c, uint32_t color, uint32_t bg, uint8_t size)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/drawchar/ - drawString
文字列を描画します。
int16_t TFT_eSPI::drawString(const char *string, int32_t x, int32_t y, uint8_t font)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/drawstring/ - drawCentreString
dX を中心にして描きます。
int16_t TFT_eSPI::drawCentreString(const char *string, int32_t x, int32_t y, uint8_t font)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/drawcentrestring/ - drawRightString
文字列を右揃えで描画します。
int16_t TFT_eSPI::drawRightString(const String& string, int32_t dX, int32_t poY, uint8_t font)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/drawrightstring/ - drawNumber
長整数を描画します。
int16_t TFT_eSPI::drawNumber(long intNumber, int32_t x, int32_t y, uint8_t font)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/drawnumber/ - drawFloat
浮動小数点数を描画します。
int16_t TFT_eSPI::drawFloat(float floatNumber, uint8_t decimal, int32_t x, int32_t y, uint8_t font)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/drawfloat/ - getTextDatum
テキストデータ値を返す
uint8_t TFT_eSPI::getTextDatum(void)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/gettextdatum/ - getTextPadding
パディング幅を返す
uint16_t TFT_eSPI::getTextPadding(void)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/gettextpadding/
フォント
- setTextFont
フォントを設定します。
void TFT_eSPI::setTextFont(uint8_t f)
https://doc-tft-espi.readthedocs.io/tft_espi/methods/settextfont/ - setFreeFont
不明
- drawCircleHelper
https://doc-tft-espi.readthedocs.io/tft_espi/methods/drawcirclehelper/ - fillCircleHelper
https://doc-tft-espi.readthedocs.io/tft_espi/methods/fillcirclehelper/
調査中
- getOriginX
- getOriginY
- invertDisplay
- setAddrWindow
- checkViewport
- resetViewport
- getViewportX
- getViewportY
- getViewportWidth
- getViewportHeight
- getViewportDatum
- frameViewport
- resetViewport
- clipAddrWindow
- clipWindow
- pushColors
- pushBlock
- pushPixels
- tft_Read_8
- begin_SDA_Read
- end_SDA_Read
- setSwapBytes
- getSwapBytes
- setPivot
- getPivotX
- getPivotY
- readRect
- pushRect
- pushImage
- pushMaskedImage
- readRectRGB
- textWidth
- fontHeight
- decodeUTF8
- write
- setCallback
- fontsLoaded
- spiwrite
- writecommand
- writeRegister
- writedata
- commandList
- readcommand8
- readcommand16
- readcommand32
- color565
color8to16
color16to8
color16to24
color24to16
alphaBlend
alphaBlend24 - initDMA
deInitDMA
pushImageDMA
pushPixelsDMA
dmaBusy
dmaWait - startWrite
writeColor
endWrite - setAttribute
getAttribute
getSetup
getSPIinstance
- getTouchRaw
getTouchRawZ
convertRawXY
getTouch
calibrateTouch
setTouch
fillSmoothRoundRect
- fillSprite
- loadFont
- unloadFont
- getUnicodeIndex
- showFont
- TFT_eSPI_Button
- initButton
initButtonUL
setLabelDatum
drawButton
contains
press
isPressed
justPressed
justReleased
- TFT_eSprite
- createSprite
getPointer
created
deleteSprite
frameBuffer
setColorDepth
getColorDepth
createPalette
setPaletteColor
getPaletteColor
setBitmapColor - setScrollRect
scroll
pushRotated
setPivot
getPivotX
getPivotY
getRotatedBounds
readPixelValue
pushToSprite
drawGlyph - printToSprite
- pushSprite