fuchsnj / one-wire-bus

A Rust 1-wire implementation for embedded-hal
23 stars 23 forks source link

InputPin + OutputPin not possible? #2

Open jorgeig-space opened 3 years ago

jorgeig-space commented 3 years ago

Hi,

Many thanks for writing this library!

I am trying to use this with an STM32 chip. In the available HALs for STM32, a pin can only be declared InputPin or OutputPin but not both at the same time (obviously, as changing that is a hardware change).

How are you using the library? On which chips? Do you have a fully working example, including the use of a HAL?

MabezDev commented 2 years ago

For hardware that doesn't support being in both Input and Output at the same time it's currently unusable.

However with eh 1.0, there is IoPin which is a trait for handling pins that can only be in one state at a time. I'd recommend PR'ing the update to eh 1.0, and using IoPin instead of requiring Input and Output trait bounds.