diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..515162e --- /dev/null +++ b/.clang-format @@ -0,0 +1,2 @@ +--- +BasedOnStyle: Microsoft diff --git a/.clangd b/.clangd new file mode 100644 index 0000000..12e1375 --- /dev/null +++ b/.clangd @@ -0,0 +1,17 @@ +CompileFlags: + Add: + - -Wno-unknown-warning-option + - -Wno-format + Remove: + - -mword-relocations + +Diagnostics: + ClangTidy: + FastCheckFilter: None + +--- + +If: + PathMatch: .*\.h +Diagnostics: + UnusedIncludes: None diff --git a/.github/workflows/esp32_build.yaml b/.github/workflows/esp32_build.yaml new file mode 100644 index 0000000..f40b853 --- /dev/null +++ b/.github/workflows/esp32_build.yaml @@ -0,0 +1,37 @@ +name: ESP-IDF Build + +on: + push: + pull_request: + merge_group: + schedule: + - cron: "0 5 * * 3" + +permissions: + contents: read + pull-requests: write + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + strategy: + matrix: + idf_ver: [release-v5.4, latest] + idf_target: + [esp32, esp32c3, esp32c5, esp32c6, esp32h2, esp32p4, esp32s3] + + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + with: + submodules: "recursive" + - name: ESP-IDF build + uses: espressif/esp-idf-ci-action@v1 + with: + esp_idf_version: ${{ matrix.idf_ver }} + target: ${{ matrix.idf_target }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..78ff13a --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +build/** +managed_components/** +sdkconfig +sdkconfig.old +.vscode/settings.json +.espidf.*.json +*.svd diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 0000000..7a61e51 --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,23 @@ +{ + "configurations": [ + { + "name": "ESP-IDF", + "compilerPath": "${config:idf.toolsPath}/tools/xtensa-esp-elf/esp-14.2.0_20241119/xtensa-esp-elf/bin/xtensa-esp32s3-elf-gcc", + "compileCommands": "${config:idf.buildPath}/compile_commands.json", + "includePath": [ + "${config:idf.espIdfPath}/components/**", + "${config:idf.espIdfPathWin}/components/**", + "${workspaceFolder}/**" + ], + "browse": { + "path": [ + "${config:idf.espIdfPath}/components", + "${config:idf.espIdfPathWin}/components", + "${workspaceFolder}" + ], + "limitSymbolsToIncludedHeaders": true + } + } + ], + "version": 4 +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..2511a38 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "type": "gdbtarget", + "request": "attach", + "name": "Eclipse CDT GDB Adapter" + }, + { + "type": "espidf", + "name": "Launch", + "request": "launch" + } + ] +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..edb5f67 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,6 @@ +# The following five lines of boilerplate have to be in your project's +# CMakeLists in this exact order for cmake to work correctly +cmake_minimum_required(VERSION 3.16) + +include($ENV{IDF_PATH}/tools/cmake/project.cmake) +project(miniature_town) diff --git a/data/capability.json b/data/capability.json new file mode 100644 index 0000000..2b17391 --- /dev/null +++ b/data/capability.json @@ -0,0 +1,47 @@ +{ + "module": "Miniature Town", + "capabilities": [ + { + "id": 0, + "type": "toggle", + "default": "0", + "label": "L8" + }, + { + "id": 1, + "type": "toggle", + "default": "0", + "label": "L8" + }, + { + "id": 2, + "type": "toggle", + "default": "0", + "label": "L8" + }, + { + "id": 3, + "type": "toggle", + "default": "0", + "label": "L8" + }, + { + "id": 4, + "type": "toggle", + "default": "0", + "label": "L8" + }, + { + "id": 5, + "type": "toggle", + "default": "0", + "label": "L8" + }, + { + "id": 6, + "type": "toggle", + "default": "0", + "label": "L8" + } + ] +} \ No newline at end of file diff --git a/dependencies.lock b/dependencies.lock new file mode 100644 index 0000000..5763738 --- /dev/null +++ b/dependencies.lock @@ -0,0 +1,10 @@ +dependencies: + idf: + source: + type: idf + version: 5.4.1 +direct_dependencies: +- idf +manifest_hash: 44ab24e10034773b6c40a4d547bbb6fecca72b12e3f5de2a2b95714982647afc +target: esp32s3 +version: 2.0.0 diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt new file mode 100644 index 0000000..e7f6807 --- /dev/null +++ b/main/CMakeLists.txt @@ -0,0 +1,4 @@ +idf_component_register(SRCS "main.c" + INCLUDE_DIRS "." +) +spiffs_create_partition_image(storage ../data FLASH_IN_PROJECT) diff --git a/main/Kconfig.projbuild b/main/Kconfig.projbuild new file mode 100644 index 0000000..900d70c --- /dev/null +++ b/main/Kconfig.projbuild @@ -0,0 +1,29 @@ +menu "Warnemuende Lighthouse" + config WLED_DIN_PIN + int "WLED Data In Pin" + default 14 + help + The number of the WLED data in pin. + + choice LIGHT_CHARACTERISTIC_CHOICE + prompt "Light characteristic" + default LIGHT_CHARACTERISTIC_GREEN + help + The color of the main WLED light. + + config LIGHT_CHARACTERISTIC_GREEN + bool "Green flashing light" + help + The light will be flashing green. + + config LIGHT_CHARACTERISTIC_RED + bool "Red flashing light" + help + The light will be flashing red. + endchoice + + config LIGHT_CHARACTERISTIC_VALUE + int + default 1 if LIGHT_CHARACTERISTIC_GREEN + default 2 if LIGHT_CHARACTERISTIC_RED +endmenu diff --git a/main/idf_component.yml b/main/idf_component.yml new file mode 100644 index 0000000..343c26f --- /dev/null +++ b/main/idf_component.yml @@ -0,0 +1,16 @@ +## IDF Component Manager Manifest File +dependencies: + ## Required IDF version + idf: + version: '>=5.4.0' + # # Put list of dependencies here + # # For components maintained by Espressif: + # component: "~1.0.0" + # # For 3rd party components: + # username/component: ">=1.0.0,<2.0.0" + # username2/component2: + # version: "~1.0.0" + # # For transient dependencies `public` flag can be set. + # # `public` flag doesn't have an effect dependencies of the `main` component. + # # All dependencies of `main` are public by default. + # public: true diff --git a/main/main.c b/main/main.c new file mode 100644 index 0000000..cb05851 --- /dev/null +++ b/main/main.c @@ -0,0 +1,3 @@ +void app_main(void) +{ +} diff --git a/partitions.csv b/partitions.csv new file mode 100644 index 0000000..cb15057 --- /dev/null +++ b/partitions.csv @@ -0,0 +1,7 @@ +# Name , Type , SubType , Offset , Size , Flags +nvs , data , nvs , 0x9000 , 20k , +otadata , data , ota , 0xe000 , 8k , +app0 , app , ota_0 , 0x10000 , 1024k , +app1 , app , ota_1 , , 1024k , +storage , data , spiffs , , 1536k , +coredump , data , coredump , , 64k , diff --git a/sdkconfig.defaults b/sdkconfig.defaults new file mode 100755 index 0000000..65009c9 --- /dev/null +++ b/sdkconfig.defaults @@ -0,0 +1,23 @@ +# activate Bluetooth Low Energy (BLE) +CONFIG_BT_ENABLED=y +CONFIG_BT_NIMBLE_ENABLED=y + +# NimBLE Options +CONFIG_BT_NIMBLE_SECURITY_ENABLE=n +CONFIG_BT_NIMBLE_SVC_GAP_DEVICE_NAME="lighthouse" + +# Logging +CONFIG_LOG_DEFAULT_LEVEL_INFO=y +CONFIG_LOG_DEFAULT_LEVEL=3 +CONFIG_LOG_MAXIMUM_LEVEL=3 + +# Flash Size +CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y +CONFIG_ESPTOOLPY_FLASHSIZE="4MB" + +# Partitions +CONFIG_PARTITION_TABLE_CUSTOM=y +CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv" + +# ESP System Settings +CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_80=y diff --git a/sdkconfig.defaults.esp32 b/sdkconfig.defaults.esp32 new file mode 100644 index 0000000..d17d67f --- /dev/null +++ b/sdkconfig.defaults.esp32 @@ -0,0 +1,2 @@ +# default ESP target +CONFIG_IDF_TARGET="esp32" diff --git a/sdkconfig.defaults.esp32c3 b/sdkconfig.defaults.esp32c3 new file mode 100644 index 0000000..86a5bac --- /dev/null +++ b/sdkconfig.defaults.esp32c3 @@ -0,0 +1,2 @@ +# default ESP target +CONFIG_IDF_TARGET="esp32c3" diff --git a/sdkconfig.defaults.esp32c5 b/sdkconfig.defaults.esp32c5 new file mode 100644 index 0000000..ffc7b7f --- /dev/null +++ b/sdkconfig.defaults.esp32c5 @@ -0,0 +1,2 @@ +# default ESP target +CONFIG_IDF_TARGET="esp32c5" diff --git a/sdkconfig.defaults.esp32c6 b/sdkconfig.defaults.esp32c6 new file mode 100644 index 0000000..a7b537a --- /dev/null +++ b/sdkconfig.defaults.esp32c6 @@ -0,0 +1,2 @@ +# default ESP target +CONFIG_IDF_TARGET="esp32c6" diff --git a/sdkconfig.defaults.esp32h2 b/sdkconfig.defaults.esp32h2 new file mode 100644 index 0000000..04069a9 --- /dev/null +++ b/sdkconfig.defaults.esp32h2 @@ -0,0 +1,2 @@ +# default ESP target +CONFIG_IDF_TARGET="esp32h2" diff --git a/sdkconfig.defaults.esp32p4 b/sdkconfig.defaults.esp32p4 new file mode 100644 index 0000000..091f4b8 --- /dev/null +++ b/sdkconfig.defaults.esp32p4 @@ -0,0 +1,2 @@ +# default ESP target +CONFIG_IDF_TARGET="esp32p4" diff --git a/sdkconfig.defaults.esp32s3 b/sdkconfig.defaults.esp32s3 new file mode 100644 index 0000000..7c2cf11 --- /dev/null +++ b/sdkconfig.defaults.esp32s3 @@ -0,0 +1,2 @@ +# default ESP target +CONFIG_IDF_TARGET="esp32s3" diff --git a/version.txt b/version.txt new file mode 100644 index 0000000..6c6aa7c --- /dev/null +++ b/version.txt @@ -0,0 +1 @@ +0.1.0 \ No newline at end of file