hannobraun / stepper

Universal Stepper Motor Interface
Other
107 stars 18 forks source link

Add support for EN/FAULT pin #3

Open hannobraun opened 3 years ago

hannobraun commented 3 years ago

The driver API does not have support for controlling the power stage or reading a fault. There's a bit of a difficulty here, since the same pin is used for both, and I don't believe there are traits in embedded-hal that could be used for both setting output and reading input on the same pin.

jessebraham commented 3 years ago

To further complicate things, drivers such as the DRV8825 have separate Enable and Fault lines.

Alibirb commented 3 years ago

The driver API does not have support for controlling the power stage or reading a fault. There's a bit of a difficulty here, since the same pin is used for both, and I don't believe there are traits in embedded-hal that could be used for both setting output and reading input on the same pin.

Looks like embedded-hal supports it now. They added IoPin which can toggle between input and output. See the bottom of https://github.com/rust-embedded/embedded-hal/blob/master/src/blocking/digital.rs

hannobraun commented 3 years ago

Nice, thanks for the note, @WriterOfAlicrow!