fixed bug where led state got wrong state.

This commit is contained in:
puckoprutt 2026-07-13 22:12:49 +02:00
parent a1d0aae6c8
commit d4c5a30bcf

View File

@ -77,13 +77,13 @@ impl<OP: OutputPin, IP: InputPin> LedButton<OP, IP> {
/// set the LED to "On"-state.
pub fn on(&mut self) {
let _ = self.led.on();
self.led_state == LedState::On;
self.led_state = LedState::On;
}
/// set the LED to "Off"-state.
pub fn off(&mut self) {
let _ = self.led.off();
self.led_state == LedState::Off;
self.led_state = LedState::Off;
}
/// toggle the LED.