From 2bcc5c06c2efe5fb9469cab2f8f9aa801fbde14b Mon Sep 17 00:00:00 2001 From: Lucian Copeland Date: Thu, 9 Jul 2020 11:41:00 -0400 Subject: [PATCH] Fix advanced claimed pin/package timer search --- ports/stm/common-hal/microcontroller/Pin.c | 2 + ports/stm/peripherals/timers.c | 44 +++++++++++----------- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/ports/stm/common-hal/microcontroller/Pin.c b/ports/stm/common-hal/microcontroller/Pin.c index 3e3fc05227..d919b07ea7 100644 --- a/ports/stm/common-hal/microcontroller/Pin.c +++ b/ports/stm/common-hal/microcontroller/Pin.c @@ -89,6 +89,8 @@ void reset_pin_number(uint8_t pin_port, uint8_t pin_number) { void never_reset_pin_number(uint8_t pin_port, uint8_t pin_number) { never_reset_pins[pin_port] |= 1<=0; i--) { + for (size_t i = (MP_ARRAY_SIZE(mcu_tim_banks) - 1); i >= 0; i--) { if ((!stm_timer_reserved[i]) && (mcu_tim_banks[i] != NULL)) { return mcu_tim_banks[i]; }