mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-22 06:42:32 +00:00
Impl OutputPin/StatefulOutputPin/ToggleableOutputPin
This commit implements embedded_hal_02::digital::v2 OutputPin, StatefulOutputPin, and ToggleableOutputPin for embassy-rp.
This commit is contained in:
parent
c8461709e3
commit
027ab3371e
@ -404,6 +404,38 @@ mod eh02 {
|
|||||||
Ok(self.toggle())
|
Ok(self.toggle())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'d, T: Pin> embedded_hal_02::digital::v2::OutputPin for OutputOpenDrain<'d, T> {
|
||||||
|
type Error = Infallible;
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn set_high(&mut self) -> Result<(), Self::Error> {
|
||||||
|
Ok(self.set_high())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
fn set_low(&mut self) -> Result<(), Self::Error> {
|
||||||
|
Ok(self.set_low())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'d, T: Pin> embedded_hal_02::digital::v2::StatefulOutputPin for OutputOpenDrain<'d, T> {
|
||||||
|
fn is_set_high(&self) -> Result<bool, Self::Error> {
|
||||||
|
Ok(self.is_set_high())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_set_low(&self) -> Result<bool, Self::Error> {
|
||||||
|
Ok(self.is_set_low())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'d, T: Pin> embedded_hal_02::digital::v2::ToggleableOutputPin for OutputOpenDrain<'d, T> {
|
||||||
|
type Error = Infallible;
|
||||||
|
#[inline]
|
||||||
|
fn toggle(&mut self) -> Result<(), Self::Error> {
|
||||||
|
Ok(self.toggle())
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "unstable-traits")]
|
#[cfg(feature = "unstable-traits")]
|
||||||
|
Loading…
Reference in New Issue
Block a user