From b3939d40b3ecb198e5a8fac75a612ff244ef2097 Mon Sep 17 00:00:00 2001 From: "Cliff L. Biffle" Date: Wed, 3 Apr 2024 13:33:46 -0700 Subject: [PATCH] stm32xx-sys: fix typo in EXTI pin configuration In the Giant Scary Nested Match we had to write to be able to address the EXTI register array as an array through the PAC, I typo'd the number base being used to select the field within the register, by reusing 2 from the line above. This is the _base 2 logarithm_ of the number we actually wanted, 4, because the operations are shift and mod, respectively. Wheeee Anyway, this fixes the situation where EXTI configuration of any pin p such that p % 4 = 2 or 3 on any port other than A mysteriously senses a different pin in port A instead. --- drv/stm32xx-sys/src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drv/stm32xx-sys/src/main.rs b/drv/stm32xx-sys/src/main.rs index 22b5bc920..b46e0975a 100644 --- a/drv/stm32xx-sys/src/main.rs +++ b/drv/stm32xx-sys/src/main.rs @@ -398,7 +398,7 @@ fn main() -> ! { // Process entries that are filled in... if let &Some(ExtiDispatch { port, .. }) = entry { let register = i >> 2; - let slot = i % 2; + let slot = i & 0b11; // This is an array of 4-bit fields spread across 4 32-bit // registers. We're indexing them with i. There is really no