TFT_eSPI

TFT_eSPI core library

リンク

デバイスのセットアップ

#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
}

画面制御

描画(点)

描画(線)

描画(図形)

画像・塗りつぶし図形

文字列・数字

フォント

不明

調査中

  • 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

パラメータ

デフォルトの色の定義

const int32_t value Red Green Blue Comment
TFT_BLACK 0x0000 0 0 0
TFT_NAVY 0x000F 0 0 128
TFT_DARKGREEN 0x03E0 0 128 0
TFT_DARKCYAN 0x03EF 0 128 128
TFT_MAROON 0x7800 128 0 0
TFT_PURPLE 0x780F 128 0 128
TFT_OLIVE 0x7BE0 128 128 0
TFT_LIGHTGREY 0xD69A 211 211 211
TFT_DARKGREY 0x7BEF 128 128 128
TFT_BLUE 0x001F 0 0 255
TFT_GREEN 0x07E0 0 255 0
TFT_CYAN 0x07FF 0 255 255
TFT_RED 0xF800 255 0 0
TFT_MAGENTA 0xF81F 255 0 255
TFT_YELLOW 0xFFE0 255 255 0
TFT_WHITE 0xFFFF 255 255 255
TFT_ORANGE 0xFDA0 255 180 0
TFT_GREENYELLOW 0xB7E0 180 255 0
TFT_PINK 0xFE19 255 192 203 Lighter pink,
was 0xFC9F
TFT_BROWN 0x9A60 150 75 0
TFT_GOLD 0xFEA0 255 215 0
TFT_SILVER 0xC618 192 192 192
TFT_SKYBLUE 0x867D 135 206 235
TFT_VIOLET 0x915C 180 46 226
TFT_TRANSPARENT 0x0120 This is a special 16-bit colour value that encodes to 8 bits
and will then decode back to the same 16-bit value.
Convenient for 8-bit and 16-bit transparent sprites.
This is actually a dark green

フォントデータ

Const Values Description
TL_DATUM 0 Top left (default)
TC_DATUM 1 Top centre
TR_DATUM 2 Top right
ML_DATUM 3 Middle left
CL_DATUM 3 Centre left, same as above
MC_DATUM 4 Middle centre
CC_DATUM 4 Centre centre, same as above
MR_DATUM 5 Middle right
CR_DATUM 5 Centre right, same as above
BL_DATUM 6 Bottom left
BC_DATUM 7 Bottom centre
BR_DATUM 8 Bottom right
L_BASELINE 9 Left character baseline
(Line the 'A' character would sit on)
C_BASELINE 10 Centre character baseline
R_BASELINE 11 Right character baseline