imxrt-rs / imxrt-iomuxc

Pin definitions, configurations, and multiplexing API
Apache License 2.0
1 stars 14 forks source link

adc::prepare does not set alternate value #36

Closed mciantyre closed 1 year ago

mciantyre commented 1 year ago

Most prepare calls set an alternate value to fully prepare the pin. But this call is missing in adc::prepare.

https://github.com/imxrt-rs/imxrt-iomuxc/blob/f7438338ec520d2380e548e76caf6cc303a0b20c/src/adc.rs#L21-L31

The implementation should call alternate with the GPIO alternate value so the pad can operate as an ADC input. Not setting the alternate can lead to pad reconfiguration issues, like this one.

Hard-coding alternate 5 should work. But ideally, we base the alternate on what the GPIO implementation supplies.