Skip to content

Commit

Permalink
Remove a superfluous trait bound that broke non-totem-pole devices
Browse files Browse the repository at this point in the history
There is no requirement for the hal trait implementations (`InputPin`,
`OutputPin`, `StatefulOutputPin`) to require a `PortDriverTotemPole`.
In fact, the presence of this bound means non-totem-pole devices no
longer have hal trait implementations.

Drop the superfluous bound to make non-totem-pole devices work again.

Fixes: e7712de ("feat: Update to embedded-hal 1.0.0")
Reported-by: Thomas Riedler <[email protected]>
  • Loading branch information
Rahix committed Jul 5, 2024
1 parent 89c302d commit 8d5a829
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/pin.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use core::marker::PhantomData;
use embedded_hal::digital::{self as hal_digital, ErrorType};
use embedded_hal::digital::{self as hal_digital};

/// Representation of a port-expander pin.
///
Expand Down Expand Up @@ -71,9 +71,9 @@ impl<PDE> From<PDE> for PinError<PDE> {
}
}

impl<'a, MODE, MUTEX, PD> ErrorType for Pin<'a, MODE, MUTEX>
impl<'a, MODE, MUTEX, PD> hal_digital::ErrorType for Pin<'a, MODE, MUTEX>
where
PD: crate::PortDriver + crate::PortDriverTotemPole,
PD: crate::PortDriver,
PD::Error: core::fmt::Debug,
MUTEX: crate::PortMutex<Port = PD>,
{
Expand Down Expand Up @@ -199,7 +199,7 @@ where

impl<'a, MODE: crate::mode::HasInput, MUTEX, PD> hal_digital::InputPin for Pin<'a, MODE, MUTEX>
where
PD: crate::PortDriver + crate::PortDriverTotemPole,
PD: crate::PortDriver,
<PD as crate::PortDriver>::Error: core::fmt::Debug,
MUTEX: crate::PortMutex<Port = PD>,
{
Expand Down Expand Up @@ -258,7 +258,7 @@ where

impl<'a, MODE: crate::mode::HasOutput, MUTEX, PD> hal_digital::OutputPin for Pin<'a, MODE, MUTEX>
where
PD: crate::PortDriver + crate::PortDriverTotemPole,
PD: crate::PortDriver,
<PD as crate::PortDriver>::Error: core::fmt::Debug,
MUTEX: crate::PortMutex<Port = PD>,
{
Expand All @@ -274,7 +274,7 @@ where
impl<'a, MODE: crate::mode::HasOutput, MUTEX, PD> hal_digital::StatefulOutputPin
for Pin<'a, MODE, MUTEX>
where
PD: crate::PortDriver + crate::PortDriverTotemPole,
PD: crate::PortDriver,
<PD as crate::PortDriver>::Error: core::fmt::Debug,
MUTEX: crate::PortMutex<Port = PD>,
{
Expand Down

0 comments on commit 8d5a829

Please sign in to comment.