Expand description
Status LED: LEDC PWM patterns driven by a dedicated embassy task.
The LED is the device status indicator. Patterns and timings follow
the mockups in assets/led/*.svg:
LedStatus | Pattern | Period |
|---|---|---|
Off | dark | — |
Startup | breathing, peak brightness | 1000ms |
Resetting | fast breathing, peak | 300ms |
Ok | solid, config brightness | — |
Warning | blink, config brightness | 1000ms |
Error | blink, peak brightness | 200ms |
All timing lives inside task; every other task (or interrupt) only
calls set — a lock-free atomic store. Config-driven brightness flows
in through set_brightness, pushed by
crate::config::Config::apply.
Enums§
- LedStatus
- Semantic status shown by the LED (timings in the module docs).
Constants§
- DEFAULT_
BRIGHTNESS 🔒 - Brightness assumed until
set_brightnessdelivers the configured value (mirrorsConfig::default().led_brightness). - DUTY_
MAX 🔒 - Maximum duty count for the configured 14-bit resolution
([
timer::config::Duty::Duty14Bit], i.e. 2^14 − 1). - ERROR_
PERIOD_ 🔒MS - Blink period of
LedStatus::Error(200 ms perassets/led/blinking_200ms.svg). - PEAK_
BRIGHTNESS 🔒 - Brightness of the attention states (full scale).
- RESETTING_
PERIOD_ 🔒MS - Breathing period of
LedStatus::Resetting(300 ms perassets/led/breathing_300ms.svg). - STARTUP_
PERIOD_ 🔒MS - Breathing period of
LedStatus::Startup(1000 ms perassets/led/breathing_1000ms.svg). - TICK 🔒
- Effect refresh interval.
- WARNING_
PERIOD_ 🔒MS - Blink period of
LedStatus::Warning(1000 ms perassets/led/blinking_1000ms.svg).
Statics§
- BRIGHTNESS 🔒
- Config-driven brightness (0–255) for
LedStatus::Ok/LedStatus::Warning. - STATUS 🔒
- Requested status; written by
set, consumed bytask.
Functions§
- apply 🔒
- Applies
statusto the LEDC channel. - blink 🔒
- Blink: on for the first half of
period_ms, off for the second. - breathing 🔒
- Breathing: raised sine over
period_ms, scaled tobrightness. - brightness_
counts 🔒 - Scale an 8-bit brightness (0–255) to raw duty counts (0–
DUTY_MAX). - current_
status 🔒 - Reads the requested status; unknown codes fall back to
LedStatus::Off. - set
- Selects the status pattern.
- set_
brightness - Sets the config-driven brightness (0–255) used by
LedStatus::OkandLedStatus::Warning. - task
- Runs the status-LED effect loop, owning the LEDC peripheral.