File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -20,18 +20,22 @@ pub struct RegisterBlock {
20
20
}
21
21
22
22
impl DCB {
23
- /// Enables TRACE. This is for example required by the
23
+ /// Enables TRACE. This is for example required by the
24
24
/// `peripheral::DWT` cycle counter to work properly.
25
25
/// As by STM documentation, this flag is not reset on
26
26
/// soft-reset, only on power reset.
27
27
pub fn enable_trace ( & mut self ) {
28
28
// set bit 24 / TRCENA
29
29
unsafe { self . demcr . modify ( |w| w | DCB_DEMCR_TRCENA ) ; }
30
30
}
31
-
31
+
32
32
/// Disables TRACE. See `DCB::enable_trace()` for more details
33
33
pub fn disable_trace ( & mut self ) {
34
34
// unset bit 24 / TRCENA
35
35
unsafe { self . demcr . modify ( |w| w & !DCB_DEMCR_TRCENA ) ; }
36
+
37
+ /// Is there a debugger attached?
38
+ pub fn is_debugger_attached ( & self ) -> bool {
39
+ self . dhcsr . read ( ) & 0x1 == 1
36
40
}
37
41
}
You can’t perform that action at this time.
0 commit comments