• Stars
    star
    459
  • Rank 95,377 (Top 2 %)
  • Language
    C
  • Created over 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Arduino GFX developing for various color displays and various data bus interfaces

Arduino_GFX

Arduino_GFX is a Arduino graphics library supporting various displays with various data bus interfaces.

This library start rewrite from Adafruit_GFX, LovyanGFX, TFT_eSPI, Ucglib, and more...

GitHub release (latest by date) GitHub Release Date GitHub commits since latest release (by date) GitHub last commit

GitHub Sponsors Twitter Follow

Ease of use

Simple Declaration

#include <Arduino_GFX_Library.h>
Arduino_DataBus *bus = new Arduino_HWSPI(16 /* DC */, 5 /* CS */);
Arduino_GFX *gfx = new Arduino_ILI9341(bus, 17 /* RST */);

And Simple Usage

gfx->begin();
gfx->fillScreen(BLACK);
gfx->setCursor(10, 10);
gfx->setTextColor(RED);
gfx->println("Hello World!");

U8g2 Font Support

U8g2 proivided various font type and stored in compressed format. So U8g2 font gives more UI design possibilities and still can fit in the MCU limited storage space. Using U8g2 font in Arduino_GFX simply include U8g2lib.h before Arduino_GFX_Library.h:

#include <U8g2lib.h>
#include <Arduino_GFX_Library.h>

And then setfont file to use:

gfx->setCursor(10, 20);
gfx->setFont(u8g2_font_maniac_tr);
gfx->println("Hello World!");

U8g2 font list can be found at: https://github.com/olikraus/u8g2/wiki/fntlistall

U8g2 Unicode (UTF8) Font Support

Another U8g2 font advantage is the font support Unicode glyphs. Simply enable setUTF8Print:

gfx->begin();
gfx->fillScreen(BLACK);
gfx->setUTF8Print(true);

And then print UTF8 string as usual:

gfx->setCursor(0, 16);

gfx->setFont(u8g2_font_unifont_tr);
gfx->println("Hello World!");

gfx->setFont(u8g2_font_unifont_t_polish);
gfx->println("Witaj świecie!");

gfx->setFont(u8g2_font_unifont_t_vietnamese1);
gfx->println("Chào thế giới!");

gfx->setFont(u8g2_font_unifont_t_chinese2);
gfx->println("世界你好!");

gfx->setFont(u8g2_font_unifont_t_japanese1);
gfx->println("こんにちは世界!");

gfx->setFont(u8g2_font_unifont_t_korean1);
gfx->println("안녕하세요, 세계입니다!");

U8g2 Unifont list can be found at: https://github.com/olikraus/u8g2/wiki/fntgrpunifont

Extra Fonts

Besides U8g2 generated font, Arduino_GFX also generated some useful font set:

Chill-Bitmap v2.400

u8g2_font_chill7_h_cjk
  • Glyphs: 13478/13478
  • Size: 254,960
  • Generation script:
otf2bdf ChillBitmap7x.ttf -p 6 -o ChillBitmap7x.bdf
bdfconv -v -f 1 -b 1 -m "0-4294967295" ChillBitmap7x.bdf -o u8g2_font_chill7_h_cjk.h -n u8g2_font_chill7_h_cjk

Cubic 11 v1.013

u8g2_font_cubic11_h_cjk
  • Glyphs: 10167/10167
  • Size: 337,650
  • Generation script:
otf2bdf Cubic_11_1.013_R.ttf -p 9 -o Cubic_11_1.013_R.bdf
bdfconv -v -f 1 -b 1 -m "0-4294967295" Cubic_11_1.013_R.bdf -o u8g2_font_cubic11_h_cjk.h -n u8g2_font_cubic11_h_cjk

QuanPixel:

u8g2_font_quan7_h_cjk
  • Glyphs: 18082/18082
  • Size: 335,225
  • Generation script:
./bdfconv -v -f 1 -b 1 -m "0-4294967295" quan.bdf -o u8g2_font_quan7_h_cjk.h -n u8g2_font_quan7_h_cjk

unifont_jp-14.0.02

u8g2_font_unifont_h_utf8
  • Glyphs: 57389/57389
  • Size: 2,250,360
  • Generation script:
bdfconv -v -f 1 -b 1 -m "0-1114111" unifont_jp-14.0.02.bdf -o u8g2_font_unifont_h_utf8.h -n u8g2_font_unifont_h_utf8
u8g2_font_unifont_t_chinese
  • Glyphs: 22145/57389
  • Size: 979,557
  • Generation script:
bdfconv -v -f 1 -m "32-127,11904-12351,19968-40959,63744-64255,65280-65376" unifont_jp-14.0.02.bdf -o u8g2_font_unifont_t_chinese.h -n u8g2_font_unifont_t_chinese
u8g2_font_unifont_t_chinese4
bdfconv -v -f 1 -M chinese4.list unifont_jp-14.0.02.bdf -o u8g2_font_unifont_t_chinese4.h -n u8g2_font_unifont_t_chinese4
u8g2_font_unifont_t_cjk
  • Glyphs: 41364/57389
  • Size: 1,704,862
  • Generation script:
