From db9b8eb88f095687ed624171cf79fbacf06c199a Mon Sep 17 00:00:00 2001 From: pennae Date: Sat, 6 May 2023 21:14:00 +0200 Subject: [PATCH] rp/pio: make sure gpio() asserts are compiled out we'll have to touch pio one way or other if the number of gpio pins ever increases. may as well make sure an assert never fires until that happens. --- embassy-rp/src/pio.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/embassy-rp/src/pio.rs b/embassy-rp/src/pio.rs index fe66d9ae..1e41bed3 100644 --- a/embassy-rp/src/pio.rs +++ b/embassy-rp/src/pio.rs @@ -1070,7 +1070,8 @@ fn on_pio_drop() { if state.users.fetch_sub(1, Ordering::AcqRel) == 1 { let used_pins = state.used_pins.load(Ordering::Relaxed); let null = Gpio0ctrlFuncsel::NULL.0; - for i in 0..32 { + // we only have 30 pins. don't test the other two since gpio() asserts. + for i in 0..30 { if used_pins & (1 << i) != 0 { unsafe { pac::IO_BANK0.gpio(i).ctrl().write(|w| w.set_funcsel(null));