### PlatformIO Configuration with User Setups Source: https://github.com/bodmer/tft_espi/wiki/Installing-on-PlatformIO Example platformio.ini file using a pre-made User Setup for the ESP32. ```ini [env:esp32dev] platform = espressif32 board = esp32dev framework = arduino lib_deps = TFT_eSPI build_flags = ;############################################################### ; TFT_eSPI library setting here (no need to edit library files): ;############################################################### -D USER_SETUP_LOADED=1 ; Set this settings as valid -include $PROJECT_LIBDEPS_DIR/$PIOENV/TFT_eSPI/User_Setups/Setup1_ILI9341.h ``` -------------------------------- ### PlatformIO Configuration with Custom Setup Source: https://github.com/bodmer/tft_espi/wiki/Installing-on-PlatformIO Example platformio.ini file with custom TFT_eSPI settings defined via build flags for the ESP32. ```ini [env:esp32dev] platform = espressif32 board = esp32dev framework = arduino lib_deps = TFT_eSPI build_flags = ;############################################################### ; TFT_eSPI library setting here (no need to edit library files): ;############################################################### -D USER_SETUP_LOADED=1 ; Set this settings as valid -D ILI9163_DRIVER=1 ; Select ILI9163 driver -D TFT_WIDTH=128 ; Set TFT size -D TFT_HEIGHT=160 -D TFT_MISO=19 ; Define SPI pins -D TFT_MOSI=23 -D TFT_SCLK=18 -D TFT_CS=5 -D TFT_DC=19 ; Data/Comand pin -D TFT_RST=-1 ; Reset pin -D LOAD_GLCD=1 ; Load Fonts -D SPI_FREQUENCY=27000000 ; Set SPI frequency ``` -------------------------------- ### PlatformIO Build Flags for External Setup Source: https://github.com/bodmer/tft_espi/blob/master/docs/PlatformIO/External setup for Platform_IO.txt This example demonstrates how to configure PlatformIO's build flags to specify the path to an external User_Setup.h file for TFT_eSPI. This is used when the default library setup needs to be overridden. ```ini build_flags = ; TFT_eSPI config -D TFT_ESPI_USER_SETUP_PATH="../configs/cyd/User_Setup.h" ``` -------------------------------- ### Include Custom Setup Select File Source: https://github.com/bodmer/tft_espi/blob/master/README.md Further streamline setup selection by creating a custom setup select file. This allows you to manage all setup configurations in one place, which will not be overwritten during library upgrades. ```cpp #include <../TFT_eSPI_Setups/my_setup_select.h> ``` -------------------------------- ### Include Custom Setup File Source: https://github.com/bodmer/tft_espi/blob/master/README.md To prevent custom setup files from being overwritten during library upgrades, place them in a separate folder and include them using a relative path. Ensure only one setup file is included. ```cpp #include <../TFT_eSPI_Setups/my_custom_setup.h> ``` -------------------------------- ### Include External User Setup in TFT_eSPI Source: https://github.com/bodmer/tft_espi/blob/master/docs/PlatformIO/External setup for Platform_IO.txt This code snippet shows how to conditionally include an external User_Setup.h file if the TFT_ESPI_USER_SETUP_PATH macro is defined. It ensures that the custom setup is loaded and marks it as loaded. ```c++ #ifdef TFT_ESPI_USER_SETUP_PATH // Use external User_Setup.h if defined #define USER_SETUP_LOADED // Define TFT_ESPI_USER_SETUP_PATH as a string literal // Example (PlatformIO): // -D TFT_ESPI_USER_SETUP_PATH="../configs/your_board/User_Setup.h" #include TFT_ESPI_USER_SETUP_PATH #endif ``` -------------------------------- ### PlatformIO Build Flags for TFT_eSPI Configuration Source: https://github.com/bodmer/tft_espi/wiki/Installing-on-PlatformIO Use these build flags in your platformio.ini file to configure the TFT_eSPI library. Define `USER_SETUP_LOADED` and include a specific setup file. ```ini build_flags = -D USER_SETUP_LOADED=1 -include $PROJECT_LIBDEPS_DIR/$PIOENV/TFT_eSPI/User_Setups/Setup1_ILI9341.h ``` -------------------------------- ### Add TFT_eSPI Dependency to platform.ini Source: https://github.com/bodmer/tft_espi/wiki/Installing-on-PlatformIO Add this line to your platform.ini file to include the TFT_eSPI library. PlatformIO will automatically download and install it on the next build. ```ini lib_deps = TFT_eSPI ``` -------------------------------- ### PlatformIO Project Configuration for RP2040 Source: https://github.com/bodmer/tft_espi/blob/master/docs/PlatformIO/rp2040.txt This configuration file sets up the PlatformIO environment for an RP2040-based project using the TFT_eSPI library. It specifies the platform, board, framework, core, filesystem size, library dependencies, MCU type, and CPU frequency. Ensure the TFT_eSPI library version is compatible. ```ini [env:pico] platform = https://github.com/maxgerhardt/platform-raspberrypi.git board = pico framework = arduino board_build.core = earlephilhower board_build.filesystem_size = 0.5m lib_deps = bodmer/TFT_eSPI@^2.5.21 ; change microcontroller board_build.mcu = rp2040 ; change MCU frequency board_build.f_cpu = 133000000L build_flags = -Os -DUSER_SETUP_LOADED=1 ; Define the TFT driver, pins etc. here: -DTFT_PARALLEL_8_BIT=1 -DRM68120_DRIVER=1 -DRP2040_PIO_CLK_DIV=1 -DTFT_DC=28 -DTFT_WR=22 -DTFT_RST=2 -DTFT_D0=6 -DTFT_D1=7 -DTFT_D2=8 -DTFT_D3=9 -DTFT_D4=10 -DTFT_D5=11 -DTFT_D6=12 -DTFT_D7=13 -DTFT_BL=16 -DTFT_BACKLIGHT_ON=HIGH -DLOAD_GLCD=1 -DLOAD_FONT2=1 -DLOAD_FONT4=1 -DLOAD_FONT6=1 -DLOAD_FONT7=1 -DLOAD_FONT8=1 -DLOAD_GFXFF=1 -DSMOOTH_FONT=1 ``` -------------------------------- ### PlatformIO Project Configuration Source: https://github.com/bodmer/tft_espi/blob/master/docs/PlatformIO/Configuring options.txt Configure build flags, library dependencies, and hardware settings for your PlatformIO project. Use -D prefix for preprocessor definitions. ```ini ; PlatformIO Project Configuration File ; ; Build options: build flags, source filter ; Upload options: custom upload port, speed and extra flags ; Library options: dependencies, extra library storages ; Advanced options: extra scripting ; ; Please visit documentation for the other options and examples ; https://docs.platformio.org/page/projectconf.html [env:esp32dev] platform = https://github.com/platformio/platform-espressif32.git#feature/arduino-upstream board = esp32dev framework = arduino lib_deps = bodmer/TFT_eSPI@^2.4.31 build_flags = -Os -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG -DUSER_SETUP_LOADED=1 ; Define the TFT driver, pins etc. here: -DST7789_DRIVER=1 -DTFT_WIDTH=128 -DTFT_HEIGHT=160 -DTFT_MISO=19 -DTFT_MOSI=23 -DTFT_SCLK=18 -DTFT_CS=5 -DTFT_DC=19 -DTFT_RST=4 ;-DTFT_BL=21 ;-DTOUCH_CS=22 -DLOAD_GLCD=1 -DLOAD_FONT2=1 -DLOAD_FONT4=1 -DLOAD_FONT6=1 -DLOAD_FONT7=1 -DLOAD_FONT8=1 -DLOAD_GFXFF=1 -DSMOOTH_FONT=1 -DSPI_FREQUENCY=27000000 ``` -------------------------------- ### Custom TFT_eSPI Settings via Build Flags Source: https://github.com/bodmer/tft_espi/wiki/Installing-on-PlatformIO Define custom settings directly in your platformio.ini using build flags. Replace `#define` with `-D` for each setting. ```ini -D ILI9163_DRIVER=1 ; Select ILI9163 driver -D TFT_WIDTH=128 ; Set TFT size -D TFT_HEIGHT=160 -D TFT_MISO=19 ; Define SPI pins -D TFT_MOSI=23 -D TFT_SCLK=18 -D TFT_CS=5 -D TFT_DC=19 ; Data/Comand pin -D TFT_RST=-1 ; Reset pin -D LOAD_GLCD=1 ; Load Fonts -D SPI_FREQUENCY=27000000 ; Set SPI frequency ``` -------------------------------- ### ILI9488 IPS Display Initialization Commands Source: https://github.com/bodmer/tft_espi/blob/master/other stuff/ILI9488_IPS_init.txt This snippet defines the initialization command list for the ILI9488 IPS display. It includes specific settings for gamma correction and other parameters crucial for IPS panels. Ensure these commands are used when initializing this specific display type. ```cpp struct Panel_ILI9488IPS : public Panel_ILI948x { void setColorDepth_impl(color_depth_t depth) override { _write_depth = (((int)depth & color_depth_t::bit_mask) > 16 || (_bus && _bus->busType() == bus_spi)) ? rgb888_3Byte : rgb565_2Byte; _read_depth = rgb888_3Byte; } protected: static constexpr uint8_t CMD_FRMCTR1 = 0xB1; static constexpr uint8_t CMD_FRMCTR2 = 0xB2; static constexpr uint8_t CMD_FRMCTR3 = 0xB3; static constexpr uint8_t CMD_INVCTR = 0xB4; static constexpr uint8_t CMD_DFUNCTR = 0xB6; static constexpr uint8_t CMD_ETMOD = 0xB7; static constexpr uint8_t CMD_PWCTR1 = 0xC0; static constexpr uint8_t CMD_PWCTR2 = 0xC1; static constexpr uint8_t CMD_PWCTR3 = 0xC2; static constexpr uint8_t CMD_PWCTR4 = 0xC3; static constexpr uint8_t CMD_PWCTR5 = 0xC4; static constexpr uint8_t CMD_VMCTR = 0xC5; static constexpr uint8_t CMD_GMCTRP1 = 0xE0; // Positive Gamma Correction static constexpr uint8_t CMD_GMCTRN1 = 0xE1; // Negative Gamma Correction static constexpr uint8_t CMD_ADJCTL3 = 0xF7; static constexpr uint8_t NML_BLACK = 0x21; const uint8_t* getInitCommands(uint8_t listno) const override { static constexpr uint8_t list0[] = { CMD_PWCTR1, 2, 0x0F, // VRH1 0x0F, // VRH2 CMD_PWCTR2, 1, 0x41, // VGH, VGL CMD_PWCTR3, 1, 0x22, CMD_VMCTR , 3, 0x00, // nVM 0x53, // VCM_REG 0x80, // VCM_REG_EN CMD_FRMCTR1, 1, 0xA0, // Frame rate = 60Hz CMD_INVCTR, 1, 0x02, // Display Inversion Control = 2dot CMD_DFUNCTR, 3, 0x02, // Nomal scan 0x22, // 5 frames 0x3B, CMD_ETMOD, 1, 0xC6, // CMD_ADJCTL3, 4, 0xA9, // Adjust Control 3 0x51, 0x2C, 0x82, //***********the following are notable for IPS CMD_GMCTRP1, 15, 0x00,0x08,0x0C,0x02,0x0E,0x04,0x30,0x45,0x47,0x04,0x0C,0x0A,0x2E,0x34,0x0F, CMD_GMCTRN1, 15, 0x00,0x11,0x0D,0x01,0x0F,0x05,0x39,0x36,0x51,0x06,0x0F,0x0D,0x33,0x37,0x0F, NML_BLACK,0, //********************** CMD_SLPOUT , 0+CMD_INIT_DELAY, 120, // Exit sleep mode CMD_IDMOFF , 0, CMD_DISPON , 0+CMD_INIT_DELAY, 100, 0xFF,0xFF, // end }; switch (listno) { case 0: return list0; default: return nullptr; } } }; ``` -------------------------------- ### Include TFT_eSPI Header Source: https://github.com/bodmer/tft_espi/wiki/Installing-on-PlatformIO Include the TFT_eSPI library header file at the beginning of your Arduino sketch. ```cpp #include ``` -------------------------------- ### Set Text Color with Background Rendering (C++) Source: https://github.com/bodmer/tft_espi/blob/master/README.md Configures text color and background color for smooth font rendering. The third parameter enables background rendering, which is necessary for some sketches and defaults to false if omitted. ```cpp tft.setTextColor(TFT_WHITE, TFT_BLUE, true); spr.setTextColor(TFT_BLUE, TFT_BLACK, true); ``` -------------------------------- ### Print Text with Background Rendering (C++) Source: https://github.com/bodmer/tft_espi/blob/master/README.md Utilizes the print stream to display text with background rendering enabled for smooth fonts. This is a convenient way to update text with minimal flicker. ```cpp tft.println("Hello World"); ``` -------------------------------- ### Draw Smooth Arcs with Rounded Ends (C++) Source: https://github.com/bodmer/tft_espi/blob/master/README.md Demonstrates drawing anti-aliased arcs with rounded ends. This function is optimized for processors without a hardware Floating Point Unit. ```cpp tft.drawSmoothArc(120, 120, 100, 100, 0, 360, TFT_RED, TFT_BLACK, true); tft.drawSmoothArc(120, 120, 80, 80, 0, 360, TFT_GREEN, TFT_BLACK, true); ``` -------------------------------- ### bmp2array4bit.py Usage Source: https://github.com/bodmer/tft_espi/blob/master/Tools/bmp2array4bit/README.md Command-line usage for the bmp2array4bit.py script. Specify the input BMP file and an optional output C file name. ```bash usage: python bmp2array4bit.py [-v] star.bmp [-o myfile.c] ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.