From 2ebffdf3774aef0d6140b94d33fb216f75e684e8 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 23 Apr 2026 12:11:58 +0200 Subject: [PATCH] add interrupt config for VA108xx --- vorago-shared-hal/src/spi/asynch.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/vorago-shared-hal/src/spi/asynch.rs b/vorago-shared-hal/src/spi/asynch.rs index 967b008..bf9c38b 100644 --- a/vorago-shared-hal/src/spi/asynch.rs +++ b/vorago-shared-hal/src/spi/asynch.rs @@ -486,7 +486,23 @@ impl<'spi> Drop for SpiFuture<'spi> { pub struct SpiAsync(pub super::Spi); impl SpiAsync { - pub fn new(spi: super::Spi) -> Self { + pub fn new( + spi: super::Spi, + #[cfg(feature = "vor1x")] opt_irq_cfg: Option, + ) -> Self { + #[cfg(feature = "vor1x")] + if let Some(irq_cfg) = opt_irq_cfg { + if irq_cfg.route { + crate::enable_peripheral_clock(crate::PeripheralSelect::Irqsel); + unsafe { va108xx::Irqsel::steal() } + .spi(spi.id as usize) + .write(|w| unsafe { w.bits(irq_cfg.id as u32) }); + } + if irq_cfg.enable_in_nvic { + // Safety: User has specifically configured this. + unsafe { crate::enable_nvic_interrupt(irq_cfg.id) }; + } + } Self(spi) }