-
Notifications
You must be signed in to change notification settings - Fork 1k
Questions about STM32 adc driver layout. #4018
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
Comments
For some more context I'm trying to make a general purpose struct for handling power buses. I'm also willing to concede that I may just be going out this the wrong way. It just feels so wrong making it store the specific peripheral instead of the generalized definition. |
Looking at the docs, it appears that You might need an |
Doing this as sugested leads to a different Error as Peri Expects a trait. impl<'a, T: Instance> VoltageMonitor<'a, T> {
pub fn new(
enable: Output<'a>,
reset: Output<'a>,
voltage_sense: Peri<'a, impl AnyAdcChannel>,
current_sense: Peri<'a, impl AnyAdcChannel>,
) -> Self {
Self {
enable,
reset,
voltage_sense: voltage_sense.into(),
current_sense: current_sense.into(),
}
}
}
|
Hello Embassy Team,
I have a question regarding the structure of the STM32 ADC driver. I understand that the design must accommodate specifying the pin for measurement, but I have noticed some inconsistencies compared to other drivers.
Currently, there is a trait for a single channel, AdcChannel, and an abstraction, AnyAdcChannel. It appears that AnyAdcChannel has not been updated with the new PeripheralType trait, which prevents its use in contexts such as:
This oversight limits the ability to store ADC channels in structs. While I understand that the degrade_adc function allows conversion between types, I believe it should be possible to directly use voltage_sense.into(), similar to how other peripherals operate.
Thank you for your time and assistance.
I am currently working with the relatively new adc driver for the stm32u5.
The text was updated successfully, but these errors were encountered: