mirror of https://github.com/eldruin/ds323x-rs
Add function to read the aging offset
parent
ca36814a09
commit
70657dd917
|
@ -59,6 +59,11 @@ where
|
|||
self.iface.write_register(Register::AGING_OFFSET, offset as u8)
|
||||
}
|
||||
|
||||
/// Read the aging offset.
|
||||
pub fn get_aging_offset(&mut self) -> Result<i8, Error<E>> {
|
||||
let offset = self.iface.read_register(Register::AGING_OFFSET)?;
|
||||
Ok(offset as i8)
|
||||
}
|
||||
fn write_control(&mut self, control: u8) -> Result<(), Error<E>> {
|
||||
self.iface.write_register(Register::CONTROL, control)?;
|
||||
self.control = control;
|
||||
|
|
|
@ -55,3 +55,7 @@ change_if_necessary_test!(conv_temp, convert_temperature, CONTROL, CONTROL_POR_V
|
|||
|
||||
set_param_test!(set_aging_offset_min, set_aging_offset, AGING_OFFSET, -128, 0b1000_0000);
|
||||
set_param_test!(set_aging_offset_max, set_aging_offset, AGING_OFFSET, 127, 127);
|
||||
|
||||
get_param_test!(get_aging_offset_min, get_aging_offset, AGING_OFFSET, -128, 0b1000_0000);
|
||||
get_param_test!(get_aging_offset_max, get_aging_offset, AGING_OFFSET, 127, 127);
|
||||
|
||||
|
|
Loading…
Reference in New Issue