summaryrefslogtreecommitdiffstats
path: root/src/construction.rs
diff options
context:
space:
mode:
authorDiego Barrios Romero <eldruin@gmail.com>2018-11-21 09:35:37 +0100
committerDiego Barrios Romero <eldruin@gmail.com>2018-11-21 09:35:37 +0100
commit5485d9655e2ab3a6d04e5f69b246f5db4d2c5936 (patch)
tree84bb1e825656d4c523b65edc5d7780fbb060c8cc /src/construction.rs
parente4a1ac5a04d021ef026c559354e9913ae59864d8 (diff)
downloadads1x1x-async-5485d9655e2ab3a6d04e5f69b246f5db4d2c5936.tar.gz
ads1x1x-async-5485d9655e2ab3a6d04e5f69b246f5db4d2c5936.tar.xz
ads1x1x-async-5485d9655e2ab3a6d04e5f69b246f5db4d2c5936.zip
Code formatting
Diffstat (limited to 'src/construction.rs')
-rw-r--r--src/construction.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/construction.rs b/src/construction.rs
index ab100fd..61abb06 100644
--- a/src/construction.rs
+++ b/src/construction.rs
@@ -1,42 +1,40 @@
//! Constructor/destructor functions.
extern crate embedded_hal as hal;
-use hal::blocking;
use core::marker::PhantomData;
-use { Ads1x1x, DEVICE_BASE_ADDRESS, SlaveAddr, ic, Config, mode, FullScaleRange };
+use hal::blocking;
use interface::I2cInterface;
-
+use {ic, mode, Ads1x1x, Config, FullScaleRange, SlaveAddr, DEVICE_BASE_ADDRESS};
macro_rules! impl_new_destroy {
( $IC:ident, $create:ident, $destroy:ident, $conv:ty ) => {
impl<I2C, E> Ads1x1x<I2cInterface<I2C>, ic::$IC, $conv, mode::OneShot>
where
- I2C: blocking::i2c::Write<Error = E> + blocking::i2c::WriteRead<Error = E>
+ I2C: blocking::i2c::Write<Error = E> + blocking::i2c::WriteRead<Error = E>,
{
/// Create a new instance of the device in OneShot mode.
pub fn $create(i2c: I2C, address: SlaveAddr) -> Self {
Ads1x1x {
iface: I2cInterface {
i2c,
- address: address.addr(DEVICE_BASE_ADDRESS)
+ address: address.addr(DEVICE_BASE_ADDRESS),
},
config: Config::default(),
fsr: FullScaleRange::default(),
a_conversion_was_started: false,
_conv: PhantomData,
_ic: PhantomData,
- _mode: PhantomData
+ _mode: PhantomData,
}
}
}
- impl<I2C, CONV, MODE> Ads1x1x<I2cInterface<I2C>, ic::$IC, CONV, MODE>
- {
+ impl<I2C, CONV, MODE> Ads1x1x<I2cInterface<I2C>, ic::$IC, CONV, MODE> {
/// Destroy driver instance, return I²C bus instance.
pub fn $destroy(self) -> I2C {
self.iface.i2c
}
}
- }
+ };
}
impl_new_destroy!(Ads1013, new_ads1013, destroy_ads1013, ic::Resolution12Bit);