1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! Simple GPIO LED adapter for StatusLed trait.
//!
//! Maps RGB colors to on/off based on a brightness threshold.
//! Use this for boards with a simple on/off LED instead of an RGB LED.
//!
//! The actual threshold logic is in the platform-independent [`exceeds_threshold`](crate::exceeds_threshold)
//! function, keeping this module as a thin hardware wrapper.
//!
//! Generic over [`embedded_hal::digital::OutputPin`], so it works with any HAL
//! (ESP-IDF, nrf-hal, stm32-hal, or test mocks).
//!
//! # ESP-IDF example
//!
//! `esp-idf-hal`'s `PinDriver` implements `OutputPin`, so you can use it directly:
//!
//! ```ignore
//! use esp_idf_hal::gpio::PinDriver;
//! use pennant::{SimpleLed, StatusLed};
//!
//! let pin = PinDriver::output(peripherals.pins.gpio35)?;
//! let mut led = SimpleLed::new(pin);
//! led.set_color(rgb::RGB8::new(0, 0, 255))?;
//! ```
use crate::;
use OutputPin;
use RGB8;
/// Simple on/off LED that implements StatusLed.
///
/// Converts RGB colors to on/off by checking if any color channel
/// exceeds the brightness threshold (strict greater-than comparison).
/// Equality does not turn the LED on, avoiding false triggers from low-level noise.