status-led
no_std monochrome status LED abstraction for the embassy ecosystem.
- Polarity —
ActiveHigh/ActiveLowchosen at construction time via [PolarityMode]. - 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. - 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.3", = ["pwm"] }
use ;
let mut led = new.unwrap;
led.set_brightness.unwrap; // ~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 runtime polarity | — |
pwm |
PwmLed 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.