Add support for debugger check
@@ -33,5 +33,9 @@ impl DCB {
pub fn disable_trace(&mut self) {
// unset bit 24 / TRCENA
unsafe { self.demcr.modify(|w| w & !DCB_DEMCR_TRCENA); }
+
+ /// Is there a debugger attached?
+ pub fn is_debugger_attached(&self) -> bool {
+ self.dhcsr.read() & 0x1 == 1
}
}
