diff options
author | Diego Barrios Romero <eldruin@gmail.com> | 2018-11-17 14:50:33 +0100 |
---|---|---|
committer | Diego Barrios Romero <eldruin@gmail.com> | 2018-11-17 14:50:33 +0100 |
commit | 065e5eab4a0278b77bd0b14167a662776f491921 (patch) | |
tree | d1a1c974e238aaf5a885cb8f51284cb74b1c553b /src | |
parent | 6d454af22b9058765677e0190ebb8f57176a671a (diff) | |
download | ads1x1x-async-065e5eab4a0278b77bd0b14167a662776f491921.tar.gz ads1x1x-async-065e5eab4a0278b77bd0b14167a662776f491921.tar.xz ads1x1x-async-065e5eab4a0278b77bd0b14167a662776f491921.zip |
Improve value conversion
Diffstat (limited to 'src')
-rw-r--r-- | src/interface.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/interface.rs b/src/interface.rs index 74d175f..d22f776 100644 --- a/src/interface.rs +++ b/src/interface.rs @@ -78,7 +78,7 @@ where self.i2c .write_read(self.address, &[register], &mut data) .map_err(Error::Comm) - .and(Ok(((data[0] as u16) << 8) | data[1] as u16)) + .and(Ok((u16::from(data[0]) << 8) | u16::from(data[1]))) } } @@ -96,6 +96,6 @@ where .map_err(Error::Comm); self.cs.set_high(); let result = result?; - Ok(((result[0] as u16) << 8) | result[1] as u16) + Ok((u16::from(result[0]) << 8) | u16::from(result[1])) } } |