1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
use crate::{ActiveHigh, ActiveLow, InputSwitch, Switch}; use embedded_hal::digital::v2::InputPin; impl<T: InputPin> InputSwitch for Switch<T, ActiveHigh> { type Error = <T as InputPin>::Error; fn is_active(&self) -> Result<bool, Self::Error> { self.pin.is_high() } } impl<T: InputPin> InputSwitch for Switch<T, ActiveLow> { type Error = <T as InputPin>::Error; fn is_active(&self) -> Result<bool, Self::Error> { self.pin.is_low() } }