rust-embedded / embedded-hal

A Hardware Abstraction Layer (HAL) for embedded systems
Apache License 2.0
1.93k stars 197 forks source link

Undo constrain / split peripheral #210

Open mchodzikiewicz opened 4 years ago

mchodzikiewicz commented 4 years ago

Hi!

I cannot find any valuable information about how to handle my case: I need to reconfigure the pin between its alternate function (UART in my case) and GPIO input. I am rust beginner, very impressed by the type state and entire safety net built around it, but I can't see any way to unconstrain / unsplit resources I'd like to repurpose.

Not sure if it fits general embedded-hal scope, because handling hardware resources is kinda device specific, but I think this is very generic case - perhaps some interface could be provided (or exists) to allow this kind of behavior...

Not sure if I am not missing something by using wrong keywords, but I didn't find anything viable on this topic

ryankurte commented 4 years ago

Hey thanks for the issue, how to constrain / construct / unconstrain components is currently a feature of the device-specific HAL implementation, and we don't have any core guidelines about this at the moment.

There's still a bunch of work going on with the individual implementations to discover these use-cases and improve the usability of these crates, and in future we will hopefully be able to provide more consistent guidelines and documentation, but for now your best bet is to raise an issue on the device HAL crate (and dig through the docs for the related UART type).