embassy-rs / stm32-data

76 stars 116 forks source link

Add support for all U5 ADCs #525

Open klownfish opened 2 months ago

klownfish commented 2 months ago

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: https://github.com/embassy-rs/stm32-data/issues/522

embassy-ci[bot] commented 2 months ago

diff: https://ci.embassy.dev/jobs/1889b04d5be2/artifacts/diff.html