File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
common-hal/neopixel_write Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,16 @@ static NRF_PWM_Type* find_free_pwm (void) {
97
97
return NULL ;
98
98
}
99
99
100
+ static uint16_t * pixels_pattern_heap = NULL ;
101
+ static size_t pixels_pattern_heap_size = 0 ;
102
+ static bool pattern_on_heap = false;
103
+ // Called during reset_port() to free the pattern buffer
104
+ void neopixel_write_reset (void ) {
105
+ pixels_pattern_heap = NULL ;
106
+ pixels_pattern_heap_size = 0 ;
107
+ pattern_on_heap = false;
108
+ }
109
+
100
110
uint64_t next_start_tick_ms = 0 ;
101
111
uint32_t next_start_tick_us = 1000 ;
102
112
@@ -113,12 +123,8 @@ void common_hal_neopixel_write (const digitalio_digitalinout_obj_t* digitalinout
113
123
// using DWT
114
124
115
125
#define PATTERN_SIZE (numBytes ) (numBytes * 8 * sizeof(uint16_t) + 2 * sizeof(uint16_t))
116
-
117
126
uint32_t pattern_size = PATTERN_SIZE (numBytes );
118
127
uint16_t * pixels_pattern = NULL ;
119
- static uint16_t * pixels_pattern_heap = NULL ;
120
- static size_t pixels_pattern_heap_size = 0 ;
121
- bool pattern_on_heap = false;
122
128
123
129
// Use the stack to store 1 pixels worth of PWM data for the status led. uint32_t to ensure alignment.
124
130
// Make it at least as big as PATTERN_SIZE(3), for one pixel of RGB data.
Original file line number Diff line number Diff line change 47
47
#include "common-hal/pulseio/PulseOut.h"
48
48
#include "common-hal/pulseio/PulseIn.h"
49
49
#include "common-hal/rtc/RTC.h"
50
+ #include "common-hal/neopixel_write/__init__.h"
50
51
#include "tick.h"
51
52
52
53
#include "shared-bindings/rtc/__init__.h"
@@ -106,6 +107,7 @@ void reset_port(void) {
106
107
i2c_reset ();
107
108
spi_reset ();
108
109
uart_reset ();
110
+ neopixel_write_reset ();
109
111
110
112
#if CIRCUITPY_AUDIOBUSIO
111
113
i2s_reset ();
You can’t perform that action at this time.
0 commit comments