mirror of https://github.com/eldruin/ds323x-rs
Small simplification
parent
1b13f482ae
commit
b22cba6c63
|
@ -58,13 +58,12 @@ where
|
|||
&mut self,
|
||||
rate: TempConvRate,
|
||||
) -> Result<(), Error<E, ()>> {
|
||||
let status;
|
||||
match rate {
|
||||
TempConvRate::_64s => status = self.status & !BitFlags::CRATE1 & !BitFlags::CRATE0,
|
||||
TempConvRate::_128s => status = self.status & !BitFlags::CRATE1 | BitFlags::CRATE0,
|
||||
TempConvRate::_256s => status = self.status | BitFlags::CRATE1 & !BitFlags::CRATE0,
|
||||
TempConvRate::_512s => status = self.status | BitFlags::CRATE1 | BitFlags::CRATE0,
|
||||
}
|
||||
let status = match rate {
|
||||
TempConvRate::_64s => self.status & !BitFlags::CRATE1 & !BitFlags::CRATE0,
|
||||
TempConvRate::_128s => self.status & !BitFlags::CRATE1 | BitFlags::CRATE0,
|
||||
TempConvRate::_256s => self.status | BitFlags::CRATE1 & !BitFlags::CRATE0,
|
||||
TempConvRate::_512s => self.status | BitFlags::CRATE1 | BitFlags::CRATE0,
|
||||
};
|
||||
self.write_status_without_clearing_alarm(status)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,13 +61,12 @@ where
|
|||
&mut self,
|
||||
rate: TempConvRate,
|
||||
) -> Result<(), Error<CommE, PinE>> {
|
||||
let status;
|
||||
match rate {
|
||||
TempConvRate::_64s => status = self.status & !BitFlags::CRATE1 & !BitFlags::CRATE0,
|
||||
TempConvRate::_128s => status = self.status & !BitFlags::CRATE1 | BitFlags::CRATE0,
|
||||
TempConvRate::_256s => status = self.status | BitFlags::CRATE1 & !BitFlags::CRATE0,
|
||||
TempConvRate::_512s => status = self.status | BitFlags::CRATE1 | BitFlags::CRATE0,
|
||||
}
|
||||
let status = match rate {
|
||||
TempConvRate::_64s => self.status & !BitFlags::CRATE1 & !BitFlags::CRATE0,
|
||||
TempConvRate::_128s => self.status & !BitFlags::CRATE1 | BitFlags::CRATE0,
|
||||
TempConvRate::_256s => self.status | BitFlags::CRATE1 & !BitFlags::CRATE0,
|
||||
TempConvRate::_512s => self.status | BitFlags::CRATE1 | BitFlags::CRATE0,
|
||||
};
|
||||
self.write_status_without_clearing_alarm(status)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue