Files
powerpods/main/led_ring.h
T
skrueckenandCursor 73f48c8002 Add LED ring boot chase and connect flash animations.
Give pods quick visual feedback on power-up and when a slave joins the master.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-01 22:57:31 +01:00

65 lines
1.7 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#ifndef LED_RING_H
#define LED_RING_H
#include <stdint.h>
/** Default RGB scale (~5 % of full brightness). */
#define LED_RING_DEFAULT_INTENSITY 13
/** Full brightness for find-me and similar alerts. */
#define LED_RING_FULL_INTENSITY 255
/** ~10 % brightness for battery-low indicator. */
#define LED_RING_BATTERY_LOW_INTENSITY 26
#define LED_RING_BATTERY_LOW_LEDS 4
#define LED_RING_BATTERY_LOW_HOLD_MS 5000
typedef enum {
LED_CMD_CLEAR,
LED_CMD_SET_DIGIT,
LED_CMD_SET_COLOR,
LED_CMD_PROGRESS,
LED_CMD_BLINK,
LED_CMD_FIND_ME,
LED_CMD_BATTERY_LOW,
LED_CMD_BOOT,
LED_CMD_CONNECTED
} led_mode_t;
typedef struct {
led_mode_t mode;
uint8_t value;
uint8_t r, g, b;
uint8_t intensity;
uint8_t progress;
uint16_t blink_ms;
uint8_t blink_count;
} led_command_t;
void led_ring_send_command(led_command_t *cmd);
void led_ring_init(void);
void led_ring_scale_rgb(uint8_t *r, uint8_t *g, uint8_t *b, uint8_t intensity);
/** OTA feedback: ring fill 0–100 % with RGB. */
void led_ring_show_ota_progress(uint32_t bytes_done, uint32_t total_bytes,
uint8_t r, uint8_t g, uint8_t b);
void led_ring_show_ota_clear(void);
/** Single pulse on the full ring (blocking in LED task). */
void led_ring_blink_once(uint8_t r, uint8_t g, uint8_t b);
void led_ring_ota_success(void);
void led_ring_ota_failed(void);
/** Red / green / blue: 3 blinks each at full intensity. */
void led_ring_find_me(void);
/** First 4 LEDs red at ~10 % for 5 s, then off (blocking in LED task). */
void led_ring_show_battery_low(void);
/** Chase: each ring LED lights once in sequence (~1 s total). */
void led_ring_boot_anim(void);
/** Every second LED briefly blue (join / reconnect). */
void led_ring_connected_anim(void);
#endif