Add ADC trait definitions#743
Conversation
| /// 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. |
There was a problem hiding this comment.
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)?
There was a problem hiding this comment.
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.
|
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. |
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).