mirror of
https://github.com/Bodmer/TFT_eSPI.git
synced 2025-08-02 12:14:40 +02:00
Updated Installing TFT_eSPI on PlatformIO (markdown)
@@ -27,12 +27,64 @@ We can achieve this by using PlatformIO's [`build_flags`](https://docs.platformi
|
|||||||
Your code now looks like this:
|
Your code now looks like this:
|
||||||
```INI
|
```INI
|
||||||
build_flags =
|
build_flags =
|
||||||
|
-D USER_SETUP_LOADED=1
|
||||||
|
-include $PROJECT_LIBDEPS_DIR/$PIOENV/TFT_eSPI_ID1559/User_Setups/Setup1_ILI9341.h
|
||||||
|
```
|
||||||
|
|
||||||
|
- Optionally you can create your custom setup by defining the needed settings, here is an example:
|
||||||
|
```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
|
||||||
|
```
|
||||||
|
***
|
||||||
|
The final `platformio.ini` file may look like this:
|
||||||
|
- Using User_Setups:
|
||||||
|
```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):
|
; TFT_eSPI library setting here (no need to edit library files):
|
||||||
;###############################################################
|
;###############################################################
|
||||||
-D USER_SETUP_LOADED=1 ; Set this settings as valid
|
-D USER_SETUP_LOADED=1 ; Set this settings as valid
|
||||||
-include $PROJECT_LIBDEPS_DIR/$PIOENV/TFT_eSPI_ID1559/User_Setups/Setup1_ILI9341.h
|
-include $PROJECT_LIBDEPS_DIR/$PIOENV/TFT_eSPI_ID1559/User_Setups/Setup1_ILI9341.h
|
||||||
```
|
```
|
||||||
|
- Custom setup:
|
||||||
|
```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
|
||||||
|
```
|
||||||
|
|
||||||
### 5. Include header
|
### 5. Include header
|
||||||
Add the line `#include <TFT_eSPI.h>`at the top of your files.
|
Add the line `#include <TFT_eSPI.h>`at the top of your files.
|
||||||
|
Reference in New Issue
Block a user