mirror of https://github.com/eldruin/ds323x-rs
Add function to set the aging offset
parent
c41526b7ec
commit
03b7012ec3
|
@ -62,4 +62,9 @@ where
|
|||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Set the aging offset.
|
||||
pub fn set_aging_offset(&mut self, offset: i8) -> Result<(), Error<E>> {
|
||||
self.iface.write_register(Register::AGING_OFFSET, offset as u8)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -286,6 +286,7 @@ impl Register {
|
|||
const YEAR : u8 = 0x06;
|
||||
const CONTROL : u8 = 0x0E;
|
||||
const STATUS : u8 = 0x0F;
|
||||
const AGING_OFFSET : u8 = 0x10;
|
||||
}
|
||||
|
||||
struct BitFlags;
|
||||
|
|
|
@ -18,6 +18,7 @@ impl Register {
|
|||
pub const MONTH : u8 = 0x05;
|
||||
pub const CONTROL : u8 = 0x0E;
|
||||
pub const STATUS : u8 = 0x0F;
|
||||
pub const AGING_OFFSET : u8 = 0x10;
|
||||
}
|
||||
|
||||
pub struct BitFlags;
|
||||
|
|
|
@ -44,3 +44,5 @@ change_if_necessary_test!(en_32khz_out, enable_32khz_output, STATUS, 0xFF, 0xF
|
|||
change_if_necessary_test!(dis_32khz_out, disable_32khz_output, STATUS, 0xFF & !BF::EN32KHZ, 0xFF);
|
||||
change_if_necessary_test!(clr_stop, clear_has_been_stopped_flag, STATUS, 0xFF & !BF::OSC_STOP, 0xFF);
|
||||
|
||||
set_param_test!(aging_offset_min, set_aging_offset, AGING_OFFSET, -128, 128);
|
||||
set_param_test!(aging_offset_max, set_aging_offset, AGING_OFFSET, 127, 127);
|
||||
|
|
Loading…
Reference in New Issue