File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
ports/broadcom/common-hal/neopixel_write Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,7 @@ void common_hal_neopixel_write(const digitalio_digitalinout_obj_t *digitalinout,
97
97
COMPLETE_MEMORY_READS ;
98
98
icnt = 0 ;
99
99
while ((CM_PWM -> CS_b .BUSY == 0 ) & (icnt ++ < 1000 )) {
100
+ COMPLETE_MEMORY_READS ;
100
101
}
101
102
}
102
103
@@ -142,19 +143,22 @@ void common_hal_neopixel_write(const digitalio_digitalinout_obj_t *digitalinout,
142
143
icnt = 0 ;
143
144
while ((pwm -> STA_b .FULL1 == 1 ) & (icnt ++ < 150 )) {
144
145
RUN_BACKGROUND_TASKS ;
146
+ COMPLETE_MEMORY_READS ;
145
147
}
146
148
// Dummy value for the first channel.
147
149
pwm -> FIF1 = 0x000000 ;
148
150
}
149
151
icnt = 0 ;
150
152
while ((pwm -> STA_b .FULL1 == 1 ) & (icnt ++ < 150 )) {
151
153
RUN_BACKGROUND_TASKS ;
154
+ COMPLETE_MEMORY_READS ;
152
155
}
153
156
pwm -> FIF1 = expanded ;
154
157
if (channel == 0 ) {
155
158
icnt = 0 ;
156
159
while ((pwm -> STA_b .FULL1 == 1 ) & (icnt ++ < 150 )) {
157
160
RUN_BACKGROUND_TASKS ;
161
+ COMPLETE_MEMORY_READS ;
158
162
}
159
163
// Dummy value for the second channel.
160
164
pwm -> FIF1 = 0x000000 ;
@@ -164,17 +168,23 @@ void common_hal_neopixel_write(const digitalio_digitalinout_obj_t *digitalinout,
164
168
icnt = 0 ;
165
169
while ((pwm -> STA_b .EMPT1 == 0 ) & (icnt ++ < 2500 )) {
166
170
RUN_BACKGROUND_TASKS ;
171
+ COMPLETE_MEMORY_READS ;
167
172
}
168
173
// Wait for transmission to start.
169
174
icnt = 0 ;
170
175
while (((pwm -> STA_b .STA1 == 0 ) & (pwm -> STA_b .STA2 == 0 )) & (icnt ++ < 150 )) {
171
176
RUN_BACKGROUND_TASKS ;
177
+ COMPLETE_MEMORY_READS ;
172
178
}
173
179
// Wait for transmission to complete.
174
180
icnt = 0 ;
175
181
while (((pwm -> STA_b .STA1 == 1 ) | (pwm -> STA_b .STA2 == 1 )) & (icnt ++ < 150 )) {
176
182
RUN_BACKGROUND_TASKS ;
183
+ COMPLETE_MEMORY_READS ;
177
184
}
185
+ // Shouldn't be anything left in queue but clear it so the clock doesn't crash if there is
186
+ pwm -> CTL = PWM0_CTL_CLRF1_Msk ;
187
+ COMPLETE_MEMORY_READS ;
178
188
179
189
gpio_set_function (digitalinout -> pin -> number , GPIO_FUNCTION_OUTPUT );
180
190
You can’t perform that action at this time.
0 commit comments