Example of graphical application for ESP32-C3, ESP32-P4.
Read more about Swift for ESP32 at Espressif Developer Portal.
Run the ESP32-P4 SDL3 Swift with Wokwi.com
- Swift 6.1 - https://www.swift.org/install
- ESP-IDF 5.4 - https://github.com/espressif/esp-idf
source esp-idf/export.sh
export TOOLCHAINS=$(plutil -extract CFBundleIdentifier raw /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-10-30-a.xctoolchain/Info.plist)
idf.py @boards/esp32_p4_function_ev_board.cfg flash monitor
idf.py @boards/esp32_c3_lcdkit.cfg flash monitor
The configuration of this board is based on ESP-BSP Generic which allows configuration using menuconfig.
SPI Display configuration:
CONFIG_BSP_DISPLAY_ENABLED=y
CONFIG_BSP_DISPLAY_SCLK_GPIO=6
CONFIG_BSP_DISPLAY_MOSI_GPIO=7
CONFIG_BSP_DISPLAY_MISO_GPIO=-1
CONFIG_BSP_DISPLAY_CS_GPIO=20
CONFIG_BSP_DISPLAY_DC_GPIO=21
CONFIG_BSP_DISPLAY_RST_GPIO=3
CONFIG_BSP_DISPLAY_DRIVER_ILI9341=y
You can change the configuration by running:
idf.py @boards/esp32_c6_devkit.cfg menuconfig
idf.py @boards/esp32_c6_devkit.cfg flash monitor
- board: ESP32-C6-LCD-1.47
- display: 172x320
idf.py @boards/waveshare-esp32-c6-lcd-1.47.cfg flash monitor
- Build the project, to get binaries for simulation.
- Install Wokwi for VS Code.
- Open file
boards/esp32_.../diagram.json
. - Click Play button to start simulation.
- Click Pause button to freeze simulation and display states of GPIOs.
- Graphical assets: https://opengameart.org/content/platformer-tiles
- Font FreeSans.ttf: https://github.com/opensourcedesign/fonts/blob/master/gnu-freefont_freesans/FreeSans.ttf