diff options
Diffstat (limited to 'src/devices/common.rs')
-rw-r--r-- | src/devices/common.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/devices/common.rs b/src/devices/common.rs index 2234d93..f1509d3 100644 --- a/src/devices/common.rs +++ b/src/devices/common.rs @@ -7,11 +7,10 @@ where DI: interface::WriteData<Error = E> + interface::ReadData<Error = E>, { pub(super) fn set_operating_mode(&mut self, mode: OperatingMode) -> Result<(), Error<E>> { - let config; - match mode { - OperatingMode::OneShot => config = self.config.with_high(BitFlags::OP_MODE), - OperatingMode::Continuous => config = self.config.with_low(BitFlags::OP_MODE), - } + let config = match mode { + OperatingMode::OneShot => self.config.with_high(BitFlags::OP_MODE), + OperatingMode::Continuous => self.config.with_low(BitFlags::OP_MODE), + }; self.iface.write_register(Register::CONFIG, config.bits)?; self.config = config; Ok(()) |