mirror of
https://github.com/rtic-rs/rtic.git
synced 2024-11-27 22:15:07 +01:00
make the register_block field optional in the peripherals! macro
with svd2rust 0.8.x peripheral types are written in UPPERCASE and match their names so specifying the type in the register_block field is no longer necessary.
This commit is contained in:
parent
c1465b2117
commit
b1e54883ac
1 changed files with 16 additions and 0 deletions
16
src/lib.rs
16
src/lib.rs
|
@ -765,6 +765,9 @@ pub unsafe trait LessThanOrEqual<RHS> {}
|
||||||
///
|
///
|
||||||
/// # Example
|
/// # Example
|
||||||
///
|
///
|
||||||
|
/// NOTE With device crates generated using svd2rust 0.8+ you can omit the
|
||||||
|
/// register_block field.
|
||||||
|
///
|
||||||
/// ``` ignore
|
/// ``` ignore
|
||||||
/// #[macro_use]
|
/// #[macro_use]
|
||||||
/// extern crate cortex_m_rtfm;
|
/// extern crate cortex_m_rtfm;
|
||||||
|
@ -797,6 +800,19 @@ macro_rules! peripherals {
|
||||||
$crate::Peripheral<::$device::$RegisterBlock, $crate::$C> =
|
$crate::Peripheral<::$device::$RegisterBlock, $crate::$C> =
|
||||||
unsafe { $crate::Peripheral::_new(::$device::$PERIPHERAL) };
|
unsafe { $crate::Peripheral::_new(::$device::$PERIPHERAL) };
|
||||||
)+
|
)+
|
||||||
|
};
|
||||||
|
($device:ident, {
|
||||||
|
$($PERIPHERAL:ident: Peripheral {
|
||||||
|
ceiling: $C:ident,
|
||||||
|
},)+
|
||||||
|
}) => {
|
||||||
|
$(
|
||||||
|
#[allow(private_no_mangle_statics)]
|
||||||
|
#[no_mangle]
|
||||||
|
static $PERIPHERAL:
|
||||||
|
$crate::Peripheral<::$device::$PERIPHERAL, $crate::$C> =
|
||||||
|
unsafe { $crate::Peripheral::_new(::$device::$PERIPHERAL) };
|
||||||
|
)+
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue