Add rt
feature to HALs, cfg out interrupt handling when not set.
This commit is contained in:
@ -79,7 +79,9 @@ quote = "1.0.15"
|
||||
stm32-metapac = { version = "9", default-features = false, features = ["metadata"]}
|
||||
|
||||
[features]
|
||||
default = ["stm32-metapac/rt"]
|
||||
default = ["rt"]
|
||||
rt = ["stm32-metapac/rt"]
|
||||
|
||||
defmt = ["dep:defmt", "bxcan/unstable-defmt", "embassy-sync/defmt", "embassy-executor/defmt", "embassy-embedded-hal/defmt", "embassy-hal-common/defmt", "embedded-io?/defmt", "embassy-usb-driver?/defmt", "embassy-net-driver/defmt"]
|
||||
memory-x = ["stm32-metapac/memory-x"]
|
||||
exti = []
|
||||
|
@ -295,6 +295,7 @@ fn main() {
|
||||
let channels = channels.iter().map(|(_, dma, ch)| format_ident!("{}_{}", dma, ch));
|
||||
|
||||
g.extend(quote! {
|
||||
#[cfg(feature = "rt")]
|
||||
#[crate::interrupt]
|
||||
unsafe fn #irq () {
|
||||
#(
|
||||
|
@ -291,6 +291,7 @@ macro_rules! foreach_exti_irq {
|
||||
|
||||
macro_rules! impl_irq {
|
||||
($e:ident) => {
|
||||
#[cfg(feature = "rt")]
|
||||
#[interrupt]
|
||||
unsafe fn $e() {
|
||||
on_irq()
|
||||
|
@ -111,6 +111,7 @@ pub use stm32_metapac as pac;
|
||||
#[cfg(not(feature = "unstable-pac"))]
|
||||
pub(crate) use stm32_metapac as pac;
|
||||
|
||||
#[cfg(feature = "rt")]
|
||||
pub use crate::pac::NVIC_PRIO_BITS;
|
||||
|
||||
#[non_exhaustive]
|
||||
|
@ -149,6 +149,7 @@ foreach_peripheral!(
|
||||
};
|
||||
);
|
||||
|
||||
#[cfg(feature = "rt")]
|
||||
macro_rules! irq {
|
||||
($irq:ident) => {
|
||||
mod rng_irq {
|
||||
@ -166,6 +167,7 @@ macro_rules! irq {
|
||||
};
|
||||
}
|
||||
|
||||
#[cfg(feature = "rt")]
|
||||
foreach_interrupt!(
|
||||
(RNG) => {
|
||||
irq!(RNG);
|
||||
|
@ -40,6 +40,7 @@ type T = peripherals::TIM15;
|
||||
foreach_interrupt! {
|
||||
(TIM2, timer, $block:ident, UP, $irq:ident) => {
|
||||
#[cfg(time_driver_tim2)]
|
||||
#[cfg(feature = "rt")]
|
||||
#[interrupt]
|
||||
fn $irq() {
|
||||
DRIVER.on_interrupt()
|
||||
@ -47,6 +48,7 @@ foreach_interrupt! {
|
||||
};
|
||||
(TIM3, timer, $block:ident, UP, $irq:ident) => {
|
||||
#[cfg(time_driver_tim3)]
|
||||
#[cfg(feature = "rt")]
|
||||
#[interrupt]
|
||||
fn $irq() {
|
||||
DRIVER.on_interrupt()
|
||||
@ -54,6 +56,7 @@ foreach_interrupt! {
|
||||
};
|
||||
(TIM4, timer, $block:ident, UP, $irq:ident) => {
|
||||
#[cfg(time_driver_tim4)]
|
||||
#[cfg(feature = "rt")]
|
||||
#[interrupt]
|
||||
fn $irq() {
|
||||
DRIVER.on_interrupt()
|
||||
@ -61,6 +64,7 @@ foreach_interrupt! {
|
||||
};
|
||||
(TIM5, timer, $block:ident, UP, $irq:ident) => {
|
||||
#[cfg(time_driver_tim5)]
|
||||
#[cfg(feature = "rt")]
|
||||
#[interrupt]
|
||||
fn $irq() {
|
||||
DRIVER.on_interrupt()
|
||||
@ -68,6 +72,7 @@ foreach_interrupt! {
|
||||
};
|
||||
(TIM12, timer, $block:ident, UP, $irq:ident) => {
|
||||
#[cfg(time_driver_tim12)]
|
||||
#[cfg(feature = "rt")]
|
||||
#[interrupt]
|
||||
fn $irq() {
|
||||
DRIVER.on_interrupt()
|
||||
@ -75,6 +80,7 @@ foreach_interrupt! {
|
||||
};
|
||||
(TIM15, timer, $block:ident, UP, $irq:ident) => {
|
||||
#[cfg(time_driver_tim15)]
|
||||
#[cfg(feature = "rt")]
|
||||
#[interrupt]
|
||||
fn $irq() {
|
||||
DRIVER.on_interrupt()
|
||||
|
Reference in New Issue
Block a user