bdfconv -v -f 1 -m "32-127,4352-4607,11904-12255,12288-19903,19968-40943,43360-43391,44032-55203,55216-55295,63744-64255,65072-65103,65280-65519" unifont_jp-14.0.02.bdf -o u8g2_font_unifont_t_cjk.h -n u8g2_font_unifont_t_cjk

Performance

This library is not putting speed at the first priority, but still paid much effort to make the display look smooth.

Figures

Below are some figures compare with other 3 Arduino common display libraries.

  • Arduino IDE: 1.8.15
  • arduino-esp32: 1.0.6
  • Dev Board: TTGO T8 v1.8
  • PSRAM: disable
  • Display: ILI9341
  • Interface: SPI
  • SPI Frequency: 40MHz
  • Test time: 2021 Jun 16
Benchmark Adafruit_GFX Arduino_GFX Lovyan_GFX TFT_eSPI
Screen fill 195,782 160,094 154,341 155,938
Text 97,662 18,960 22,473 21,752
Pixels 1,365,211 903,549 867,702 775,781
Lines 1,062,311 412,026 269,060 264,950
Horiz/Vert Lines 17,637 14,197 13,692 13,833
Rectangles-filled 406,817 332,696 320,761 323,908
Rectangles 11,641 9,254 8,545 8,714
Triangles-filled 150,941 118,010 105,661 109,675
Triangles 58,843 23,570 15,884 16,277
Circles-filled 76,739 52,170 42,787 45,827
Circles 118,125 40,955 25,959 25,269
Arcs-filled N/A 33,381 21,546 N/A
Arcs N/A 66,054 47,901 N/A
Rounded rects-fill 408,534 338,136 318,882 323,189
Rounded rects 43,185 21,562 13,089 15,371

Why Run Fast?

  • No read operation. Since not all display provide read back graphic memories API, Arduino_GFX skip all read operations. It can reduce the library size footprint and sometimes reduce the operation time.
  • Tailor-made data bus classes. Arduino_GFX decouple data bus operation from display driver, it is more easy to write individual data bus class for each platform.

Various data bus interfaces

Arduino_GFX utilizes Arduino Built-in SPI class to support 8-bit SPI for most platforms.

Most tiny displays in hobbyist electronics world support 8-bit SPI, but some require 9-bit SPI. Arduino_GFX should be the first Arduino display library that can use ESP32 SPI to support 9-bit hardware SPI. It is important to support the displays that require 9-bit SPI interface. (e.g. HX8357B, ...)

Larger displays most likely do not support standalone SPI since it is not fast enough to refresh the full screen details. Most of them support 8-bit/16-bit Parallel interface.

Some larger display require RGB + 3-bit SPI combo interface, This interface requies at most 3(9-bit SPI) + 4(CS, CD, WR, RD) + 24(RBG888) = 31 pins. Most dev board do not have enough GPIO to support this. Arduino_GFX is stick to RGB565 color, so RGB666 and RGB888 require some connection hack. E.g. RGB666 connect R5 and R6 together, B5 and B6 together to become RGB565. Then the least GPIO requirement can become 3(9-bit SPI) + 2(CD, WR) + 16(RBG565) = 21 pins. Remember always pull down CS pin and always pull up RD pin.

Currently Supported data bus [Wiki]

  • 8-bit and 9-bit hardware SPI (ESP32SPI)
  • 8-bit hardware SPI (HWSPI, ESP8266SPI, mbedSPI, NRFXSPI, RPiPicoSPI)
  • 8-bit and 9-bit software SPI (SWSPI)
  • 8-bit parallel interface (SWPAR8, AVRPAR8, ESP32PAR8, ESP32S2PAR8, RPiPicoPAR8, RTLPAR8, STM32PAR8)
  • 16-bit parallel interface (ESP32LCD16, ESP32PAR16, ESP32S2PAR16, RPiPicoPAR16)
  • RGB565+SPI interface (ESP32RGBPanel)

Tobe Support data bus (Sponsors can make it happen)

  • Arduino ATMega2560 dual 8-bit Port form 16-bit parallel interface
  • FastLED

Currently Supported Dev Board

  • Ameba RTL8722DM Board (AMB 21)
  • Ameba RTL8722DM MINI Board (AMB 23)
  • Arduino Nano
  • Arduino Nano BLE 33
  • Arduino Pro Micro
  • ESP8266 Series
  • ESP32 Series
  • ESP32-C3 Series
  • ESP32-S2 Series
  • ESP32-S3 Series
  • Raspberry Pi Pico
  • Raspberry Pi Pico W
  • rtlduino BW16 (by Ai-Thinker)
  • Sony Spresense
  • WeAct BlackPill V2.0 (BlackPill F411CE)

