summaryrefslogtreecommitdiffstats
path: root/src/conversion.rs
diff options
context:
space:
mode:
authorMarkus Reiter <me@reitermark.us>2024-01-12 20:24:51 +0100
committerDiego Barrios Romero <eldruin@gmail.com>2024-01-19 11:23:31 +0100
commitb3ca672f70c71194da40a7670549a8264c13d971 (patch)
tree1f316806351a059ca5b5fccbcf4d790b94c0b471 /src/conversion.rs
parented4cc1dbc5b048332b68a0ebc1d7113d482a74a2 (diff)
downloadads1x1x-async-b3ca672f70c71194da40a7670549a8264c13d971.tar.gz
ads1x1x-async-b3ca672f70c71194da40a7670549a8264c13d971.tar.xz
ads1x1x-async-b3ca672f70c71194da40a7670549a8264c13d971.zip
Update to `embedded-hal` 1.0.
Diffstat (limited to 'src/conversion.rs')
-rw-r--r--src/conversion.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/conversion.rs b/src/conversion.rs
index d6aea82..142de0e 100644
--- a/src/conversion.rs
+++ b/src/conversion.rs
@@ -7,7 +7,7 @@ pub trait ConvertThreshold<E>: private::Sealed {
impl<E> ConvertThreshold<E> for ic::Resolution12Bit {
fn convert_threshold(value: i16) -> Result<u16, Error<E>> {
- if value < -2048 || value > 2047 {
+ if !(-2048..=2047).contains(&value) {
return Err(Error::InvalidInputData);
}
Ok((value << 4) as u16)