Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for all U5 ADCs #525

Merged
merged 4 commits into from
Dec 22, 2024
Merged

Add support for all U5 ADCs #525

merged 4 commits into from
Dec 22, 2024

Conversation

klownfish
Copy link
Contributor

@klownfish klownfish commented Sep 25, 2024

This merge request adds register definitions for all ADCs on the U5 series. Currently only ADC4 is supported.

The reason for this is that not all ADCs on the U5 are of the same version. Some are similar to V4 (ADC1/2), while others are closer to V3 (ADC4). To work around this I have prefixed everything related to ADC4 and instantiated both versions as blocks in adc_u5.yaml. This approach seemed to produce the cleanest results when implementing the driver in embassy.

I refer to ADC4 explicitly everywhere which might seem questionable but I believe it’s the best approach. It has been a constant pattern throughout the U5 series and given how the modules are numbered (1, 2, and 4) I think it's clear that 4 is the outlier.

First draft of the embassy driver:
https://github.com/klownfish/embassy/tree/u5_adc/embassy-stm32/src/adc

related issue:
#522

@embassy-ci
Copy link

embassy-ci bot commented Sep 25, 2024

@MDr164
Copy link
Contributor

MDr164 commented Dec 16, 2024

Looks good to me. I'll give it a try in conjunction with your updated ADC driver for the U5 series this week.

@embassy-ci
Copy link

embassy-ci bot commented Dec 18, 2024

@Dirbaio Dirbaio added this pull request to the merge queue Dec 22, 2024
Merged via the queue into embassy-rs:main with commit 392e412 Dec 22, 2024
1 check passed
@MDr164
Copy link
Contributor

MDr164 commented Dec 23, 2024

I tested the updated metapac and the driver you created in your fork using different voltage on all the defined ADC variants and they all worked correctly! @klownfish would you mind opening a PR on the embassy repo for discussion on the new ADC driver you created to make use of the updated ADC definitions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants