init
This commit is contained in:
@@ -0,0 +1,13 @@
|
|||||||
|
ARG DOCKER_TAG=latest
|
||||||
|
FROM espressif/idf:${DOCKER_TAG}
|
||||||
|
|
||||||
|
ENV LC_ALL=C.UTF-8
|
||||||
|
ENV LANG=C.UTF-8
|
||||||
|
|
||||||
|
RUN apt-get update -y && apt-get install udev -y
|
||||||
|
|
||||||
|
RUN echo "source /opt/esp/idf/export.sh > /dev/null 2>&1" >> ~/.bashrc
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/opt/esp/entrypoint.sh" ]
|
||||||
|
|
||||||
|
CMD ["/bin/bash", "-c"]
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"name": "ESP-IDF QEMU",
|
||||||
|
"build": {
|
||||||
|
"dockerfile": "Dockerfile"
|
||||||
|
},
|
||||||
|
"customizations": {
|
||||||
|
"vscode": {
|
||||||
|
"settings": {
|
||||||
|
"terminal.integrated.defaultProfile.linux": "bash"
|
||||||
|
},
|
||||||
|
"extensions": [
|
||||||
|
"espressif.esp-idf-extension",
|
||||||
|
"espressif.esp-idf-web"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"runArgs": ["--privileged"]
|
||||||
|
}
|
||||||
+78
@@ -0,0 +1,78 @@
|
|||||||
|
# macOS
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
|
||||||
|
# Directory metadata
|
||||||
|
.directory
|
||||||
|
|
||||||
|
# Temporary files
|
||||||
|
*~
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
*.bak
|
||||||
|
*.tmp
|
||||||
|
|
||||||
|
# Log files
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# Build artifacts and directories
|
||||||
|
**/build/
|
||||||
|
build/
|
||||||
|
*.o
|
||||||
|
*.a
|
||||||
|
*.out
|
||||||
|
*.exe # For any host-side utilities compiled on Windows
|
||||||
|
|
||||||
|
# ESP-IDF specific build outputs
|
||||||
|
*.bin
|
||||||
|
*.elf
|
||||||
|
*.map
|
||||||
|
flasher_args.json # Generated in build directory
|
||||||
|
sdkconfig.old
|
||||||
|
sdkconfig
|
||||||
|
|
||||||
|
# ESP-IDF dependencies
|
||||||
|
# For older versions or manual component management
|
||||||
|
/components/.idf/
|
||||||
|
**/components/.idf/
|
||||||
|
# For modern ESP-IDF component manager
|
||||||
|
managed_components/
|
||||||
|
# If ESP-IDF tools are installed/referenced locally to the project
|
||||||
|
.espressif/
|
||||||
|
|
||||||
|
# CMake generated files
|
||||||
|
CMakeCache.txt
|
||||||
|
CMakeFiles/
|
||||||
|
cmake_install.cmake
|
||||||
|
install_manifest.txt
|
||||||
|
CTestTestfile.cmake
|
||||||
|
|
||||||
|
# Python environment files
|
||||||
|
*.pyc
|
||||||
|
*.pyo
|
||||||
|
*.pyd
|
||||||
|
__pycache__/
|
||||||
|
*.egg-info/
|
||||||
|
dist/
|
||||||
|
|
||||||
|
# Virtual environment folders
|
||||||
|
venv/
|
||||||
|
.venv/
|
||||||
|
env/
|
||||||
|
|
||||||
|
# Language Servers
|
||||||
|
.clangd/
|
||||||
|
.ccls-cache/
|
||||||
|
compile_commands.json
|
||||||
|
|
||||||
|
# Windows specific
|
||||||
|
Thumbs.db
|
||||||
|
ehthumbs.db
|
||||||
|
Desktop.ini
|
||||||
|
|
||||||
|
# User-specific configuration files
|
||||||
|
*.user
|
||||||
|
*.workspace # General workspace files, can be from various tools
|
||||||
|
*.suo # Visual Studio Solution User Options
|
||||||
|
*.sln.docstates # Visual Studio
|
||||||
Vendored
+20
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "ESP-IDF",
|
||||||
|
"compilerPath": "",
|
||||||
|
"compileCommands": "${config:idf.buildPath}/compile_commands.json",
|
||||||
|
"intelliSenseMode": "gcc-x86",
|
||||||
|
"includePath": [
|
||||||
|
"${workspaceFolder}/**"
|
||||||
|
],
|
||||||
|
"browse": {
|
||||||
|
"path": [
|
||||||
|
"${workspaceFolder}"
|
||||||
|
],
|
||||||
|
"limitSymbolsToIncludedHeaders": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"version": 4
|
||||||
|
}
|
||||||
Vendored
+10
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"type": "gdbtarget",
|
||||||
|
"request": "attach",
|
||||||
|
"name": "Eclipse CDT GDB Adapter"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
Vendored
+35
@@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
"C_Cpp.intelliSenseEngine": "default",
|
||||||
|
"idf.extensionActivationMode": "always",
|
||||||
|
"cmake.configureOnOpen": false,
|
||||||
|
"cmake.configureOnEdit": false,
|
||||||
|
"cmake.automaticReconfigure": false,
|
||||||
|
"cmake.autoSelectActiveFolder": false,
|
||||||
|
"cmake.options.advanced": {
|
||||||
|
"build": {
|
||||||
|
"statusBarVisibility": "inherit",
|
||||||
|
"inheritDefault": "hidden"
|
||||||
|
},
|
||||||
|
"launch": {
|
||||||
|
"statusBarVisibility": "inherit",
|
||||||
|
"inheritDefault": "hidden"
|
||||||
|
},
|
||||||
|
"debug": {
|
||||||
|
"statusBarVisibility": "inherit",
|
||||||
|
"inheritDefault": "hidden"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"idf.openOcdConfigs": [
|
||||||
|
"board/esp32s3-builtin.cfg"
|
||||||
|
],
|
||||||
|
"idf.currentSetup": "C:\\esp\\v6.0\\esp-idf",
|
||||||
|
"idf.customExtraVars": {
|
||||||
|
"IDF_TARGET": "esp32s3"
|
||||||
|
},
|
||||||
|
"clangd.path": "C:\\Espressif\\tools\\esp-clang\\16.0.1-fe4f10a809\\esp-clang\\bin\\clangd.exe",
|
||||||
|
"clangd.arguments": [
|
||||||
|
"--background-index",
|
||||||
|
"--query-driver=**",
|
||||||
|
"--compile-commands-dir=c:\\Users\\Mitchell\\cpp\\buzz_detector\\build"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# 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.22)
|
||||||
|
|
||||||
|
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||||
|
# "Trim" the build. Include the minimal set of components, main, and anything it depends on.
|
||||||
|
idf_build_set_property(MINIMAL_BUILD ON)
|
||||||
|
project(buzz_detector)
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
| Supported Targets | ESP32 | ESP32-C2 | ESP32-C3 | ESP32-C5 | ESP32-C6 | ESP32-C61 | ESP32-H2 | ESP32-H21 | ESP32-H4 | ESP32-P4 | ESP32-S2 | ESP32-S3 |
|
||||||
|
| ----------------- | ----- | -------- | -------- | -------- | -------- | --------- | -------- | --------- | -------- | -------- | -------- | -------- |
|
||||||
|
|
||||||
|
# Blink Example
|
||||||
|
|
||||||
|
(See the README.md file in the upper level 'examples' directory for more information about examples.)
|
||||||
|
|
||||||
|
This example demonstrates how to blink a LED by using the GPIO driver or using the [led_strip](https://components.espressif.com/component/espressif/led_strip) library if the LED is addressable e.g. [WS2812](https://cdn-shop.adafruit.com/datasheets/WS2812B.pdf). The `led_strip` library is installed via [component manager](main/idf_component.yml).
|
||||||
|
|
||||||
|
## How to Use Example
|
||||||
|
|
||||||
|
Before project configuration and build, be sure to set the correct chip target using `idf.py set-target <chip_name>`.
|
||||||
|
|
||||||
|
### Hardware Required
|
||||||
|
|
||||||
|
* A development board with normal LED or addressable LED on-board (e.g., ESP32-S3-DevKitC, ESP32-C6-DevKitC etc.)
|
||||||
|
* A USB cable for Power supply and programming
|
||||||
|
|
||||||
|
See [Development Boards](https://www.espressif.com/en/products/devkits) for more information about it.
|
||||||
|
|
||||||
|
### Configure the Project
|
||||||
|
|
||||||
|
Open the project configuration menu (`idf.py menuconfig`).
|
||||||
|
|
||||||
|
In the `Example Configuration` menu:
|
||||||
|
|
||||||
|
* Select the LED type in the `Blink LED type` option.
|
||||||
|
* Use `GPIO` for regular LED
|
||||||
|
* Use `LED strip` for addressable LED
|
||||||
|
* If the LED type is `LED strip`, select the backend peripheral
|
||||||
|
* `RMT` is only available for ESP targets with RMT peripheral supported
|
||||||
|
* `SPI` is available for all ESP targets
|
||||||
|
* Set the GPIO number used for the signal in the `Blink GPIO number` option.
|
||||||
|
* Set the blinking period in the `Blink period in ms` option.
|
||||||
|
|
||||||
|
### Build and Flash
|
||||||
|
|
||||||
|
Run `idf.py -p PORT flash monitor` to build, flash and monitor the project.
|
||||||
|
|
||||||
|
(To exit the serial monitor, type ``Ctrl-]``.)
|
||||||
|
|
||||||
|
See the [Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/latest/get-started/index.html) for full steps to configure and use ESP-IDF to build projects.
|
||||||
|
|
||||||
|
## Example Output
|
||||||
|
|
||||||
|
As you run the example, you will see the LED blinking, according to the previously defined period. For the addressable LED, you can also change the LED color by setting the `led_strip_set_pixel(led_strip, 0, 16, 16, 16);` (LED Strip, Pixel Number, Red, Green, Blue) with values from 0 to 255 in the [source file](main/blink_example_main.c).
|
||||||
|
|
||||||
|
```text
|
||||||
|
I (315) example: Example configured to blink addressable LED!
|
||||||
|
I (325) example: Turning the LED OFF!
|
||||||
|
I (1325) example: Turning the LED ON!
|
||||||
|
I (2325) example: Turning the LED OFF!
|
||||||
|
I (3325) example: Turning the LED ON!
|
||||||
|
I (4325) example: Turning the LED OFF!
|
||||||
|
I (5325) example: Turning the LED ON!
|
||||||
|
I (6325) example: Turning the LED OFF!
|
||||||
|
I (7325) example: Turning the LED ON!
|
||||||
|
I (8325) example: Turning the LED OFF!
|
||||||
|
```
|
||||||
|
|
||||||
|
Note: The color order could be different according to the LED model.
|
||||||
|
|
||||||
|
The pixel number indicates the pixel position in the LED strip. For a single LED, use 0.
|
||||||
|
|
||||||
|
## Troubleshooting
|
||||||
|
|
||||||
|
* If the LED isn't blinking, check the GPIO or the LED type selection in the `Example Configuration` menu.
|
||||||
|
|
||||||
|
For any technical queries, please open an [issue](https://github.com/espressif/esp-idf/issues) on GitHub. We will get back to you soon.
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
idf_component_register(SRCS "main.c"
|
||||||
|
INCLUDE_DIRS ".")
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
menu "Example Configuration"
|
||||||
|
|
||||||
|
orsource "$IDF_PATH/examples/common_components/env_caps/$IDF_TARGET/Kconfig.env_caps"
|
||||||
|
|
||||||
|
choice BLINK_LED
|
||||||
|
prompt "Blink LED type"
|
||||||
|
default BLINK_LED_GPIO
|
||||||
|
help
|
||||||
|
Select the LED type. A normal level controlled LED or an addressable LED strip.
|
||||||
|
The default selection is based on the Espressif DevKit boards.
|
||||||
|
You can change the default selection according to your board.
|
||||||
|
|
||||||
|
config BLINK_LED_GPIO
|
||||||
|
bool "GPIO"
|
||||||
|
config BLINK_LED_STRIP
|
||||||
|
bool "LED strip"
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
choice BLINK_LED_STRIP_BACKEND
|
||||||
|
depends on BLINK_LED_STRIP
|
||||||
|
prompt "LED strip backend peripheral"
|
||||||
|
default BLINK_LED_STRIP_BACKEND_RMT if SOC_RMT_SUPPORTED
|
||||||
|
default BLINK_LED_STRIP_BACKEND_SPI
|
||||||
|
help
|
||||||
|
Select the backend peripheral to drive the LED strip.
|
||||||
|
|
||||||
|
config BLINK_LED_STRIP_BACKEND_RMT
|
||||||
|
depends on SOC_RMT_SUPPORTED
|
||||||
|
bool "RMT"
|
||||||
|
config BLINK_LED_STRIP_BACKEND_SPI
|
||||||
|
bool "SPI"
|
||||||
|
endchoice
|
||||||
|
|
||||||
|
config BLINK_GPIO
|
||||||
|
int "Blink GPIO number"
|
||||||
|
range ENV_GPIO_RANGE_MIN ENV_GPIO_OUT_RANGE_MAX
|
||||||
|
default 8
|
||||||
|
help
|
||||||
|
GPIO number (IOxx) to blink on and off the LED.
|
||||||
|
Some GPIOs are used for other purposes (flash connections, etc.) and cannot be used to blink.
|
||||||
|
|
||||||
|
config BLINK_PERIOD
|
||||||
|
int "Blink period in ms"
|
||||||
|
range 10 3600000
|
||||||
|
default 1000
|
||||||
|
help
|
||||||
|
Define the blinking period in milliseconds.
|
||||||
|
|
||||||
|
endmenu
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
dependencies:
|
||||||
|
espressif/led_strip: "^3.0.0"
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include "freertos/FreeRTOS.h"
|
||||||
|
#include "freertos/task.h"
|
||||||
|
#include "driver/gpio.h"
|
||||||
|
#include "esp_log.h"
|
||||||
|
#include "led_strip.h"
|
||||||
|
#include "sdkconfig.h"
|
||||||
|
|
||||||
|
static const char *TAG = "buzz_detector";
|
||||||
|
|
||||||
|
void app_main(void) {
|
||||||
|
println("Hello, ESP32!");
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||||
|
# SPDX-License-Identifier: CC0-1.0
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
from pytest_embedded_idf.dut import IdfDut
|
||||||
|
from pytest_embedded_idf.utils import idf_parametrize
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.generic
|
||||||
|
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
|
||||||
|
def test_blink(dut: IdfDut) -> None:
|
||||||
|
# check and log bin size
|
||||||
|
binary_file = os.path.join(dut.app.binary_path, 'blink.bin')
|
||||||
|
bin_size = os.path.getsize(binary_file)
|
||||||
|
logging.info('blink_bin_size : {}KB'.format(bin_size // 1024))
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
CONFIG_BLINK_LED_GPIO=y
|
||||||
|
CONFIG_BLINK_GPIO=8
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
CONFIG_BLINK_GPIO=5
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
CONFIG_BLINK_LED_STRIP=y
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
CONFIG_BLINK_GPIO=27
|
||||||
|
CONFIG_BLINK_LED_STRIP=y
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
CONFIG_BLINK_LED_STRIP=y
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
CONFIG_BLINK_LED_STRIP=y
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
CONFIG_BLINK_LED_STRIP=y
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
CONFIG_BLINK_GPIO=44
|
||||||
|
CONFIG_BLINK_LED_STRIP=y
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
CONFIG_BLINK_LED_STRIP=y
|
||||||
|
CONFIG_BLINK_GPIO=18
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
CONFIG_BLINK_LED_STRIP=y
|
||||||
|
#
|
||||||
|
# Please Note:
|
||||||
|
# ESP32-S3-DevKitC v1.1 uses GPIO38 for the on-board LED
|
||||||
|
# ESP32-S3-DevKitC v1.0 uses GPIO48 for the on-board LED
|
||||||
|
#
|
||||||
|
CONFIG_BLINK_GPIO=38
|
||||||
Reference in New Issue
Block a user