From df43820acdcff3eeb6967a05c2c866c75c000ea4 Mon Sep 17 00:00:00 2001 From: jimmy Date: Tue, 10 Nov 2026 23:23:08 +1300 Subject: [PATCH] Add basic ESP-IDF app skeleton Adds a minimal ESP-IDF project for ESP32-S3 at the repo root: top-level CMakeLists, a main component with a C++ app_main that logs a heartbeat, sdkconfig.defaults selecting esp32s3, and build notes in the README. Co-Authored-By: Claude Haiku 5.5 --- CMakeLists.txt | 3 +++ README.md | 10 ++++++++++ main/CMakeLists.txt | 2 ++ main/main.cpp | 18 ++++++++++++++++++ sdkconfig.defaults | 1 + 5 files changed, 34 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 main/CMakeLists.txt create mode 100644 main/main.cpp create mode 100644 sdkconfig.defaults diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..7face26 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.16) +include($ENV{IDF_PATH}/tools/cmake/project.cmake) +project(led_driver) diff --git a/README.md b/README.md index 14564a4..a9e2c5b 100644 --- a/README.md +++ b/README.md @@ -50,3 +50,13 @@ led-driver/ ## Further reading - **`docs/API.md`** — JSON message fields as used in examples (`pattern`, `colors`, …). The Pi app may send **short keys** (`p`, `c`, …); behaviour matches once normalised on device. + +## C++ app (ESP-IDF) + +The `cpp` branch adds a basic ESP-IDF project for ESP32-S3 at the repo root (`CMakeLists.txt`, `main/`). + +```bash +. ~/.espressif/v6.1/esp-idf/export.sh # or your ESP-IDF install's export.sh +idf.py set-target esp32s3 +idf.py build flash monitor +``` diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt new file mode 100644 index 0000000..9eb7ec4 --- /dev/null +++ b/main/CMakeLists.txt @@ -0,0 +1,2 @@ +idf_component_register(SRCS "main.cpp" + INCLUDE_DIRS ".") diff --git a/main/main.cpp b/main/main.cpp new file mode 100644 index 0000000..bbbdcd5 --- /dev/null +++ b/main/main.cpp @@ -0,0 +1,18 @@ +#include + +#include "esp_log.h" +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" + +static const char *TAG = "led_driver"; + +extern "C" void app_main(void) +{ + ESP_LOGI(TAG, "LED driver (C++) starting"); + + int tick = 0; + while (true) { + ESP_LOGI(TAG, "alive: %d", tick++); + vTaskDelay(pdMS_TO_TICKS(1000)); + } +} diff --git a/sdkconfig.defaults b/sdkconfig.defaults new file mode 100644 index 0000000..b01fdbe --- /dev/null +++ b/sdkconfig.defaults @@ -0,0 +1 @@ +CONFIG_IDF_TARGET="esp32s3"