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

ADC example doesn't work because of imports #342

Open
stonefoxes opened this issue Jun 13, 2023 · 2 comments
Open

ADC example doesn't work because of imports #342

stonefoxes opened this issue Jun 13, 2023 · 2 comments

Comments

@stonefoxes
Copy link

Hi, I'm trying to use ADC on STM32L451, according to examples: simple read and read with DMA. But I have the following error:

39 |     adc::{Adc, AdcCommon, DmaMode, SampleTime, Sequence},
   |           ^^^  ^^^^^^^^^ no `AdcCommon` in `adc`
   |           |
   |           no `Adc` in `adc`
   |           help: a similar name exists in the module: `ADC`

What am I doing wrong and how to make it work? Thank you in advance.

@stonefoxes
Copy link
Author

It seems like cargo has an old version in registry "26e0917e782402251e3eeaef53f1adb4fad22a42" according to .cargo_vsc_info.json file. If I use git version of HAL in my Cargo.toml imports are fine. Should we bump version and publish actual repo on cargo?

@muingY
Copy link

muingY commented Apr 5, 2024

@stonefoxes I also struggled with the same issue, but I found a solution in the past records of the ADC example. The problem code works when changed as follows.
let mut adc = ADC::new(dp.ADC1, dp.ADC_COMMON, &mut rcc.ahb2, &mut rcc.ccipr, &mut delay);

Check the full example here:
https://github.com/stm32-rs/stm32l4xx-hal/blob/c2e63acc4035537b07ceae84c31f8057484a964f/examples/adc.rs

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

No branches or pull requests

2 participants