summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMarkus Reiter <me@reitermark.us>2024-06-10 21:56:37 +0000
committerGitHub <noreply@github.com>2024-06-10 23:56:37 +0200
commit00830f4e5569a381afbdfce270e478c5fd25401f (patch)
tree8940dd071a18d8b1ab93ca25cea89b5ea52f269d /examples
parent0ff4c7b448fd388015d4903b774c63991356b954 (diff)
downloadads1x1x-async-00830f4e5569a381afbdfce270e478c5fd25401f.tar.gz
ads1x1x-async-00830f4e5569a381afbdfce270e478c5fd25401f.tar.xz
ads1x1x-async-00830f4e5569a381afbdfce270e478c5fd25401f.zip
Remove `DynamicOneShot` trait. (#19)
* Remove `DynamicOneShot` trait. * Update changelog.
Diffstat (limited to 'examples')
-rw-r--r--examples/trait.rs23
1 files changed, 0 insertions, 23 deletions
diff --git a/examples/trait.rs b/examples/trait.rs
deleted file mode 100644
index 3eff5b5..0000000
--- a/examples/trait.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// This example demonstrates the use of the `DynamicOneSot` trait to ease the usage
-// of the `Ads1x1x` struct in functions.
-
-use linux_embedded_hal::I2cdev;
-use nb::block;
-
-use ads1x1x::{Ads1x1x, ChannelSelection, DynamicOneShot, SlaveAddr};
-
-/// Read a single value from channel A.
-/// Returns 0 on Error.
-pub fn read<E, A: DynamicOneShot<Error = E>>(adc: &mut A) -> i16 {
- block!(adc.read(ChannelSelection::SingleA0)).unwrap_or(0)
-}
-
-fn main() {
- let dev = I2cdev::new("/dev/i2c-1").unwrap();
- let mut adc = Ads1x1x::new_ads1115(dev, SlaveAddr::default());
-
- let value = read(&mut adc);
- println!("Measurement: {}", value);
- // get I2C device back
- let _dev = adc.destroy_ads1115();
-}