mirror of https://github.com/eldruin/ds323x-rs
Add function to clear the has been stopped flag
parent
9d236eb8c6
commit
7f3d1220d0
|
@ -20,4 +20,15 @@ where
|
|||
let status = self.iface.read_register(Register::STATUS)?;
|
||||
Ok((status & BitFlags::OSC_STOP) != 0)
|
||||
}
|
||||
|
||||
/// Clear the has been stopped flag.
|
||||
///
|
||||
/// (Does not alter the device register if already cleared).
|
||||
pub fn clear_has_been_stopped_flag(&mut self) -> Result<(), Error<E>> {
|
||||
let status = self.iface.read_register(Register::STATUS)?;
|
||||
if (status & BitFlags::OSC_STOP) != 0 {
|
||||
self.iface.write_register(Register::STATUS, status & !BitFlags::OSC_STOP)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,4 +39,5 @@ macro_rules! change_if_necessary_test {
|
|||
|
||||
change_if_necessary_test!(enable, enable, CONTROL, 0xFF & !BF::EOSC, 0xFF);
|
||||
change_if_necessary_test!(disable, disable, CONTROL, 0xFF, 0xFF & !BF::EOSC);
|
||||
change_if_necessary_test!(clr_stop, clear_has_been_stopped_flag, STATUS, 0xFF & !BF::OSC_STOP, 0xFF);
|
||||
|
||||
|
|
Loading…
Reference in New Issue