summaryrefslogtreecommitdiff
path: root/ports/nrf/common-hal
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2021-02-11 16:37:34 -0600
committerJeff Epler <jepler@gmail.com>2021-02-12 08:25:15 -0600
commitff1942cff68a4e192f984a14a83b59800186e45a (patch)
tree7818252750d5819ddb518075a5e6d2f165712ec7 /ports/nrf/common-hal
parentaae10fb37fa402f9bc51f3edec0d2f7772036a25 (diff)
Enable protomatter on RP2040 builds
Also found a race condition between timer_disable and redraw, which would happen if I debugger-paused inside common_hal_rgbmatrix_timer_disable or put a delay or print inside it. That's what pausing inside reconstruct fixes. So that the "right timer" can be chosen, `timer_allocate` now gets the `self` pointer. It's guaranteed at this point that the pin information is accurate, so you can e.g., find a PWM unit related to the pins themselves. This required touching each port to add the parameter even though it's unused everywhere but raspberrypi.
Diffstat (limited to 'ports/nrf/common-hal')
-rw-r--r--ports/nrf/common-hal/rgbmatrix/RGBMatrix.c2
-rw-r--r--ports/nrf/common-hal/rgbmatrix/RGBMatrix.h4
2 files changed, 4 insertions, 2 deletions
diff --git a/ports/nrf/common-hal/rgbmatrix/RGBMatrix.c b/ports/nrf/common-hal/rgbmatrix/RGBMatrix.c
index e13b761ab..d8289f56f 100644
--- a/ports/nrf/common-hal/rgbmatrix/RGBMatrix.c
+++ b/ports/nrf/common-hal/rgbmatrix/RGBMatrix.c
@@ -32,7 +32,7 @@
extern void _PM_IRQ_HANDLER(void);
-void *common_hal_rgbmatrix_timer_allocate() {
+void *common_hal_rgbmatrix_timer_allocate(rgbmatrix_rgbmatrix_obj_t *self) {
nrfx_timer_t *timer = nrf_peripherals_allocate_timer_or_throw();
nrf_peripherals_timer_never_reset(timer);
return timer->p_reg;
diff --git a/ports/nrf/common-hal/rgbmatrix/RGBMatrix.h b/ports/nrf/common-hal/rgbmatrix/RGBMatrix.h
index 24d86f177..6cf7354fc 100644
--- a/ports/nrf/common-hal/rgbmatrix/RGBMatrix.h
+++ b/ports/nrf/common-hal/rgbmatrix/RGBMatrix.h
@@ -27,7 +27,9 @@
#ifndef MICROPY_INCLUDED_NRF_COMMON_HAL_RGBMATRIX_RGBMATRIX_H
#define MICROPY_INCLUDED_NRF_COMMON_HAL_RGBMATRIX_RGBMATRIX_H
-void *common_hal_rgbmatrix_timer_allocate(void);
+#include "shared-module/rgbmatrix/RGBMatrix.h"
+
+void *common_hal_rgbmatrix_timer_allocate(rgbmatrix_rgbmatrix_obj_t *self);
void common_hal_rgbmatrix_timer_enable(void*);
void common_hal_rgbmatrix_timer_disable(void*);
void common_hal_rgbmatrix_timer_free(void*);