Working with ESP-IDF
This chapter includes the following two sections, please read as needed:
Setting Up Development Environment
The following environment settings are applicable to Windows 10/11 systems. For Mac/Linux users, please refer to the official instructions
-
Download and install Visual Studio Code.
-
In VS Code, open the Extensions view by clicking the
in the VS Code sidebar or using the shortcut (Ctrl+Shift+X). Then, search for the ESP-IDF extension and install it.

-
After the extension is installed, the
will appear in the activity bar on the left side of VS Code. Clicking this icon will view the basic command list for the ESP-IDF extension. Select Configure ESP-IDF extension under Advanced.

-
Choose Express to enter quick configuration mode:

-
Modify the following options as needed:
- Select download server:
- Espressif: For users in China, use Espressif's China server for faster downloads.
- Github: Use the official GitHub release link.
- ESP-IDF Version: Typically, select the version required by the development board. If no specific requirement, it's recommended to use the latest stable version. For ESP32-C6-Touch-AMOLED-1.8, it is recommended to use the Espressif IDF version ≥ v5.5.0.
- ESP-IDF Container directory: It is recommended to use the default path, or use a path that contains only English characters and no spaces.
- ESP-IDF Required Tools directory: It is recommended to use the default path, or use a path that contains only English characters and no spaces.

- Select download server:
-
Click Install to start the installation. You will see a page displaying the installation progress, including the progress status of ESP-IDF download, ESP-IDF tool download and installation, as well as the creation of the Python virtual environment.

-
If everything is installed correctly, you'll get a prompt confirming all the setup is done, and you're ready to start using the extension.

Note: If ESP-IDF installation fails or needs to be reinstalled, you can try deleting the C:\Users\%Username%\esp and C:\Users\%Username%\.espressif folders and then retry.
Demo
The ESP-IDF demos are located in the ESP-IDF directory of the demo package.
01_SD_Card
This demo demonstrates how to use ESP32-C6-GEEK to test the read and write functions of the TF card

Additional Preparation
- Insert the TF card into the card slot (TF card needs to be formatted as FAT32)
Code Analysis
-
Initialize the TF card using SDSPI mode:
SD_card_Init(); -
Test TF card read/write functionality:
example_sdcard_task();
02_WIFI_AP
This demo can set the development board as a hotspot, allowing phones or other devices in STA mode to connect to the development board.

Code Analysis
-
In the file
softap_example_main.c, findSSIDandPASSWORD, and then your phone or other device in STA mode can use theSSIDandPASSWORDto connect to the development board.#define EXAMPLE_ESP_WIFI_SSID "waveshare_esp32"
#define EXAMPLE_ESP_WIFI_PASSWORD "wav123456"
03_WIFI_STA
This example can configure the development board as a STA device to connect to a router, thereby enabling access to the system network.

Code Analysis
In the file esp_wifi_bsp.c, find ssid and password, then modify them to the SSID and Password of an available router in your current environment.
wifi_config_t wifi_config = {
.sta = {
.ssid = "PDCN",
.password = "1234567890",
},
};
04_Button
This example demonstrates how to use the Boot button as a multi-functional button, capable of performing different actions such as single-click, double-click, or long-press.
Code Analysis
-
Initialize the Boot button and bind the button event function:
void button_init(void)
{
button_config_t btn_cfg = {0};
button_gpio_config_t gpio_cfg = {
.gpio_num = BOOT_BUTTON_NUM,
.active_level = 0,
.enable_power_save = true,
};
esp_err_t ret = iot_button_new_gpio_device(&btn_cfg, &gpio_cfg, &boot_btn);
assert(ret == ESP_OK);
ret |= iot_button_register_cb(boot_btn, BUTTON_SINGLE_CLICK, NULL, button_event_cb, NULL);
ret |= iot_button_register_cb(boot_btn, BUTTON_DOUBLE_CLICK, NULL, button_event_cb, NULL);
ret |= iot_button_register_cb(boot_btn, BUTTON_LONG_PRESS_START, NULL, button_event_cb, NULL);
}
05_lvgl_example
Implement some multi-functional GUI interfaces on the screen by porting LVGL.

Code Analysis
-
Display text and LVGL version information:
/* Task lock */
lvgl_port_lock(0);
lv_obj_t *label = lv_label_create(lv_scr_act());
lv_snprintf(str, sizeof(str), "Hello LVGL \nVersion: V %d.%d.%d ", LVGL_VERSION_MAJOR, LVGL_VERSION_MINOR, LVGL_VERSION_PATCH);
lv_label_set_text(label, str);
lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
/* Task unlock */
lvgl_port_unlock();