-
Notifications
You must be signed in to change notification settings - Fork 200
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
Add ADC Voltmeter
and Ammeter
traits.
#569
base: master
Are you sure you want to change the base?
Conversation
That's a good point! Also, it may be challenging to take something implementing However, how do you ask every implementation to know the voltage range of an arbitrary device? Would having an My apologies if I've missed your point, though! 😄 |
I have changed the API here now to measure voltage instead of the raw value.
I think you may have indeed missed my point. 😄 I am talking about the voltage range of the ADC itself. So it's not an arbitrary device's voltage, but the voltage the ADC is actually measuring. For example, with a 16-bit ADC with a range of ±5V, this means Then you can swap out ADCs, as long as they support the range you need. And the rest of the code only depends on the measured voltage. As a simple example, I have a water depth sensor with a range of 0-5V corresponding to 0-5m, which would be a 1:1 mapping from mV to mm. So as long as I have any ADC that can measure between 0 and 5V, I can implement e.g. a |
Got it - I thought I was missing something! Thanks for the clarification |
29d5d76
to
0bd50b5
Compare
34382a5
to
cb86eb0
Compare
AdcChannel
trait.AdcChannel
trait.~~ Add ADC Voltmeter
and Ammeter
traits.
AdcChannel
trait.~~ Add ADC Voltmeter
and Ammeter
traits.Voltmeter
and Ammeter
traits.
Given ADCs measure either voltage or current, I have now split the |
I would be interested in seeing this gain more traction. My particular use case is for developing generic drivers for analog temperature sensors. Would be nice for the drivers to not have to depend on any particular ADC implementation. |
This adds an
AdcChannel
trait as mentioned in #377.Still needs to be tested by implementing an actual driver. I feel there is something still missing with regard to how the return value can actually be used further. Is it even practical to have this trait without having a corresponding unit and a lower/upper bound for converting the raw value?