Skip to content

Commit 08d09ac

Browse files
authored
Merge pull request #5613 from jepler/issue5418
clear out interrupt when freeing the timer
2 parents ab9cef7 + 1986d2e commit 08d09ac

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 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
@@ -58,13 +59,17 @@ void common_hal_rgbmatrix_timer_enable(void *ptr) {
5859
void common_hal_rgbmatrix_timer_disable(void *ptr) {
5960
int8_t slice = ((intptr_t)ptr) & 0xff;
6061
pwm_set_enabled(slice, false);
62+
irq_set_enabled(PWM_IRQ_WRAP, false);
63+
pwm_clear_irq(slice);
6164
}
6265

6366
void common_hal_rgbmatrix_timer_free(void *ptr) {
6467
intptr_t value = (intptr_t)ptr;
6568
uint8_t slice = value & 0xff;
6669
uint8_t channel = value >> 8;
6770
pwm_set_enabled(slice, false);
71+
irq_set_enabled(PWM_IRQ_WRAP, false);
72+
pwm_clear_irq(slice);
6873
pwmout_free(slice, channel);
6974
return;
7075
}

0 commit comments

Comments
 (0)