Move the whole shift to the constant
@@ -4,7 +4,7 @@ use volatile_register::{RW, WO};
use peripheral::DCB;
-const BIT_TRACENA: u8 = 24;
+const BIT_TRACENA: u32 = 0x01 << 24;
/// Register block
#[repr(C)]
@@ -26,12 +26,12 @@ impl DCB {
/// soft-reset, only on power reset.
pub fn enable_trace(&mut self) {
// set bit 24 / TRACENA
- unsafe { self.demcr.modify(|w| w | (0x01 << BIT_TRACENA)); }
+ unsafe { self.demcr.modify(|w| w | BIT_TRACENA); }
}
/// Disables TRACE. See `DCB::enable_trace()` for more details
pub fn disable_trace(&mut self) {
// unset bit 24 / TRACENA
- unsafe { self.demcr.modify(|w| w & !(0x01 << BIT_TRACENA)); }
+ unsafe { self.demcr.modify(|w| w & !BIT_TRACENA); }
}
}
