clear out interrupt when freeing the timer

Closes #5418
This commit is contained in:
Jeff Epler 2021-11-23 12:34:03 -06:00
parent 387a8a46b3
commit b1a3ccb36c
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE

View File

@ -33,6 +33,7 @@
#include "shared-module/rgbmatrix/RGBMatrix.h"
#include "src/rp2_common/hardware_pwm/include/hardware/pwm.h"
#include "src/rp2_common/hardware_irq/include/hardware/irq.h"
void *common_hal_rgbmatrix_timer_allocate(rgbmatrix_rgbmatrix_obj_t *self) {
// Choose a PWM channel based on the first RGB pin
@ -65,6 +66,8 @@ void common_hal_rgbmatrix_timer_free(void *ptr) {
uint8_t slice = value & 0xff;
uint8_t channel = value >> 8;
pwm_set_enabled(slice, false);
irq_set_enabled(PWM_IRQ_WRAP, false);
pwm_clear_irq(slice);
pwmout_free(slice, channel);
return;
}