spaxel/firmware/main/led.h
jedarden 0aa6046f82 feat: implement firmware LED blink handler for identify command
- Add led_init() call during firmware initialization in app_main()
- Add led_stop_blink() call on WebSocket disconnect
- LED GPIO configurable via CONFIG_SPAXEL_LED_GPIO (default GPIO8)
- Blink runs in FreeRTOS task at ~5Hz (100ms on/100ms off)
- Any running blink is cancelled when new identify message received

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 07:01:42 -04:00

32 lines
733 B
C

#pragma once
#include <stdint.h>
#include <stdbool.h>
#include "esp_err.h"
/**
* Initialize LED control.
* Sets up GPIO for LED blink (default GPIO8 for ESP32-S3-DevKitC).
*/
esp_err_t led_init(void);
/**
* Start LED blink for identification.
* Creates a FreeRTOS task that blinks the LED at ~5 Hz (100ms on/100ms off)
* for the specified duration. Any running blink is cancelled first.
*
* @param duration_ms Blink duration in milliseconds (max 60000 = 60 seconds)
* @return ESP_OK on success
*/
esp_err_t led_blink_identify(uint32_t duration_ms);
/**
* Stop any running LED blink.
*/
void led_stop_blink(void);
/**
* Check if LED is currently blinking.
* @return true if blinking
*/
bool led_is_blinking(void);