summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Barrios Romero <eldruin@gmail.com>2020-04-24 09:33:02 +0200
committerDiego Barrios Romero <eldruin@gmail.com>2020-04-24 09:33:02 +0200
commit7bd01a81e73c7234b69fc8dd66b80de902625641 (patch)
tree8c812e17d0cf69244fb84615aa8a6227d168aef0
parente69a5a6dd76bca1ee2b50124859fee4a841285c4 (diff)
downloadads1x1x-async-7bd01a81e73c7234b69fc8dd66b80de902625641.tar.gz
ads1x1x-async-7bd01a81e73c7234b69fc8dd66b80de902625641.tar.xz
ads1x1x-async-7bd01a81e73c7234b69fc8dd66b80de902625641.zip
Fix imports and enhance documentation
-rw-r--r--examples/typed.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/examples/typed.rs b/examples/typed.rs
index 1a2e1e7..22a2212 100644
--- a/examples/typed.rs
+++ b/examples/typed.rs
@@ -1,13 +1,15 @@
-// This example demonstrates how the `Ads1x1x` struct may
-// look in a type signature.
+// This example demonstrates the use of a type alias for the `Ads1x1x` struct
+// to ease usage in signatures.
#[macro_use(block)]
extern crate nb;
-use embedded_hal;
+extern crate embedded_hal;
use embedded_hal::adc::OneShot;
-use linux_embedded_hal;
+extern crate linux_embedded_hal;
+use linux_embedded_hal::I2cdev;
+extern crate ads1x1x;
use ads1x1x::{
channel::SingleA0,
ic::{Ads1115, Resolution16Bit},
@@ -15,8 +17,7 @@ use ads1x1x::{
Ads1x1x, SlaveAddr,
};
-use linux_embedded_hal::I2cdev;
-
+/// Type alias
type Adc = Ads1x1x<I2cInterface<I2cdev>, Ads1115, Resolution16Bit, ads1x1x::mode::OneShot>;
/// Read a single value from channel A.