Skip to content

Commit ce26642

Browse files
authored
Merge pull request adafruit#3441 from hierophect/stm32-rgbmatrix-crashfix
STM32: Add never_reset reservation to RGBMatrix init
2 parents 9d9bc5a + 3a59d30 commit ce26642

File tree

2 files changed

+1
-4
lines changed

2 files changed

+1
-4
lines changed

ports/stm/common-hal/rgbmatrix/RGBMatrix.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ extern void _PM_IRQ_HANDLER(void);
3636
void *common_hal_rgbmatrix_timer_allocate() {
3737
TIM_TypeDef * timer = stm_peripherals_find_timer();
3838
stm_peripherals_timer_reserve(timer);
39+
stm_peripherals_timer_never_reset(timer);
3940
return timer;
4041
}
4142

ports/stm/peripherals/timers.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,18 +195,14 @@ TIM_TypeDef * stm_peripherals_find_timer(void) {
195195
// If no results are found, no unclaimed pins with this timer are in this package,
196196
// and it is safe to pick
197197
if (timer_in_package == false && mcu_tim_banks[i] != NULL) {
198-
// DEBUG: print the timer
199198
return mcu_tim_banks[i];
200-
mp_printf(&mp_plat_print, "Timer: %d\n",i);
201199
}
202200
}
203201
//TODO: secondary search for timers outside the pins in the board profile
204202

205203
// Work backwards - higher index timers have fewer pin allocations
206204
for (size_t i = (MP_ARRAY_SIZE(mcu_tim_banks) - 1); i >= 0; i--) {
207205
if ((!stm_timer_reserved[i]) && (mcu_tim_banks[i] != NULL)) {
208-
// DEBUG: print the timer
209-
mp_printf(&mp_plat_print, "Timer: %d\n",i);
210206
return mcu_tim_banks[i];
211207
}
212208
}

0 commit comments

Comments
 (0)