Tobe Support Dev Board (Sponsors can make it happen)

  • Arduino ATMega2560

Currently Supported Dev Device [Wiki]

Currently Supported Display [Wiki]

Tobe Support Display (Sponsors can make it happen)

  • FastLED Martix supported by co-operate with Canvas
  • Mono display supported by co-operate with Canvas
  • Multi-color e-ink display supported by co-operate with Canvas

Canvas (framebuffer) [Wiki]

  • Canvas (16-bit pixel)
  • Canvas_Indexed (half memory space)
  • Canvas_3bit (1/4 memory space framebuffer)
  • Canvas_Mono (1/16 memory space framebuffer)

LVGL Support

3 LVGL demo provide in examples folder:

  • LvglBenchmark [demo video]
  • LvglHelloWorld
  • LvglWidgets

Feature wishlist (Sponsors can make it happen)

  • Set text box
  • Canvas to FastLED
  • Print color Emoji Characters
  • Load bitmap font files from flash / SD
  • Fill Gradient #128

Using source code come from

More Repositories

1

RGB565_video

C++
108
star
2

ESP8266WiFiAnalyzer

C++
85
star
3

Arduino_BLE_Scanner

A ESP32 Arduino BLE Scanner
C++
78
star
4

ATtinyWatch

ATtiny85 Watch Core
C++
41
star
5

M5Stack-Cam-Viewer

Arduino M5Cam viewer for M5Stack
C++
30
star
6

ATtinyPowerMeter

C++
30
star
7

MiniTV

C++
29
star
8

nodemcu-webide

Web IDE for developing NodeMCU program with browser and WiFi
HTML
27
star
9

BloodOxygenHeartRateMeter

Maxim Integrated MAX30102 Blood Oxygen Heart Rate Meter
C
21
star
10

ESP32_BiJin_ToKei

C
21
star
11

IoT-Emoji-Sign

C++
14
star
12

ArduinoWatch

Arduino Watch Core
C++
12
star
13

GooglePhotoClock

ESP8266/ESP32 Google Photo frame with current time overlay.
C
12
star
14

FSBrowserPlus

Extended version of ESP32 example FSBrowser
HTML
11
star
15

ArduinoWiFiPhotoBackup

M5STACK Arduino WiFi Photo Backup device
C++
11
star
16

ESP32VideoRemote

ESP32 Camera Robot remote control by ESP32 Remote Controller with Video Monitor
C++
10
star
17

attiny861_i2c_gamepad

C++
9
star
18

TTGO-T-Watch

TTGO T-Watch stuff
C++
9
star
19

arduino-selfie-camera

C++
8
star
20

Design-a-Fancy-GUI-for-Your-Project

C
7
star
21

ESPWebSocketRemote

C++
7
star
22

ServoTester

A simple Arduino servo tester
C++
7
star
23

USBJoyStick

Convert 2 axis analog signals to Arduino Pro Micro USB HID Joystick
C++
7
star
24

LVGL_Watchface

C
7
star
25

Arduino_graphicstest_PDQ

C++
6
star
26

post_data_receiver

A simple node.js app that receive HTTP POST request and echo to console
JavaScript
4
star
27

ESP32_Photo_Album

C
4
star
28

ESP32-LCDKit

some sample codes using ESP32-LCDKit
C++
4
star
29

IoT-Pill-Bottle

Use IoT monitor patient take pill behavior and check pill fill status
C++
4
star
30

LVGL_Music_Player

C
4
star
31

ArduinoFreeFontFile

C
4
star
32

COVID-19_WHO_Dashboard

ESP version of WHO Coronavirus disease (COVID-19) Situation Dashboard
C
3
star
33

ArduinoVNC

Enhance from https://github.com/Links2004/arduinoVNC.git
C
3
star
34

ESP32_SD_Benchmark

Please find more details at: https://www.instructables.com/id/Select-SD-Interface-for-ESP32/
C++
3
star
35

Font-Stuff

Font design utils and demo code for display msg in MCU, include LED matrix and OLED/LCD display unit
2
star
36

IoT-Fidget

C++
2
star
37

ArduinoBiJinToKei

Arduino version BiJin ToKei implementation
C++
2
star
38

BLE-Heart-Rate-Sensor

C++
2
star
39

ESP32WebCam

C
2
star
40

esp32-digital-camera

C
1
star
41

NeoPixelHexPendant

C++
1
star
42

google-photos-object-aware-osd

Google Photos photo frame server with ImageAI object aware OSD
Python
1
star
43

TinyUSBJoystick

C++
1
star
44

aviPlayer

C
1
star
45

ESP32-S3-BOX-3

All ESP32-S3-BOX-3 stuff
C++
1
star
46

NeoPixelMatrix

C
1
star
47

esplora-i2c-gamepad

Use Arduino Esplora as an I2C gamepad
C++
1
star