diff --git a/ports/raspberrypi/common-hal/rgbmatrix/RGBMatrix.c b/ports/raspberrypi/common-hal/rgbmatrix/RGBMatrix.c index f150422e3c..8ab4edb598 100644 --- a/ports/raspberrypi/common-hal/rgbmatrix/RGBMatrix.c +++ b/ports/raspberrypi/common-hal/rgbmatrix/RGBMatrix.c @@ -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; }