cfg_reg: split enum into status and cfg
This commit is contained in:
parent
ccd6a1faf9
commit
765cd1d513
|
@ -46,9 +46,9 @@ macro_rules! construct_bitmask {
|
|||
}
|
||||
}
|
||||
|
||||
// Bitmasks for CFG
|
||||
construct_bitmask!(CFGMask;
|
||||
// Bitmasks for CFG write
|
||||
RF_SW, 0, 4, // Reuse RF_SW for Status register
|
||||
RF_SW, 0, 4,
|
||||
LED, 4, 4,
|
||||
PROFILE, 8, 3,
|
||||
IO_UPDATE, 12, 1,
|
||||
|
@ -58,8 +58,12 @@ construct_bitmask!(CFGMask;
|
|||
RST, 19, 1,
|
||||
IO_RST, 20, 1,
|
||||
CLK_SEL1, 21, 1,
|
||||
DIV, 22, 2,
|
||||
DIV, 22, 2
|
||||
);
|
||||
|
||||
// BitMasks for CFG read
|
||||
construct_bitmask!(StatusMask;
|
||||
RF_SW, 0, 4,
|
||||
SMP_ERR, 4, 4,
|
||||
PLL_LOCK, 8, 4,
|
||||
IFC_MODE, 12, 4,
|
||||
|
@ -129,7 +133,7 @@ where
|
|||
/*
|
||||
* Return status
|
||||
*/
|
||||
pub fn get_status(&mut self, status_type: CFGMask) -> Result<u8, Error<E>> {
|
||||
pub fn get_status(&mut self, status_type: StatusMask) -> Result<u8, Error<E>> {
|
||||
match self.set_all_configurations() {
|
||||
Ok(val) => Ok(((val & status_type.get_bitmask()) >> status_type.get_shift()) as u8),
|
||||
Err(e) => Err(e),
|
||||
|
|
Loading…
Reference in New Issue