You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Statically allocating space for multiple gpio pins is easy with AnyPin, but there is currently no equivalent for the TouchPin trait.
Also, it makes any async function that needs to work with TouchPin generic, meaning if invoked with different pins, futures it returns are different types.
Solution
A TouchPin::degrade(self) -> AnyTouchPin method, analogous to Pin::degrade(self) -> AnyPin.
Alternatives
Currently I'm just dealing with generics, using function signatures similar to this:
Good idea, I think. If we do this, we should also add the same for the rest of the pin types (AnalogPin, RtcPin, but not InputPin/OutputPin). Internally, we can just convert back to AnyPin so it wouldn't be too much change, either.
Motivations
Statically allocating space for multiple gpio pins is easy with
AnyPin
, but there is currently no equivalent for theTouchPin
trait.Also, it makes any async function that needs to work with
TouchPin
generic, meaning if invoked with different pins, futures it returns are different types.Solution
A
TouchPin::degrade(self) -> AnyTouchPin
method, analogous toPin::degrade(self) -> AnyPin
.Alternatives
Currently I'm just dealing with generics, using function signatures similar to this:
Additional context
The text was updated successfully, but these errors were encountered: