From f00ac80e09bcfdd07b495572d88926f8acf6d33e Mon Sep 17 00:00:00 2001 From: Ricard Bitria Ribes Date: Sat, 8 Feb 2020 13:37:49 +0100 Subject: [PATCH] Created Installing TFT_eSPI on PlatformIO (markdown) --- Installing-TFT_eSPI-on-PlatformIO.md | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Installing-TFT_eSPI-on-PlatformIO.md diff --git a/Installing-TFT_eSPI-on-PlatformIO.md b/Installing-TFT_eSPI-on-PlatformIO.md new file mode 100644 index 0000000..aacf0db --- /dev/null +++ b/Installing-TFT_eSPI-on-PlatformIO.md @@ -0,0 +1,32 @@ +# Installation: PlatformIO +This guide will setup [TFT_eSPI](https://github.com/Bodmer/TFT_eSPI) for **PlatformIO** development platform. +### 1. Install PlatformIO +Go to [PlatformIO page](https://platformio.org/platformio-ide) and follow the instructions to install it into your favourite IDE. + +In this guide we will use [VSCode](https://code.visualstudio.com/) as an example. Install instructions and guides for VSCode can be found [here](https://docs.platformio.org/en/latest/ide/vscode.html). + +### 2. Create a project +Follow [this guide](https://docs.platformio.org/en/latest/ide/vscode.html#quick-start) to setup your project. Once you are done open the platformio.ini file. You should see something like this: + +![imagen](https://user-images.githubusercontent.com/26528164/74084716-edd2da80-4a71-11ea-9437-b20d7952783a.png) + +### 3. Add TFT_eSPI to your project +There are different ways to add libraries in PlatformIO, but the simplest way is to add the line `lib_deps = TFT_eSPI`. Your file now looks like this: + +![imagen](https://user-images.githubusercontent.com/26528164/74084691-af3d2000-4a71-11ea-9841-8e6f9f1da76f.png) + +*More info on `lib_deps`[here](https://docs.platformio.org/en/latest/projectconf/section_env_library.html).* + +### 4. Configure library +We could modify the `User_Setup_Select.h` file and set our preferences but one cool thig about PlatformIO is that we can modify the library settings without editting the actual library files. This allows us to create different projects with different settings. Also we can update libraries to newer versions without loosing our settings. + +We can achieve this by using PlatformIO's [`build_flags`](https://docs.platformio.org/en/latest/projectconf/section_env_build.html). Just instead of using #define, use the -D prefix. + +- First of all we prevent user settings headers to be loaded by defining `USER_SETUP_LOADED`. +- Next include the User_SetupXX_XXXX.h file that maches your configuration. +Your code now looks like this: + +### 4. Include header +Add the line `#include `at the top of your files. + +Enjoy! ;) \ No newline at end of file