diff --git a/src/config_register.rs b/src/config_register.rs index 5b40b3e..c2f72da 100644 --- a/src/config_register.rs +++ b/src/config_register.rs @@ -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, - // BitMasks for CFG read + 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> { + pub fn get_status(&mut self, status_type: StatusMask) -> Result> { match self.set_all_configurations() { Ok(val) => Ok(((val & status_type.get_bitmask()) >> status_type.get_shift()) as u8), Err(e) => Err(e),