From e78a6db15138fd2befea5e15cab4e57fab3d0431 Mon Sep 17 00:00:00 2001
From: Adam Greig <adam@adamgreig.com>
Date: Wed, 1 Nov 2023 03:36:54 +0000
Subject: [PATCH] stm32: Don't try handle EXTI inputs above 16

---
 embassy-stm32/src/exti.rs | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/embassy-stm32/src/exti.rs b/embassy-stm32/src/exti.rs
index 538791a51..07c63a2ef 100644
--- a/embassy-stm32/src/exti.rs
+++ b/embassy-stm32/src/exti.rs
@@ -47,6 +47,9 @@ pub unsafe fn on_irq() {
     #[cfg(any(exti_c0, exti_g0, exti_l5, exti_u5, exti_h5, exti_h50))]
     let bits = EXTI.rpr(0).read().0 | EXTI.fpr(0).read().0;
 
+    // We don't handle or change any EXTI lines above 16.
+    let bits = bits & 0x0000FFFF;
+
     // Mask all the channels that fired.
     cpu_regs().imr(0).modify(|w| w.0 &= !bits);