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

Improve API to allow having an array of Analog pins #154

Open
pum-purum-pum-pum opened this issue Mar 17, 2022 · 1 comment
Open

Improve API to allow having an array of Analog pins #154

pum-purum-pum-pum opened this issue Mar 17, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@pum-purum-pum-pum
Copy link

It would be great to be able to store analog pins in the array and process them sequentially.
If one needs to have multiple analog pins in the array it's not possible -- types are different and Channel trait has type-associated function.

Currently, Adc implements OneShot trait which accepts pin.

impl<WORD, PIN> OneShot<Adc, WORD, PIN> for Adc

The pin argument itself is not used, but the associated function of its type channel (which is the channel id) is used instead.

Perhaps we can change the function to fn channel(&self) but it might break some assumptions. Would be great to hear some input

@newAM newAM added the enhancement New feature or request label Mar 17, 2022
@newAM
Copy link
Member

newAM commented Mar 17, 2022

Perhaps we can change the function to fn channel(&self) but it might break some assumptions.

That is one of the changes coming in the 1.0.0 release of embedded-hal: https://docs.rs/embedded-hal/1.0.0-alpha.7/embedded_hal/adc/nb/trait.Channel.html

Would be great to hear some input

Do you know of other STM32 HALs that have this feature? Maybe there's an elegant way to support the trait from the current stable version and the alpha?

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

No branches or pull requests

2 participants