diff options
| author | pennae <[email protected]> | 2023-05-06 21:14:00 +0200 |
|---|---|---|
| committer | pennae <[email protected]> | 2023-05-06 21:14:00 +0200 |
| commit | db9b8eb88f095687ed624171cf79fbacf06c199a (patch) | |
| tree | e48624f199161cd7b42824d45c361205a6bf27d7 | |
| parent | b38d496d519f87d7f455e6c6b32f5d6379af44a5 (diff) | |
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.
| -rw-r--r-- | embassy-rp/src/pio.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/embassy-rp/src/pio.rs b/embassy-rp/src/pio.rs index fe66d9aef..1e41bed30 100644 --- a/embassy-rp/src/pio.rs +++ b/embassy-rp/src/pio.rs | |||
| @@ -1070,7 +1070,8 @@ fn on_pio_drop<PIO: Instance>() { | |||
| 1070 | if state.users.fetch_sub(1, Ordering::AcqRel) == 1 { | 1070 | if state.users.fetch_sub(1, Ordering::AcqRel) == 1 { |
| 1071 | let used_pins = state.used_pins.load(Ordering::Relaxed); | 1071 | let used_pins = state.used_pins.load(Ordering::Relaxed); |
| 1072 | let null = Gpio0ctrlFuncsel::NULL.0; | 1072 | let null = Gpio0ctrlFuncsel::NULL.0; |
| 1073 | for i in 0..32 { | 1073 | // we only have 30 pins. don't test the other two since gpio() asserts. |
| 1074 | for i in 0..30 { | ||
| 1074 | if used_pins & (1 << i) != 0 { | 1075 | if used_pins & (1 << i) != 0 { |
| 1075 | unsafe { | 1076 | unsafe { |
| 1076 | pac::IO_BANK0.gpio(i).ctrl().write(|w| w.set_funcsel(null)); | 1077 | pac::IO_BANK0.gpio(i).ctrl().write(|w| w.set_funcsel(null)); |
