From b1a3ccb36c87598b63a2045b8c2fff05a8c61069 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 23 Nov 2021 12:34:03 -0600 Subject: [PATCH 1/2] clear out interrupt when freeing the timer Closes #5418 --- ports/raspberrypi/common-hal/rgbmatrix/RGBMatrix.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ports/raspberrypi/common-hal/rgbmatrix/RGBMatrix.c b/ports/raspberrypi/common-hal/rgbmatrix/RGBMatrix.c index f150422e3cf49..8ab4edb598c1b 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; } From 1986d2ee71737c36794577cb4dc3cdf7fb1422a7 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Mon, 27 Dec 2021 16:42:41 -0600 Subject: [PATCH 2/2] clear out interrupt flags when disabling timer too --- ports/raspberrypi/common-hal/rgbmatrix/RGBMatrix.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ports/raspberrypi/common-hal/rgbmatrix/RGBMatrix.c b/ports/raspberrypi/common-hal/rgbmatrix/RGBMatrix.c index 8ab4edb598c1b..d580b4cc6abe1 100644 --- a/ports/raspberrypi/common-hal/rgbmatrix/RGBMatrix.c +++ b/ports/raspberrypi/common-hal/rgbmatrix/RGBMatrix.c @@ -59,6 +59,8 @@ void common_hal_rgbmatrix_timer_enable(void *ptr) { void common_hal_rgbmatrix_timer_disable(void *ptr) { int8_t slice = ((intptr_t)ptr) & 0xff; pwm_set_enabled(slice, false); + irq_set_enabled(PWM_IRQ_WRAP, false); + pwm_clear_irq(slice); } void common_hal_rgbmatrix_timer_free(void *ptr) { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy