|
3 | 3 |
|
4 | 4 | --- |
5 | 5 |
|
6 | | -**This library must be built with the latest esp-idf master branch and xtensa toolchain** |
7 | | - |
8 | | -If you are using the esp-idf v2.1, checkout the commit *0518df81a6566820352dad7bf6c539995d41ad18* |
| 6 | +**This library must be built with the esp-idf release/v4.0 branch and xtensa toolchain** |
9 | 7 |
|
10 | 8 | --- |
11 | 9 |
|
@@ -152,7 +150,7 @@ Full **demo application**, well documented, is included, please **analyze it** t |
152 | 150 | | GND | GND | Power supply ground | |
153 | 151 | | 3.3V or +5V | Vcc | Power supply positive | |
154 | 152 |
|
155 | | -**Make shure the display module has 3.3V compatible interface, if not you must use level shifter!** |
| 153 | +**Make sure the display module has 3.3V compatible interface, if not you must use level shifter!** |
156 | 154 |
|
157 | 155 | --- |
158 | 156 |
|
@@ -189,24 +187,65 @@ Using *make menuconfig* **select tick rate 1000** ( → Component config → Fre |
189 | 187 |
|
190 | 188 | --- |
191 | 189 |
|
192 | | -#### How to build |
| 190 | +#### Installing as Library |
| 191 | +This repository is intended to be installable as a component library using the ESP-IDF 4.0 build system. |
| 192 | + |
| 193 | +It is recommended though that you first follow the [demo instructions](#building-the-demo) below to build this repository as a standalone example to validate your hardware and have a basis to learn the library features. |
| 194 | + |
| 195 | +When you are ready to incorporate it into your existing project, it is recommended to: |
| 196 | + |
| 197 | +```shell |
| 198 | +mkdir -p externals |
| 199 | +git submodule add https://github.com/jeremyjh/ESP32_TFT_library.git externals/ESP32_TFT_library |
| 200 | +``` |
| 201 | + |
| 202 | +In your project's root CMakeLists.txt add the components folder to `EXTRA_COMPONENT_DIRS` - make sure this is before the project() config e.g. |
193 | 203 |
|
194 | | -Configure your esp32 build environment as for **esp-idf examples** |
| 204 | +```cmake |
| 205 | +cmake_minimum_required(VERSION 3.5) |
195 | 206 |
|
196 | | -Clone the repository |
| 207 | +include($ENV{IDF_PATH}/tools/cmake/project.cmake) |
| 208 | + set(EXTRA_COMPONENT_DIRS |
| 209 | + externals/ESP32_TFT_library/components) |
197 | 210 |
|
198 | | -`git clone https://github.com/loboris/ESP32_TFT_library.git` |
| 211 | +project(hello-world) |
| 212 | +``` |
| 213 | + |
| 214 | +In your own components/<my-component>/CMakeLists.txt or main/CMakeLists.txt add `tft` and `spiffs` (if you are using spiffs) as `REQUIRES` e.g. |
| 215 | + |
| 216 | +```cmake |
| 217 | +set(SOURCES tft_demo.c) |
| 218 | +idf_component_register( |
| 219 | + SRCS ${SOURCES} |
| 220 | + INCLUDE_DIRS |
| 221 | + ${CMAKE_CURRENT_LIST_DIR} |
| 222 | + $ENV{IDF_PATH}/components |
| 223 | + REQUIRES |
| 224 | + tft |
| 225 | + spiffs |
| 226 | +) |
| 227 | +``` |
| 228 | + |
| 229 | +--- |
| 230 | + |
| 231 | +#### Building the Demo |
| 232 | + |
| 233 | +Clone the repository to your esp folder (same level as esp-idf, as explained [in instructions](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/index.html)). |
| 234 | + |
| 235 | +`git clone https://github.com/jeremyjh/ESP32_TFT_library.git` |
199 | 236 |
|
200 | 237 | Execute `idf.py menuconfig` and configure your Serial flash config and other settings. Included *sdkconfig.defaults* sets some defaults to be used. |
201 | 238 |
|
202 | | -Navigate to **Components -> TFT Display** and set **display** options or select a pre-defined display configuration for a kit. |
| 239 | +Navigate to **Components -> TFT Display** and set **display and pin** options or select a pre-defined display configuration for a kit. |
203 | 240 |
|
204 | 241 | To enable **Wifi** in the demo (recommended - gets time from NTP), select **TFT Display DEMO Configuration** from the top-level menu and select those options. |
205 | 242 |
|
206 | 243 | Make and flash the example. |
207 | 244 |
|
208 | 245 | `idf.py build && idf.py -p <PORT> flash monitor` |
209 | 246 |
|
| 247 | +Deploy the SPIFFS image as below to make the image and font examples work. |
| 248 | + |
210 | 249 | --- |
211 | 250 |
|
212 | 251 | #### Prepare **SPIFFS** image |
|
0 commit comments