forked from M-Labs/humpback-dds
cfg_reg: add getter function
This commit is contained in:
parent
0543e98956
commit
8f4a97c97e
@ -88,7 +88,7 @@ where
|
||||
((self.data & 0x0000FF00) >> 8) as u8,
|
||||
((self.data & 0x000000FF) >> 0) as u8,
|
||||
]).map_err(Error::SPI) {
|
||||
Ok(arr) => Ok(((arr[0] as u32) << 16) | ((arr[1] as u32) << 8) | arr[2] as u32),
|
||||
Ok(arr) => Ok(self.data),
|
||||
Err(e) => Err(e),
|
||||
}
|
||||
}
|
||||
@ -106,6 +106,10 @@ where
|
||||
// Write all configurations at the same time
|
||||
self.set_all_configurations()
|
||||
}
|
||||
|
||||
pub fn get_configuration(&mut self, config_type: CFGMask) -> u8 {
|
||||
((self.data & config_type.get_bitmask()) >> config_type.get_shift()) as u8
|
||||
}
|
||||
}
|
||||
|
||||
impl<SPI, E> Transfer<u8> for ConfigRegister<SPI>
|
||||
|
Loading…
Reference in New Issue
Block a user