#include // #define LGFX_USE_V1 #include // This is the hardware: // https://github.com/LilyGO/TTGO-TM-ESP32 // LGFX for TTGO T-Display class LGFX : public lgfx::LGFX_Device { lgfx::Panel_ST7789 _panel_instance; lgfx::Bus_SPI _bus_instance; lgfx::Light_PWM _light_instance; public: LGFX(void) { { auto cfg = _bus_instance.config(); cfg.spi_host = VSPI_HOST; cfg.spi_mode = 0; cfg.freq_write = 40000000; cfg.freq_read = 14000000; cfg.spi_3wire = true; cfg.use_lock = true; cfg.dma_channel = 1; cfg.pin_sclk = 18; cfg.pin_mosi = 23; cfg.pin_miso = -1; cfg.pin_dc = 16; _bus_instance.config(cfg); _panel_instance.setBus(&_bus_instance); } /* { auto cfg = _light_instance.config(); cfg.pin_bl = 4; cfg.invert = false; cfg.freq = 44100; cfg.pwm_channel = 7; _light_instance.config(cfg); _panel_instance.setLight(&_light_instance); } */ { auto cfg = _panel_instance.config(); cfg.pin_cs = 5; cfg.pin_rst = 17; cfg.pin_busy = -1; cfg.panel_width = 240; cfg.panel_height = 320; cfg.offset_x = 0; cfg.offset_y = 0; cfg.offset_rotation = 0; cfg.dummy_read_pixel = 16; cfg.dummy_read_bits = 1; cfg.readable = true; cfg.invert = true; cfg.rgb_order = false; cfg.dlen_16bit = false; cfg.bus_shared = true; _panel_instance.config(cfg); } setPanel(&_panel_instance); } }; LGFX lcd; void setup(void) { Serial.begin(115200); lcd.init(); lcd.print("hello T-Display !"); } void loop(void) { delay(100); }