Add a Dbgmcu
struct capable of enabling all relevant DBGMCU.cr fields.
Includes the addition of a `dbgmcu!(...)` macro table which currently takes the form of (cr, $fn_name:ident) where `$fn_name` is something like `set_dbgsleep_d1` etc. The method is unsafe, since it's performing unsafe PAC operations. Two examples modified to demonstrate its usage.
This commit is contained in:
13
embassy-stm32/src/dbgmcu/mod.rs
Normal file
13
embassy-stm32/src/dbgmcu/mod.rs
Normal file
@ -0,0 +1,13 @@
|
||||
pub struct Dbgmcu {}
|
||||
|
||||
impl Dbgmcu {
|
||||
pub unsafe fn enable_all() {
|
||||
crate::pac::DBGMCU.cr().modify(|cr| {
|
||||
crate::pac::dbgmcu! {
|
||||
(cr, $fn_name:ident) => {
|
||||
cr.$fn_name(true);
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -31,6 +31,8 @@ pub mod adc;
|
||||
pub mod clock;
|
||||
#[cfg(dac)]
|
||||
pub mod dac;
|
||||
#[cfg(dbgmcu)]
|
||||
pub mod dbgmcu;
|
||||
#[cfg(all(eth, feature = "net"))]
|
||||
pub mod eth;
|
||||
#[cfg(exti)]
|
||||
|
Reference in New Issue
Block a user