Skip to content

Commit b1a3ccb

Browse files
committed
clear out interrupt when freeing the timer
Closes #5418
1 parent 387a8a4 commit b1a3ccb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "shared-module/rgbmatrix/RGBMatrix.h"
3434

3535
#include "src/rp2_common/hardware_pwm/include/hardware/pwm.h"
36+
#include "src/rp2_common/hardware_irq/include/hardware/irq.h"
3637

3738
void *common_hal_rgbmatrix_timer_allocate(rgbmatrix_rgbmatrix_obj_t *self) {
3839
// Choose a PWM channel based on the first RGB pin
@@ -65,6 +66,8 @@ void common_hal_rgbmatrix_timer_free(void *ptr) {
6566
uint8_t slice = value & 0xff;
6667
uint8_t channel = value >> 8;
6768
pwm_set_enabled(slice, false);
69+
irq_set_enabled(PWM_IRQ_WRAP, false);
70+
pwm_clear_irq(slice);
6871
pwmout_free(slice, channel);
6972
return;
7073
}

0 commit comments

Comments
 (0)