Merge pull request #3441 from hierophect/stm32-rgbmatrix-crashfix
STM32: Add never_reset reservation to RGBMatrix init
This commit is contained in:
commit
ce266425e1
@ -36,6 +36,7 @@ extern void _PM_IRQ_HANDLER(void);
|
|||||||
void *common_hal_rgbmatrix_timer_allocate() {
|
void *common_hal_rgbmatrix_timer_allocate() {
|
||||||
TIM_TypeDef * timer = stm_peripherals_find_timer();
|
TIM_TypeDef * timer = stm_peripherals_find_timer();
|
||||||
stm_peripherals_timer_reserve(timer);
|
stm_peripherals_timer_reserve(timer);
|
||||||
|
stm_peripherals_timer_never_reset(timer);
|
||||||
return timer;
|
return timer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,9 +195,7 @@ TIM_TypeDef * stm_peripherals_find_timer(void) {
|
|||||||
// If no results are found, no unclaimed pins with this timer are in this package,
|
// If no results are found, no unclaimed pins with this timer are in this package,
|
||||||
// and it is safe to pick
|
// and it is safe to pick
|
||||||
if (timer_in_package == false && mcu_tim_banks[i] != NULL) {
|
if (timer_in_package == false && mcu_tim_banks[i] != NULL) {
|
||||||
// DEBUG: print the timer
|
|
||||||
return mcu_tim_banks[i];
|
return mcu_tim_banks[i];
|
||||||
mp_printf(&mp_plat_print, "Timer: %d\n",i);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//TODO: secondary search for timers outside the pins in the board profile
|
//TODO: secondary search for timers outside the pins in the board profile
|
||||||
@ -205,8 +203,6 @@ TIM_TypeDef * stm_peripherals_find_timer(void) {
|
|||||||
// Work backwards - higher index timers have fewer pin allocations
|
// Work backwards - higher index timers have fewer pin allocations
|
||||||
for (size_t i = (MP_ARRAY_SIZE(mcu_tim_banks) - 1); i >= 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)) {
|
if ((!stm_timer_reserved[i]) && (mcu_tim_banks[i] != NULL)) {
|
||||||
// DEBUG: print the timer
|
|
||||||
mp_printf(&mp_plat_print, "Timer: %d\n",i);
|
|
||||||
return mcu_tim_banks[i];
|
return mcu_tim_banks[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user