feat: add mimiclaw onboarding page.

Signed-off-by: Bo <boironic@gmail.com>
This commit is contained in:
Bo
2026-02-09 20:16:00 +08:00
committed by lvbo
parent 5bcb28abbd
commit 106fe3b5b0
17 changed files with 1021 additions and 0 deletions

39
main/rgb/rgb.c Normal file
View File

@@ -0,0 +1,39 @@
#include "rgb/rgb.h"
#include "esp_check.h"
#include "led_strip.h"
#define RGB_GPIO 38
static led_strip_handle_t s_strip = NULL;
esp_err_t rgb_init(void)
{
led_strip_config_t strip_config = {
.strip_gpio_num = RGB_GPIO,
.max_leds = 1,
.led_pixel_format = LED_PIXEL_FORMAT_GRB,
.led_model = LED_MODEL_WS2812,
.flags.invert_out = false,
};
led_strip_rmt_config_t rmt_config = {
.clk_src = RMT_CLK_SRC_DEFAULT,
.resolution_hz = 10 * 1000 * 1000,
.flags.with_dma = false,
};
ESP_RETURN_ON_ERROR(led_strip_new_rmt_device(&strip_config, &rmt_config, &s_strip), "rgb", "led_strip init failed");
led_strip_clear(s_strip);
return ESP_OK;
}
void rgb_set(uint8_t r, uint8_t g, uint8_t b)
{
if (!s_strip) {
return;
}
/* Swap R/G for this board's LED ordering */
led_strip_set_pixel(s_strip, 0, g, r, b);
led_strip_refresh(s_strip);
}

15
main/rgb/rgb.h Normal file
View File

@@ -0,0 +1,15 @@
#pragma once
#include <stdint.h>
#include "esp_err.h"
#ifdef __cplusplus
extern "C" {
#endif
esp_err_t rgb_init(void);
void rgb_set(uint8_t r, uint8_t g, uint8_t b);
#ifdef __cplusplus
}
#endif