WIP: Fix ADC support for STM32L47x/L48x #191
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Rationale
The current ADC implementation does not support STM32L47x and STM43L78x families. On MCUs from these families, you need to set a bit in the GPIOx_ASCR register to connect the pin to the ADC internally. This pull request adds support for these families.
Current issues
This PR does not feature-gate the use of the GPIOx_ASCR register, thus making the fix incompatible with other MCUs. The current feature-gating schema is not adapted for such cases, as stated in #29.
Design questions
To allow pin connection to the ADC, I have added an
AnalogPin
trait withconnect_adc
anddisconnect_adc
functions that I call in the ADC implementation. Do you think it is the way to go, or should I modify the registers directly in the ADC implementation code?