Skip to content

Commit 49a6dae

Browse files
committed
Move shift-constant 24 to BIT_TRACENA
1 parent b739654 commit 49a6dae

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/peripheral/dcb.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ use volatile_register::{RW, WO};
44

55
use peripheral::DCB;
66

7+
const BIT_TRACENA: u8 = 24;
8+
79
/// Register block
810
#[repr(C)]
911
pub struct RegisterBlock {
@@ -24,12 +26,12 @@ impl DCB {
2426
/// soft-reset, only on power reset.
2527
pub fn enable_trace(&mut self) {
2628
// set bit 24 / TRACENA
27-
unsafe { self.demcr.modify(|w| w | (0x01 << 24)); }
29+
unsafe { self.demcr.modify(|w| w | (0x01 << BIT_TRACENA)); }
2830
}
2931

3032
/// Disables TRACE. See `DCB::enable_trace()` for more details
3133
pub fn disable_trace(&mut self) {
3234
// unset bit 24 / TRACENA
33-
unsafe { self.demcr.modify(|w| w & !(0x01 << 24)); }
35+
unsafe { self.demcr.modify(|w| w & !(0x01 << BIT_TRACENA)); }
3436
}
3537
}

0 commit comments

Comments
 (0)