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"