├── .cproject ├── .github ├── ISSUE_TEMPLATE │ └── issue-template.md ├── auto-comment.yml ├── stale.yml └── workflows │ └── build.yml ├── .gitignore ├── .gitmodules ├── .settings ├── language.settings.xml └── org.eclipse.cdt.core.prefs ├── CMakeLists.txt ├── LICENSE ├── Makefile ├── PRECONFIGURED_KITS.md ├── README.md ├── components └── lv_examples │ ├── CMakeLists.txt │ ├── Kconfig │ ├── component.mk │ └── lv_ex_conf.h ├── images ├── ESP32_DevkitV1_30_GPIO.png ├── esp_wrover_kit.jpg ├── m5stack.jpg ├── m5stick.jpg ├── m5stickc.jpg ├── menu-component.png ├── menu-lvgl.png ├── menu-main.png ├── menu-pins-tp.png ├── menu-pins.png ├── menu-predefined-displays.png ├── menu-predefined.png ├── new_lvgl_options.png ├── new_mono.jpg ├── new_photo.jpg ├── screenshot.jpg ├── sparkfun_adafruit.png ├── ssd1306_wemos_lolin.jpg ├── ssd1306_wemos_lolin_configuration.png ├── tft_backlight_control.png ├── tft_controllers_options.png ├── tft_display_controller.png ├── tft_pin_assignments.png ├── tft_predefined_board_pinouts.png ├── tft_predefined_display_config.png ├── tft_spi_bus.png ├── tft_width_height.png ├── touch_controllers_options.png ├── touch_menu.png ├── touch_pinout.png ├── touch_spi_bus.png └── touch_touch_panel_config.png ├── main ├── CMakeLists.txt ├── component.mk └── main.c └── scripts ├── code-format.cfg └── run-code-format.sh /.cproject: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | make 88 | 89 | flash 90 | true 91 | true 92 | true 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/issue-template.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug reports 3 | about: Questions and enhancement requests should go to the forum. 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | We use GitHub issues for development related discussions. 11 | Please use the [forum](https://forum.lvgl.io/) to ask questions. 12 | 13 | **Describe the issue** 14 | 15 | **Code to reproduce the issue** 16 | 17 | **Expected Results** 18 | 19 | **Actual Results** 20 | 21 | **ESP32 Chip version** 22 | 23 | **ESP-IDF version** 24 | 25 | **Development kit used** 26 | 27 | **Development machine OS** 28 | 29 | **Compilation warnings/errors (if available)** 30 | 31 | **If possible, copy the compilation log into a file and attach it here** 32 | 33 | -------------------------------------------------------------------------------- /.github/auto-comment.yml: -------------------------------------------------------------------------------- 1 | # Comment to a new issue. 2 | pullRequestOpened: | 3 | Thank you for raising your pull request. 4 | 5 | To ensure that all licensing criteria is met all repositories of the LVGL project apply a process called DCO (Developer's Certificate of Origin). 6 | 7 | The text of DCO can be read here: https://developercertificate.org/ 8 | For a more detailed description see the [Documentation](https://docs.lvgl.io/latest/en/html/contributing/index.html#developer-certification-of-origin-dco) site. 9 | 10 | By contributing to any repositories of the LVGL project you state that your contribution corresponds with the DCO. 11 | 12 | No further action is required if your contribution fulfills the DCO. If you are not sure about it feel free to ask us in a comment. 13 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 21 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 7 5 | # Issues with these labels will never be considered stale 6 | exemptLabels: 7 | - architecture 8 | - pinned 9 | # Label to use when marking an issue as stale 10 | staleLabel: stale 11 | # Comment to post when marking an issue as stale. Set to `false` to disable 12 | markComment: > 13 | This issue or pull request has been automatically marked as stale because it has not had 14 | recent activity. It will be closed if no further activity occurs. Thank you 15 | for your contributions. 16 | # Comment to post when closing a stale issue. Set to `false` to disable 17 | closeComment: false 18 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: 'build' 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build: 7 | strategy: 8 | matrix: 9 | idf_ver: ["v4.1", "v4.2", "v4.3"] 10 | idf_target: ["esp32"] 11 | include: 12 | - idf_ver: "v4.2" 13 | idf_target: esp32s2 14 | # TODO: enable C3 build 15 | #- idf_ver: "v4.3" 16 | # idf_target: esp32c3 17 | runs-on: ubuntu-latest 18 | container: espressif/idf:release-${{ matrix.idf_ver }} 19 | steps: 20 | - uses: actions/checkout@v1 21 | with: 22 | submodules: true 23 | - name: Build for ESP32 24 | env: 25 | IDF_TARGET: ${{ matrix.idf_target }} 26 | shell: bash 27 | run: | 28 | . ${IDF_PATH}/export.sh 29 | idf.py build 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Object files 5 | *.o 6 | *.ko 7 | *.obj 8 | *.elf 9 | 10 | # Linker output 11 | *.ilk 12 | *.map 13 | *.exp 14 | 15 | # Precompiled Headers 16 | *.gch 17 | *.pch 18 | 19 | # Libraries 20 | *.lib 21 | *.a 22 | *.la 23 | *.lo 24 | 25 | # Shared objects (inc. Windows DLLs) 26 | *.dll 27 | *.so 28 | *.so.* 29 | *.dylib 30 | 31 | # Executables 32 | *.exe 33 | *.out 34 | *.app 35 | *.i*86 36 | *.x86_64 37 | *.hex 38 | 39 | # Debug files 40 | *.dSYM/ 41 | *.su 42 | *.idb 43 | *.pdb 44 | 45 | # Kernel Module Compile Results 46 | *.mod* 47 | *.cmd 48 | .tmp_versions/ 49 | modules.order 50 | Module.symvers 51 | Mkfile.old 52 | dkms.conf 53 | 54 | # OS files 55 | .DS_Store 56 | 57 | build/ 58 | sdkconfig.old 59 | sdkconfig 60 | 61 | # Jetbrains CLion IDE 62 | cmake-build-debug/ 63 | .idea/ 64 | 65 | # PlatformIO 66 | .pio/ 67 | platformio.ini 68 | 69 | # VS Code 70 | .vscode/ 71 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "lv_examples"] 2 | path = components/lv_examples/lv_examples 3 | url = https://github.com/littlevgl/lv_examples.git 4 | branch = release/v7 5 | [submodule "components/lvgl_esp32_drivers"] 6 | path = components/lvgl_esp32_drivers 7 | url = https://github.com/lvgl/lvgl_esp32_drivers.git 8 | [submodule "components/lvgl"] 9 | path = components/lvgl 10 | url = https://github.com/lvgl/lvgl.git 11 | -------------------------------------------------------------------------------- /.settings/language.settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.settings/org.eclipse.cdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1013439379/append=true 3 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1013439379/appendContributed=true 4 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1257239843/V/delimiter=\: 5 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1257239843/V/operation=append 6 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1257239843/V/value=1 7 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1257239843/append=true 8 | environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1257239843/appendContributed=true 9 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.5) 2 | 3 | if (NOT DEFINED PROJECT_NAME) 4 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 5 | project(lvgl-demo) 6 | else() 7 | message(FATAL_ERROR "LV PORT ESP32: This must be a project's main CMakeLists.txt.") 8 | endif() 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Littlev Graphics Library 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 3 | # project subdirectory. 4 | # 5 | 6 | PROJECT_NAME := lvgl-demo 7 | include $(IDF_PATH)/make/project.mk 8 | -------------------------------------------------------------------------------- /PRECONFIGURED_KITS.md: -------------------------------------------------------------------------------- 1 | # Preconfigured Kits 2 | 3 | 4 | ### ESP-Wrover-Kit v4.1 5 | 6 | ![Example GUI with LittlevGL on ESP32](images/esp_wrover_kit.jpg) 7 | 8 | This board comes with an embedded TFT screen with the **ILI9341** display driver and it doesn't have touch screen. The screen size is 320 x 240 px. 9 | 10 | ### M5Stack 11 | 12 | ![Example GUI with LittlevGL on ESP32](images/m5stack.jpg) 13 | 14 | This board comes with an embedded TFT screen with the **ILI9341** display driver and it doesn't have touch screen. The screen size is 240 x 320px. 15 | 16 | ### M5Stick 17 | 18 | ![Example GUI with LittlevGL on ESP32](images/m5stick.jpg) 19 | 20 | This board comes with an embedded OLED screen with the **SH1107** monochrome display driver and it doesn't have touch screen. The screen size is 128 x 64px. 21 | 22 | ### M5StickC 23 | 24 | ![Example GUI with LittlevGL on ESP32](images/m5stickc.jpg) 25 | 26 | This board comes with an embedded OLED screen with the **ST7735S** color display driver and it doesn't have touch screen. The screen size is 160x80px. This board uses an Power Management IC AXP192 (using I2C), thus you can configure during menuconfig to let LVGL turn on the power or take care on your own by disabling this feature. 27 | 28 | 29 | ### WEMOS LOLIN ESP32 OLED 30 | 31 | ![Example GUI with LittlevGL on ESP32](images/ssd1306_wemos_lolin.jpg) 32 | 33 | This board comes with an embedded OLED screen with the **SSD1306** monochrome display driver and it doesn't have touch screen. The screen size is 128 x 64px. 34 | 35 | ## Predefined Board Pinouts 36 | 37 | ![Predefines](images/tft_predefined_board_pinouts.png) 38 | 39 | When wiring the display and touchpad (if applicable) it is best to use the board's designated HSPI and VSPI pins to take advantage of the hardware SPI support. Several board configurations are available; select the appropriate board in the "Select predefined board pinouts" menu in `menuconfig` and then wire the display and touchpad accordingly. 40 | 41 | ## ESP32 Dev Board with 38 GPIOs 42 | 43 | ![Example GUI with LittlevGL on ESP32](images/screenshot.jpg) 44 | 45 | ### ILI9341 - HSPI 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 |
MOSICLKCSDCRSTBCKL
13145191823
64 | 65 | ### XPT2046 - VSPI 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 |
MOSIMISOCLKCSIRQ
3235263325
83 | 84 | ## ESP32 DevKit v1 with 30 GPIOS 85 | 86 | There is another development kit with only 30 GPIOs available: 87 | 88 | ![LittlevGL on ESP32 Kit with 30 GPIO](images/ESP32_DevkitV1_30_GPIO.png) 89 | 90 | ### ILI9341 91 | 92 | For ILI9341 HSPI is used, modify the pin configuration in `components/drv/disp_spi.h` to: 93 | 94 | ### ILI9341 - HSPI 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 |
MOSICLKCSDCRSTBCKL
1314152421
113 | 114 | ### XPT2046 - VSPI 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 |
MOSIMISOCLKCSIRQ
231918525
132 | 133 | ## ESP32 DevKit v4 with 38 GPIOS 134 | 135 | See this pdf for further information: https://www.espressif.com/sites/default/files/documentation/esp32-wroom-32d_esp32-wroom-32u_datasheet_en.pdf 136 | 137 | ### ILI9341 - HSPI 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 |
MOSICLKCSDCRSTBCKL
131415172526
156 | 157 | ### XPT2046 - VSPI 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 |
MOSIMISOCLKCSIRQ
231918527
175 | 176 | ## Sparkfun ESP32 Thing Plus with Adafruit 3.5" 480x320 TFT Featherwing 177 | 178 | [Sparkfun ESP32 Thing Plus](https://www.sparkfun.com/products/15663) 179 | 180 | [Adafruit 3.5" 480x320 TFT Featherwing](https://www.adafruit.com/product/3651) 181 | 182 | ![Sparkfun and Adafruit - together at last!](images/sparkfun_adafruit.png) 183 | 184 | The Adafruit Featherwing board uses a HX8357D TFT display controller and a STMPE610 resistive touch controller. Both are hardwired to the same SPI bus (VSPI). The STMPE610 is a strange little beast that configures its SPI mode based on the logic levels on MISO and CS during its power-on reset. The CS signal has a pull-up but the MISO is floating. It appears that it is usually sampled low (setting SPI Mode 1) but you may find you need a pull-down resistor from MISO to ground. A 47-kohm resistor will work fine. The TFT reset and backlight pins are not connected (hardwired on the Featherwing). There is no touchpad IRQ. These signals are connected to unused signals in the following configuration. Note that although I used a Sparkfun ESP32 board, the Adafruit ESP32 featherwing should work identically. 185 | 186 | ### HX8357D - VSPI 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 |
MOSICLKCSDCRSTBCKL
185153342
205 | 206 | ### STMPE610 - VSPI 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 |
MOSIMISOCLKCSIRQ
181953225
224 | 225 | 226 | 227 | ## Other Boards 228 | 229 | Of course, all the individual pins can be configured in `menuconfig` if the available predefined options don't match your board or project requirements. By default the predefined options are disabled and pin settings for the 30 pin dev board are defaulted. 230 | 231 | ### Reference Pinout for the Predefined Boards 232 | 233 | As a reference the assigned pins for the predefined boards is given below. 234 | 235 | ### M5Stack 236 | 237 | You can choose between the predefined board for M5Stick, or use the predefined board pinouts, choose ILI9341 display controller and configure other options. 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 |
MOSICLKCSDCRSTBCKL
231814273332
257 | 258 | 259 | ### M5Stick 260 | 261 | You can choose between the predefined board for M5Stick, or use the predefined board pinouts, choose SH1107 display controller and configure other options. 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 |
MOSICLKCSDCRST
2318142733
279 | 280 | ### M5StickC 281 | 282 | You can choose between the predefined board for M5StickC, or use the predefined board pinouts, choose ST7735S display controller and configure other options. 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 |
MOSICLKCSDCRST
151352318
300 | 301 | Also, the power management IC AXP192 can be configured with the following I2C GPIO. 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 |
SDASCL
2122
312 | 313 | ### WEMOS LOLIN 314 | 315 | You can choose between the predefined board for WEMOS LOLIN, or use the predefined board pinouts, choose SSD1306 display controller and configure other options. 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 |
SDASCL
54
327 | 328 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LVGL project for ESP32 2 | 3 | This is an ESP32 demo project showcasing LVGL v7 with support for several display controllers and touch controllers. 4 | The demo application is the `lv_demo_widgets` project from the [lv_examples](https://github.com/lvgl/lv_examples) repository. 5 | 6 | - Version of ESP-IDF required 4.2. NOTE: We're trying to make this repo backwards compatible, usage of idf.py is encouraged. 7 | - Version of LVGL used: 7.9. 8 | - Version of lv_examples used: 7.9. 9 | 10 | #### Table of content 11 | - [Get started](#get-started) 12 | - [Use LVGL in your ESP-IDF project](#use-lvgl-in-your-esp-idf-project) 13 | - [Use lvgl_esp32_drivers in your project](#use-lvgl_esp32_drivers-in-your-project) 14 | - [Platformio support](#platformio-support) 15 | - [ESP32-S2 Support](#esp32-s2-support) 16 | 17 | Example demo for TFT displays: 18 | 19 | ![Example GUI_DEMO with ESP32 using LVGL](images/new_photo.jpg) 20 | 21 | Monochrome support: 22 | 23 | ![Example_monochrome demo with ESP32 using LVGL](images/new_mono.jpg) 24 | 25 | ## Display and touch controllers 26 | 27 | The display and touch (indev) controllers are now into it's own repository, you can find it [here](https://github.com/lvgl/lvgl_esp32_drivers). 28 | To report any issue or add new display or touch (indev) drivers you can do so in the `lvgl_esp32_drivers` repo. 29 | 30 | ## Get started 31 | 32 | ### Prerequisites 33 | 34 | - ESP-IDF Framework. 35 | 36 | ### Note 37 | 38 | This project tries to be compatible with both the ESP-IDF v3.x and v4.0, but using v4.0 is recommended. 39 | Instructions assume you are using the v4.x toolchain, otherwise use the make commands, e.g. instead of running `idf.py menuconfig`, run `make menuconfig`. 40 | 41 | ### Build and run the demo. 42 | 43 | 1. Clone this project by `git clone --recurse-submodules https://github.com/lvgl/lv_port_esp32.git`, this will pull this repo and its submodules. 44 | 45 | 2. Get into the created `lv_port_esp32` directory. 46 | 47 | 3. Run `idf.py menuconfig` 48 | 49 | 4. Configure LVGL in `Components config->LVGL Configuration`. For monochrome displays use the mono theme and we suggest enabling the `unscii 8` font. 50 | 51 | 5. Configure your display and/or touch controllers in `Components config->LVGL TFT Display Configuration` and `Components config->LVGL TOUCH Configuration`. 52 | 53 | 6. Store your project configuration. 54 | 55 | 7. Build the project with `idf.py build` 56 | 57 | 8. If the build don't throw any errors, flash the demo with `idf.py -p (YOUR SERIAL PORT) flash` (with `make` this is just `make flash` - in 3.x PORT is configured in `menuconfig`) 58 | 59 | ## Use LVGL in your ESP-IDF project 60 | 61 | LVGL now includes a Kconfig file which is used to configure most of the LVGL configuration options via menuconfig, so it's not necessary to use a custom `lv_conf.h` file. 62 | 63 | It is recommended to add LVGL as a submodule in your IDF project's git repo. 64 | 65 | From your project's root directory: 66 | 1. Create a directory named `components` (if you don't have one already) with `mkdir -p components`. 67 | 2. Clone the lvgl repository inside the `components` directory with `git submodule add https://github.com/lvgl/lvgl.git components/lvgl` 68 | 3. Run `idf.py menuconfig`, go to `Component config` then `LVGL configuration` to configure LVGL. 69 | 70 | ## Use lvgl_esp32_drivers in your project 71 | 72 | It is recommended to add [lvgl_esp32_drivers](https://github.com/lvgl/lvgl_esp32_drivers) as a submodule in your IDF project's git repo. 73 | 74 | From your project's root directory: 75 | 1. Create a directory named `components` (if you don't have one already) with `mkdir -p components`. 76 | 2. Clone the lvgl_esp32_drivers repository inside the `components` directory with `git submodule add https://github.com/lvgl/lvgl_esp32_drivers.git components/lvgl_esp32_drivers` 77 | 3. Run `idf.py menuconfig`, go to `Component config` then `LVGL TFT configuration` and `LVGL TFT Display configuration` to configure lvgl_esp32_drivers. 78 | 79 | ## Platformio support 80 | 81 | Using the [lv_platformio](https://github.com/lvgl/lv_platformio) project add the following lines to `platformio.ini` file: 82 | 83 | ``` 84 | [env:esp32] 85 | platform = espressif32 86 | framework = espidf 87 | board = esp-wrover-kit 88 | ``` 89 | 90 | Change the default environment to `default_envs = esp32`. 91 | 92 | Modify the `main.c` like this: 93 | 94 | ```c 95 | #include "lvgl.h" 96 | 97 | // #include "driver.h" 98 | 99 | #include "demo.h" 100 | 101 | int app_main(void) 102 | { 103 | lv_init(); 104 | 105 | /* Initialize your hardware. */ 106 | 107 | /* hw_init(); */ 108 | 109 | demo_create(); 110 | 111 | /* Create the UI or start a task for it. 112 | * In the end, don't forget to call `lv_task_handler` in a loop. */ 113 | 114 | /* hw_loop(); */ 115 | 116 | return 0; 117 | } 118 | ``` 119 | 120 | For more information see: [platformio with espidf framework compability](https://github.com/lvgl/lv_port_esp32/issues/168). 121 | 122 | # ESP32-S2 Support 123 | 124 | Support for ESP32-S2 variant is Work In Progress. 125 | Smaller displays (e.g. 320x240) work fine, but larger ones need testing. 126 | 127 | ## Background 128 | 129 | ESP32-S2 has less on-chip SRAM than its predecessor ESP32 (520kB vs. 320kB). 130 | This causes problems with memory allocation with large LVGL display buffers as they don't fit into the on-chip memory 131 | and external PSRAM is not accessible by DMA. 132 | 133 | Moreover, static allocation to external PSRAM is not yet supported 134 | (see [GitHub issue](https://github.com/espressif/esp-idf/issues/6162)). 135 | 136 | At this momement, the buffers are dynamicaly allocated with DMA capabilty and memory allocator handles the rest. 137 | -------------------------------------------------------------------------------- /components/lv_examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | if(ESP_PLATFORM) 2 | 3 | file(GLOB_RECURSE SOURCES lv_examples/*.c) 4 | 5 | idf_component_register(SRCS ${SOURCES} 6 | INCLUDE_DIRS . 7 | REQUIRES lvgl) 8 | 9 | else() 10 | message(FATAL_ERROR "LVGL LV examples: ESP_PLATFORM is not defined. Try reinstalling ESP-IDF.") 11 | endif() 12 | -------------------------------------------------------------------------------- /components/lv_examples/Kconfig: -------------------------------------------------------------------------------- 1 | # Kconfig for lv_examples v7.4.0 2 | 3 | menu "lv_examples configuration" 4 | 5 | config LV_EX_PRINTF 6 | bool "Enable printf-ing data in demos and examples." 7 | 8 | choice LV_EX_CHOICE 9 | prompt "Select the demo you want to run." 10 | default LV_USE_DEMO_WIDGETS 11 | 12 | config LV_USE_DEMO_WIDGETS 13 | bool "Show demo widgets." 14 | 15 | config LV_USE_DEMO_KEYPAD_AND_ENCODER 16 | bool "Demonstrate the usage of encoder and keyboard." 17 | 18 | config LV_USE_DEMO_BENCHMARK 19 | bool "Benchmark your system." 20 | 21 | config LV_USE_DEMO_STRESS 22 | bool "Stress test for LVGL." 23 | endchoice 24 | 25 | config LV_DEMO_WIDGETS_SLIDESHOW 26 | bool "Slide demo widgets automatically." 27 | depends on LV_USE_DEMO_WIDGETS 28 | default y 29 | endmenu 30 | -------------------------------------------------------------------------------- /components/lv_examples/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Component Makefile 3 | # 4 | 5 | CFLAGS += -DLV_LVGL_H_INCLUDE_SIMPLE 6 | 7 | COMPONENT_SRCDIRS := lv_examples \ 8 | lv_examples/src/lv_demo_benchmark \ 9 | lv_examples/src/lv_demo_keypad_encoder \ 10 | lv_examples/src/demo_stress \ 11 | lv_examples/src/lv_demo_widgets \ 12 | lv_examples/src/lv_ex_style \ 13 | lv_examples/src/lv_ex_widgets \ 14 | lv_examples/assets 15 | 16 | COMPONENT_ADD_INCLUDEDIRS := $(COMPONENT_SRCDIRS) . 17 | -------------------------------------------------------------------------------- /components/lv_examples/lv_ex_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @file lv_ex_conf.h 3 | * Configuration file for v7.4.0 4 | * 5 | */ 6 | /* 7 | * COPY THIS FILE AS lv_ex_conf.h 8 | */ 9 | 10 | #if 1 /*Set it to "1" to enable the content*/ 11 | 12 | #ifndef LV_EX_CONF_H 13 | #define LV_EX_CONF_H 14 | 15 | 16 | /******************* 17 | * GENERAL SETTING 18 | *******************/ 19 | 20 | /* Enable printf-ing data in demoes and examples */ 21 | #ifdef CONFIG_LV_EX_PRINTF 22 | #define LV_EX_PRINTF 1 23 | #else 24 | #define LV_EX_PRINTF 0 25 | #endif 26 | 27 | #define LV_EX_KEYBOARD 0 /*Add PC keyboard support to some examples (`lv_drivers` repository is required)*/ 28 | #define LV_EX_MOUSEWHEEL 0 /*Add 'encoder' (mouse wheel) support to some examples (`lv_drivers` repository is required)*/ 29 | 30 | /********************* 31 | * DEMO USAGE 32 | *********************/ 33 | 34 | /*Show some widget*/ 35 | #ifdef CONFIG_LV_USE_DEMO_WIDGETS 36 | #define LV_USE_DEMO_WIDGETS 1 37 | #else 38 | #define LV_USE_DEMO_WIDGETS 0 39 | #endif 40 | 41 | #if LV_USE_DEMO_WIDGETS 42 | #ifdef CONFIG_LV_DEMO_WIDGETS_SLIDESHOW 43 | #define LV_DEMO_WIDGETS_SLIDESHOW 1 44 | #else 45 | #define LV_DEMO_WIDGETS_SLIDESHOW 0 46 | #endif 47 | #endif 48 | 49 | /*Printer demo, optimized for 800x480*/ 50 | #define LV_USE_DEMO_PRINTER 0 51 | 52 | /*Demonstrate the usage of encoder and keyboard*/ 53 | #ifdef CONFIG_LV_USE_DEMO_KEYPAD_AND_ENCODER 54 | #define LV_USE_DEMO_KEYPAD_AND_ENCODER 1 55 | #else 56 | #define LV_USE_DEMO_KEYPAD_AND_ENCODER 0 57 | #endif 58 | 59 | /*Benchmark your system*/ 60 | #ifdef CONFIG_LV_USE_DEMO_BENCHMARK 61 | #define LV_USE_DEMO_BENCHMARK 1 62 | #else 63 | #define LV_USE_DEMO_BENCHMARK 0 64 | #endif 65 | 66 | /*Stress test for LVGL*/ 67 | #ifdef CONFIG_LV_USE_DEMO_STRESS 68 | #define LV_USE_DEMO_STRESS 1 69 | #else 70 | #define LV_USE_DEMO_STRESS 0 71 | 72 | #endif 73 | 74 | #endif /*LV_EX_CONF_H*/ 75 | 76 | #endif /*End of "Content enable"*/ 77 | 78 | -------------------------------------------------------------------------------- /images/ESP32_DevkitV1_30_GPIO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/ESP32_DevkitV1_30_GPIO.png -------------------------------------------------------------------------------- /images/esp_wrover_kit.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/esp_wrover_kit.jpg -------------------------------------------------------------------------------- /images/m5stack.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/m5stack.jpg -------------------------------------------------------------------------------- /images/m5stick.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/m5stick.jpg -------------------------------------------------------------------------------- /images/m5stickc.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/m5stickc.jpg -------------------------------------------------------------------------------- /images/menu-component.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/menu-component.png -------------------------------------------------------------------------------- /images/menu-lvgl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/menu-lvgl.png -------------------------------------------------------------------------------- /images/menu-main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/menu-main.png -------------------------------------------------------------------------------- /images/menu-pins-tp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/menu-pins-tp.png -------------------------------------------------------------------------------- /images/menu-pins.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/menu-pins.png -------------------------------------------------------------------------------- /images/menu-predefined-displays.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/menu-predefined-displays.png -------------------------------------------------------------------------------- /images/menu-predefined.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/menu-predefined.png -------------------------------------------------------------------------------- /images/new_lvgl_options.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/new_lvgl_options.png -------------------------------------------------------------------------------- /images/new_mono.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/new_mono.jpg -------------------------------------------------------------------------------- /images/new_photo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/new_photo.jpg -------------------------------------------------------------------------------- /images/screenshot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/screenshot.jpg -------------------------------------------------------------------------------- /images/sparkfun_adafruit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/sparkfun_adafruit.png -------------------------------------------------------------------------------- /images/ssd1306_wemos_lolin.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/ssd1306_wemos_lolin.jpg -------------------------------------------------------------------------------- /images/ssd1306_wemos_lolin_configuration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/ssd1306_wemos_lolin_configuration.png -------------------------------------------------------------------------------- /images/tft_backlight_control.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/tft_backlight_control.png -------------------------------------------------------------------------------- /images/tft_controllers_options.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/tft_controllers_options.png -------------------------------------------------------------------------------- /images/tft_display_controller.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/tft_display_controller.png -------------------------------------------------------------------------------- /images/tft_pin_assignments.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/tft_pin_assignments.png -------------------------------------------------------------------------------- /images/tft_predefined_board_pinouts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/tft_predefined_board_pinouts.png -------------------------------------------------------------------------------- /images/tft_predefined_display_config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/tft_predefined_display_config.png -------------------------------------------------------------------------------- /images/tft_spi_bus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/tft_spi_bus.png -------------------------------------------------------------------------------- /images/tft_width_height.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/tft_width_height.png -------------------------------------------------------------------------------- /images/touch_controllers_options.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/touch_controllers_options.png -------------------------------------------------------------------------------- /images/touch_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/touch_menu.png -------------------------------------------------------------------------------- /images/touch_pinout.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/touch_pinout.png -------------------------------------------------------------------------------- /images/touch_spi_bus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/touch_spi_bus.png -------------------------------------------------------------------------------- /images/touch_touch_panel_config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lvgl/lv_port_esp32/cffa173c6e410965da12875103b934ec9d28f4e5/images/touch_touch_panel_config.png -------------------------------------------------------------------------------- /main/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | idf_component_register(SRCS main.c) 2 | -------------------------------------------------------------------------------- /main/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # "main" pseudo-component makefile. 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | CFLAGS+= -DLV_LVGL_H_INCLUDE_SIMPLE 7 | -------------------------------------------------------------------------------- /main/main.c: -------------------------------------------------------------------------------- 1 | /* LVGL Example project 2 | * 3 | * Basic project to test LVGL on ESP32 based projects. 4 | * 5 | * This example code is in the Public Domain (or CC0 licensed, at your option.) 6 | * 7 | * Unless required by applicable law or agreed to in writing, this 8 | * software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 9 | * CONDITIONS OF ANY KIND, either express or implied. 10 | */ 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include "freertos/FreeRTOS.h" 17 | #include "freertos/task.h" 18 | #include "esp_freertos_hooks.h" 19 | #include "freertos/semphr.h" 20 | #include "esp_system.h" 21 | #include "driver/gpio.h" 22 | 23 | /* Littlevgl specific */ 24 | #ifdef LV_LVGL_H_INCLUDE_SIMPLE 25 | #include "lvgl.h" 26 | #else 27 | #include "lvgl/lvgl.h" 28 | #endif 29 | 30 | #include "lvgl_helpers.h" 31 | 32 | #ifndef CONFIG_LV_TFT_DISPLAY_MONOCHROME 33 | #if defined CONFIG_LV_USE_DEMO_WIDGETS 34 | #include "lv_examples/src/lv_demo_widgets/lv_demo_widgets.h" 35 | #elif defined CONFIG_LV_USE_DEMO_KEYPAD_AND_ENCODER 36 | #include "lv_examples/src/lv_demo_keypad_encoder/lv_demo_keypad_encoder.h" 37 | #elif defined CONFIG_LV_USE_DEMO_BENCHMARK 38 | #include "lv_examples/src/lv_demo_benchmark/lv_demo_benchmark.h" 39 | #elif defined CONFIG_LV_USE_DEMO_STRESS 40 | #include "lv_examples/src/lv_demo_stress/lv_demo_stress.h" 41 | #else 42 | #error "No demo application selected." 43 | #endif 44 | #endif 45 | 46 | /********************* 47 | * DEFINES 48 | *********************/ 49 | #define TAG "demo" 50 | #define LV_TICK_PERIOD_MS 1 51 | 52 | /********************** 53 | * STATIC PROTOTYPES 54 | **********************/ 55 | static void lv_tick_task(void *arg); 56 | static void guiTask(void *pvParameter); 57 | static void create_demo_application(void); 58 | 59 | /********************** 60 | * APPLICATION MAIN 61 | **********************/ 62 | void app_main() { 63 | 64 | /* If you want to use a task to create the graphic, you NEED to create a Pinned task 65 | * Otherwise there can be problem such as memory corruption and so on. 66 | * NOTE: When not using Wi-Fi nor Bluetooth you can pin the guiTask to core 0 */ 67 | xTaskCreatePinnedToCore(guiTask, "gui", 4096*2, NULL, 0, NULL, 1); 68 | } 69 | 70 | /* Creates a semaphore to handle concurrent call to lvgl stuff 71 | * If you wish to call *any* lvgl function from other threads/tasks 72 | * you should lock on the very same semaphore! */ 73 | SemaphoreHandle_t xGuiSemaphore; 74 | 75 | static void guiTask(void *pvParameter) { 76 | 77 | (void) pvParameter; 78 | xGuiSemaphore = xSemaphoreCreateMutex(); 79 | 80 | lv_init(); 81 | 82 | /* Initialize SPI or I2C bus used by the drivers */ 83 | lvgl_driver_init(); 84 | 85 | lv_color_t* buf1 = heap_caps_malloc(DISP_BUF_SIZE * sizeof(lv_color_t), MALLOC_CAP_DMA); 86 | assert(buf1 != NULL); 87 | 88 | /* Use double buffered when not working with monochrome displays */ 89 | #ifndef CONFIG_LV_TFT_DISPLAY_MONOCHROME 90 | lv_color_t* buf2 = heap_caps_malloc(DISP_BUF_SIZE * sizeof(lv_color_t), MALLOC_CAP_DMA); 91 | assert(buf2 != NULL); 92 | #else 93 | static lv_color_t *buf2 = NULL; 94 | #endif 95 | 96 | static lv_disp_buf_t disp_buf; 97 | 98 | uint32_t size_in_px = DISP_BUF_SIZE; 99 | 100 | #if defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_IL3820 \ 101 | || defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_JD79653A \ 102 | || defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_UC8151D \ 103 | || defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_SSD1306 104 | 105 | /* Actual size in pixels, not bytes. */ 106 | size_in_px *= 8; 107 | #endif 108 | 109 | /* Initialize the working buffer depending on the selected display. 110 | * NOTE: buf2 == NULL when using monochrome displays. */ 111 | lv_disp_buf_init(&disp_buf, buf1, buf2, size_in_px); 112 | 113 | lv_disp_drv_t disp_drv; 114 | lv_disp_drv_init(&disp_drv); 115 | disp_drv.flush_cb = disp_driver_flush; 116 | 117 | #if defined CONFIG_DISPLAY_ORIENTATION_PORTRAIT || defined CONFIG_DISPLAY_ORIENTATION_PORTRAIT_INVERTED 118 | disp_drv.rotated = 1; 119 | #endif 120 | 121 | /* When using a monochrome display we need to register the callbacks: 122 | * - rounder_cb 123 | * - set_px_cb */ 124 | #ifdef CONFIG_LV_TFT_DISPLAY_MONOCHROME 125 | disp_drv.rounder_cb = disp_driver_rounder; 126 | disp_drv.set_px_cb = disp_driver_set_px; 127 | #endif 128 | 129 | disp_drv.buffer = &disp_buf; 130 | lv_disp_drv_register(&disp_drv); 131 | 132 | /* Register an input device when enabled on the menuconfig */ 133 | #if CONFIG_LV_TOUCH_CONTROLLER != TOUCH_CONTROLLER_NONE 134 | lv_indev_drv_t indev_drv; 135 | lv_indev_drv_init(&indev_drv); 136 | indev_drv.read_cb = touch_driver_read; 137 | indev_drv.type = LV_INDEV_TYPE_POINTER; 138 | lv_indev_drv_register(&indev_drv); 139 | #endif 140 | 141 | /* Create and start a periodic timer interrupt to call lv_tick_inc */ 142 | const esp_timer_create_args_t periodic_timer_args = { 143 | .callback = &lv_tick_task, 144 | .name = "periodic_gui" 145 | }; 146 | esp_timer_handle_t periodic_timer; 147 | ESP_ERROR_CHECK(esp_timer_create(&periodic_timer_args, &periodic_timer)); 148 | ESP_ERROR_CHECK(esp_timer_start_periodic(periodic_timer, LV_TICK_PERIOD_MS * 1000)); 149 | 150 | /* Create the demo application */ 151 | create_demo_application(); 152 | 153 | while (1) { 154 | /* Delay 1 tick (assumes FreeRTOS tick is 10ms */ 155 | vTaskDelay(pdMS_TO_TICKS(10)); 156 | 157 | /* Try to take the semaphore, call lvgl related function on success */ 158 | if (pdTRUE == xSemaphoreTake(xGuiSemaphore, portMAX_DELAY)) { 159 | lv_task_handler(); 160 | xSemaphoreGive(xGuiSemaphore); 161 | } 162 | } 163 | 164 | /* A task should NEVER return */ 165 | free(buf1); 166 | #ifndef CONFIG_LV_TFT_DISPLAY_MONOCHROME 167 | free(buf2); 168 | #endif 169 | vTaskDelete(NULL); 170 | } 171 | 172 | static void create_demo_application(void) 173 | { 174 | /* When using a monochrome display we only show "Hello World" centered on the 175 | * screen */ 176 | #if defined CONFIG_LV_TFT_DISPLAY_MONOCHROME || \ 177 | defined CONFIG_LV_TFT_DISPLAY_CONTROLLER_ST7735S 178 | 179 | /* use a pretty small demo for monochrome displays */ 180 | /* Get the current screen */ 181 | lv_obj_t * scr = lv_disp_get_scr_act(NULL); 182 | 183 | /*Create a Label on the currently active screen*/ 184 | lv_obj_t * label1 = lv_label_create(scr, NULL); 185 | 186 | /*Modify the Label's text*/ 187 | lv_label_set_text(label1, "Hello\nworld"); 188 | 189 | /* Align the Label to the center 190 | * NULL means align on parent (which is the screen now) 191 | * 0, 0 at the end means an x, y offset after alignment*/ 192 | lv_obj_align(label1, NULL, LV_ALIGN_CENTER, 0, 0); 193 | #else 194 | /* Otherwise we show the selected demo */ 195 | 196 | #if defined CONFIG_LV_USE_DEMO_WIDGETS 197 | lv_demo_widgets(); 198 | #elif defined CONFIG_LV_USE_DEMO_KEYPAD_AND_ENCODER 199 | lv_demo_keypad_encoder(); 200 | #elif defined CONFIG_LV_USE_DEMO_BENCHMARK 201 | lv_demo_benchmark(); 202 | #elif defined CONFIG_LV_USE_DEMO_STRESS 203 | lv_demo_stress(); 204 | #else 205 | #error "No demo application selected." 206 | #endif 207 | #endif 208 | } 209 | 210 | static void lv_tick_task(void *arg) { 211 | (void) arg; 212 | 213 | lv_tick_inc(LV_TICK_PERIOD_MS); 214 | } 215 | -------------------------------------------------------------------------------- /scripts/code-format.cfg: -------------------------------------------------------------------------------- 1 | --style=kr 2 | --indent=spaces=4 3 | --indent-classes 4 | --indent-switches 5 | --indent-cases 6 | --indent-preproc-block 7 | --indent-preproc-define 8 | --indent-col1-comments 9 | --pad-oper 10 | --unpad-paren 11 | --align-pointer=middle 12 | --align-reference=middle 13 | --convert-tabs 14 | --max-code-length=120 15 | --break-after-logical 16 | --break-closing-braces 17 | --attach-closing-while 18 | --min-conditional-indent=0 19 | --max-continuation-indent=120 20 | --mode=c 21 | --lineend=linux 22 | --recursive 23 | --suffix=none 24 | --preserve-date 25 | --formatted 26 | -------------------------------------------------------------------------------- /scripts/run-code-format.sh: -------------------------------------------------------------------------------- 1 | astyle --options=code-format.cfg "../main/*.c" 2 | astyle --options=code-format.cfg "../components/lvgl_esp32_drivers/*.c,*.h" 3 | astyle --options=code-format.cfg "../components/lvgl_esp32_drivers/lvgl_tft/*.c,*.h" 4 | astyle --options=code-format.cfg "../components/lvgl_esp32_drivers/lvgl_touch/*c,*.h" 5 | --------------------------------------------------------------------------------