Skip to main content

Crate pennant

Crate pennant 

Source
Expand description

LED animation effects for embedded projects.

This crate provides reusable animation effects that work with RGB LEDs. It is no_std compatible for embedded use.

§StatusLed Trait

The StatusLed trait provides a common interface for LED drivers that can display status colors. This enables crates like rustyfarian-network to show connection status without depending on a specific LED implementation.

§NoLed

NoLed is a zero-size stub that implements StatusLed with an Infallible error type. Use it when a type parameter requires a StatusLed but no physical LED is present.

§SimpleLed (opt-in via hal feature)

For simple on/off GPIO LEDs (not RGB), enable the hal feature to get the [SimpleLed] adapter, which implements StatusLed by mapping RGB colors to on/off based on brightness. It is generic over [embedded_hal::digital::OutputPin], so it works with any HAL or test mock.

§PulseEffect

The PulseEffect creates smooth pulsing brightness animations.

Structs§

NoLed
A no-op LED stub that satisfies the StatusLed trait without any hardware dependency.
PulseEffect
A pulsing brightness effect that smoothly oscillates between dim and bright.

Enums§

PulseEffectError
Error type for PulseEffect configuration.

Constants§

DEFAULT_BRIGHTNESS_THRESHOLD
Default brightness threshold for simple on/off LED decisions.

Traits§

AsyncStatusLed
Async counterpart of StatusLed for drivers with async I/O.
StatusLed
Trait for LED status indicators.

Functions§

exceeds_threshold
Determines if an RGB color exceeds a brightness threshold.
max_channel_brightness
Calculates the maximum channel value from an RGB color.