Skip to content

Add ADC trait definitions#743

Open
i509VCB wants to merge 1 commit into
rust-embedded:masterfrom
i509VCB:adc
Open

Add ADC trait definitions#743
i509VCB wants to merge 1 commit into
rust-embedded:masterfrom
i509VCB:adc

Conversation

@i509VCB

@i509VCB i509VCB commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Based off discussion from #377

I figured a pull request would be the best way to get feedback. I plan to write a few implementations of these traits, some on MCUs with a form of internal multiplexing for an MCU and another implementation for an external ADC (something like the ADS1015).

@i509VCB i509VCB requested a review from a team as a code owner July 2, 2026 23:17
/// as a channel connected over I2C may return [`Pending`](core::task::Poll::Pending) while the max value is
/// being obtained.
///
/// This is guaranteed to not change once a channel is constructed.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in that case, would it make sense to have as a constant? Or are you considering a case for ADCs with selectable range (presumably trading performance vs resolution)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this is to consider ADCs which a selectable resolution when configured. I can see making a query of max value async as a potential issue. I could see some less than ideal code literally asking over SPI/I2C/remote MCU interface every time for the resolution which would not be so free.

I could make this a non-async function of course which would make access effectively free and allow moving it to the common Channel trait.

@bugadani

bugadani commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Would a nursery crate be a better target for introducing this?

@i509VCB

i509VCB commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

Would a nursery crate be a better target for introducing this?

I am willing to do this (especially so that I don't commit e-h to a major version bump if we mess up). I would prefer the nursery crate lives in this repository if we wanted to do that.

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

Successfully merging this pull request may close these issues.

3 participants