Hardware
IPS ST7789V 1.14 inch 4-wire SPI bus
The display is capable of 18bit colour 6bits for R,G,B the 2 lower bits are not used
Note normally 16bit colours are used to display using 565 format using 16 bits,
this gives 5 bits for Red and Blue and 6 bits for Green
Useful online tools for 240x135 images
Hex file to Bin Hexadecimal -> file (binary)
FONTS
Free fonts
FreeMono12pt7b.h FreeSansBoldOblique12pt7b.h
FreeMono18pt7b.h FreeSansBoldOblique18pt7b.h
FreeMono24pt7b.h FreeSansBoldOblique24pt7b.h
FreeMono9pt7b.h FreeSansBoldOblique9pt7b.h
FreeMonoBold12pt7b.h FreeSansOblique12pt7b.h
FreeMonoBold18pt7b.h FreeSansOblique18pt7b.h
FreeMonoBold24pt7b.h FreeSansOblique24pt7b.h
FreeMonoBold9pt7b.h FreeSansOblique9pt7b.h
FreeMonoBoldOblique12pt7b.h FreeSerif12pt7b.h
FreeMonoBoldOblique18pt7b.h FreeSerif18pt7b.h
FreeMonoBoldOblique24pt7b.h FreeSerif24pt7b.h
FreeMonoBoldOblique9pt7b.h FreeSerif9pt7b.h
FreeMonoOblique12pt7b.h FreeSerifBold12pt7b.h
FreeMonoOblique18pt7b.h FreeSerifBold18pt7b.h
FreeMonoOblique24pt7b.h FreeSerifBold24pt7b.h
FreeMonoOblique9pt7b.h FreeSerifBold9pt7b.h
FreeSans12pt7b.h FreeSerifBoldItalic12pt7b.h
FreeSans18pt7b.h FreeSerifBoldItalic18pt7b.h
FreeSans24pt7b.h FreeSerifBoldItalic24pt7b.h
FreeSans9pt7b.h FreeSerifBoldItalic9pt7b.h
FreeSansBold12pt7b.h FreeSerifItalic12pt7b.h
FreeSansBold18pt7b.h FreeSerifItalic18pt7b.h
FreeSansBold24pt7b.h FreeSerifItalic24pt7b.h
FreeSansBold9pt7b.h FreeSerifItalic9pt7b.h
Other Fonts_available to include
TomThumb
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-.
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
//#define LOAD_FONT8N // Font 8. Alternative to Font 8 above, slightly narrower, so 3 digits fit a 160 pixel TFT
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
fonts can be scaled:
tft.setTextSize(1); // For normal sized fonts
tft.setTextSize(2); // For double sized fonts
Default colour definitions
drawFastVLine(x,y,h,color),
drawFastHLine(x,y,w,color),
fillRect(x,y,w,h,color);
example tft.fillScreen(TFT_WHITE); // set display to color white
Graphic commands
All perameters are uint32_t except were stated, parameters inside [ ] are optional, note [ ] not used.
get info tft. commands ( void )
height();
width();
getRotation(); // Read the current rotation
readPixel(x,y); // returns a uint16_t value in 565 format
Drawing tft. commands ( uint32_t )
drawPixel(x,y,color);
drawLine(xs,ys,xe,ye,color)
fillScreen(color);
drawRect(x,y,w,h,color);
drawRoundRect(x,y,w,h,radius,color);
fillRoundRect(x,y,w,h,radius,color);
drawCircle(x,y,r,color);
drawCircleHelper(x,y,r, cornername,color);
fillCircle(x,y,r,color);
fillCircleHelper(x,y,r,cornername,delta,color);
drawEllipse(x,y,rx,ry,color);
fillEllipse(x,y,rx,ry,color);
// Corner 1 Corner 2 Corner 3
drawTriangle(x1,y1, x2,y2, x3,y3,color);
fillTriangle(x1,y1, x2,y2, x3,y3,color);
// Draw bitmap - uses int16_t
drawBitmap(x,y, *bitmap,w,h,fgcolor [,bgcolor]);
drawXBitmap(x,y, *bitmap,w,h,fgcolor [,bgcolor]);
// Set TFT pivot point (use when rendering rotated sprites) int16_t
setPivot(x,y); // int16_t
getPivotX(); // Get pivot x int16_t
getPivotY(); // Get pivot y int16_t
// The next functions can be used as a pair to copy screen blocks (or horizontal/vertical lines) to another location
// Read a block of pixels to a data buffer, buffer is 16 bit and the size must be at least w * h
readRect(x,y,w,h,*data);
// These are used to render images or sprites stored in RAM arrays (used by Sprite class for 16bpp Sprites)
pushImage(x,y,w,h,*data);
pushImage(x,y,w,h,*data, uint16_t transparent);
// These are used to render images stored in FLASH (PROGMEM)
pushImage(x,y,w,h, const *data, uint16_t transparent);
pushImage(x,y,w,h, const uint16_t *data);
// These are used by Sprite class pushSprite() member function for 1, 4 and 8 bits per pixel (bpp) colours
// They are not intended to be used with user sketches (but could be)
// Set bpp8 true for 8bpp sprites, false otherwise. The cmap pointer must be specified for 4bpp
void pushImage(x,y,w,h, uint8_t *data, bool bpp8 = true, uint16_t *cmap = nullptr);
void pushImage(x,y,w,h, uint8_t *data, uint8_t transparent, bool bpp8 = true, uint16_t *cmap = nullptr);
// This next function has been used successfully to dump the TFT screen to a PC for documentation purposes
// It reads a screen area and returns the 3 RGB 8 bit colour values of each pixel in the buffer
// Set w and h to 1 to read 1 pixel's colour. The data buffer must be at least w * h * 3 bytes
readRectRGB(x,y,w,h,*data);
To help remove text
You can use the getTextBounds() function to determine the smallest rectangle encompassing a string, erase the area using fillRect(),
int16_t x1, y1;
uint16_t w, h;
tft.getTextBounds(string, x, y, &x1, &y1, &w, &h);
USEFUL EXTERNAL LINKS