Merge pull request #5613 from jepler/issue5418
clear out interrupt when freeing the timer
This commit is contained in:
commit
08d09ac493
|
@ -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
|
||||
|
@ -58,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) {
|
||||
|
@ -65,6 +68,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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue