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

how a generic pin #3321

Open
adavida opened this issue Sep 8, 2024 · 2 comments
Open

how a generic pin #3321

adavida opened this issue Sep 8, 2024 · 2 comments

Comments

@adavida
Copy link

adavida commented Sep 8, 2024

currently testing embassy on stm32f401 (blackpill board)

I want to read the value of adc from a list:

for pin in pins.iter_mut() {
        info!("{}", adc.read(pin));
 }

or

for analog in pins.iter_mut() {
        info!("{}", analog.read());
 }

it was possible to generate list pins ?

thanks

@Dirbaio
Copy link
Member

Dirbaio commented Sep 8, 2024

You can do .degrade_adc() on a pin, which converts all pins to the same type, AnyAdcChannel.

See example: https://github.com/embassy-rs/embassy/blob/main/examples/stm32h7/src/bin/adc_dma.rs#L55-L68

@adavida
Copy link
Author

adavida commented Sep 9, 2024

Thank
this work ;-)

by only on master

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