Initialize ESP32-S3 smoke-test project cycling the RGB led.

This commit is contained in:
2026-08-21 11:51:56 +02:00
commit 0ce360da20
10 changed files with 227 additions and 0 deletions
+74
View File
@@ -0,0 +1,74 @@
#include <stdint.h>
#include "esp_err.h"
#include "esp_log.h"
#include "esp_psram.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "led_strip.h"
#include "led_strip_rmt.h"
#ifndef RGB_LED_GPIO
#define RGB_LED_GPIO 48
#endif
#define RGB_LED_COUNT 1
#define RGB_LED_BRIGHTNESS 32
#define FADE_STEP_DELAY_MS 20
static const char *TAG = "rgb_smoke_test";
static led_strip_handle_t configure_rgb_led(void)
{
const led_strip_config_t strip_config = {
.strip_gpio_num = RGB_LED_GPIO,
.max_leds = RGB_LED_COUNT,
.led_model = LED_MODEL_WS2812,
.color_component_format = LED_STRIP_COLOR_COMPONENT_FMT_GRB,
.flags = {
.invert_out = false,
},
};
const led_strip_rmt_config_t rmt_config = {
.clk_src = RMT_CLK_SRC_DEFAULT,
.resolution_hz = 10 * 1000 * 1000,
.mem_block_symbols = 0,
.flags = {
.with_dma = false,
},
};
led_strip_handle_t strip = NULL;
ESP_ERROR_CHECK(led_strip_new_rmt_device(&strip_config, &rmt_config, &strip));
ESP_ERROR_CHECK(led_strip_clear(strip));
return strip;
}
void app_main(void)
{
ESP_LOGI(TAG, "ESP32-S3 build-chain smoke test started");
if (esp_psram_is_initialized()) {
ESP_LOGI(TAG, "PSRAM initialized: %u bytes", (unsigned int)esp_psram_get_size());
} else {
ESP_LOGW(TAG, "PSRAM is not initialized");
}
led_strip_handle_t strip = configure_rgb_led();
ESP_LOGI(TAG, "Sweeping the onboard RGB LED on GPIO%d", RGB_LED_GPIO);
while (true) {
for (uint16_t hue = 0; hue < 360; ++hue) {
ESP_ERROR_CHECK(led_strip_set_pixel_hsv(
strip,
0,
hue,
UINT8_MAX,
RGB_LED_BRIGHTNESS));
ESP_ERROR_CHECK(led_strip_refresh(strip));
vTaskDelay(pdMS_TO_TICKS(FADE_STEP_DELAY_MS));
}
}
}