eldruin / ads1x1x-rs

Platform-agnostic Rust driver for the ADS1x1x ultra-small, low-power analog-to-digital converters (ADC). Compatible with ADS1013, ADS1014, ADS1015, ADS1113, ADS1114 and ADS1115
https://blog.eldruin.com/ads1x1x-analog-to-digital-converter-driver-in-rust/
Apache License 2.0
32 stars 8 forks source link

Example across function / struct boundary #2

Closed David-OConnor closed 4 years ago

David-OConnor commented 4 years ago

Hi. It would be nice to have an example where you pass the adc to a function, struct or enum, or otherwise where you have to declare its type. Eg:


fn read(adc: Ads1x1x<
        ?
        ?,
        ads1x1x::DataRate16Bit,
        ads1x1x::mode::OneShot>) -> f32 {
// ...
}|
eldruin commented 4 years ago

Sounds good. I fixed some details and merged it now. Thank you!