status-led
no_std monochrome status LED abstraction for the embassy ecosystem.
- Type-safe polarity —
ActiveHigh/ActiveLowmarkers prevent logic errors at compile time. - Reads hardware directly — no internal state cache;
is_on()reads the ODR register and applies polarity conversion. - Optional PWM — gamma-corrected brightness via
PwmLedwith a compact 16+16 byte lookup table. FlexLed/FlexPwmLed— runtime polarity when the configuration comes from a config file instead of a type parameter.- Zero mandatory dependencies — only
embedded-hal1.0.
Usage
use ;
use ;
let pin = new;
let mut led = from_pin;
led.on.unwrap;
led.off.unwrap;
PWM with gamma correction
Enable the pwm feature:
= { = "0.1", = ["pwm"] }
use ;
use ActiveLow;
let mut led = new;
led.set_brightness; // ~50% perceived brightness
Runtime polarity
When the polarity is read from configuration at runtime:
use ;
let pol = if config.active_low else ;
let mut led = new.unwrap;
led.toggle.unwrap;
Features
| Feature | Description | Extra deps |
|---|---|---|
| (none) | GPIO LED with compile-time polarity | — |
pwm |
PwmLed + FlexPwmLed with gamma-corrected brightness |
— |
defmt |
defmt::Format impls for all public types |
defmt |
License
Licensed under either of Apache License 2.0 or MIT license at your option.