Skip to content

Commit 39d3d97

Browse files
committed
Remove unnecessary memory barriers
1 parent dcb6955 commit 39d3d97

File tree

1 file changed

+1
-10
lines changed
  • ports/broadcom/common-hal/neopixel_write

1 file changed

+1
-10
lines changed

ports/broadcom/common-hal/neopixel_write/__init__.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,7 @@ void common_hal_neopixel_write(const digitalio_digitalinout_obj_t *digitalinout,
9696
// Wait for the clock to start up.
9797
COMPLETE_MEMORY_READS;
9898
icnt = 0;
99-
while ((CM_PWM->CS_b.BUSY == 0) && (icnt++ < 1000)) {
100-
COMPLETE_MEMORY_READS;
101-
}
99+
while ((CM_PWM->CS_b.BUSY == 0) && (icnt++ < 1000)) {}
102100
}
103101

104102
PWM0_Type *pwm = PWM0;
@@ -143,22 +141,19 @@ void common_hal_neopixel_write(const digitalio_digitalinout_obj_t *digitalinout,
143141
icnt = 0;
144142
while ((pwm->STA_b.FULL1 == 1) && (icnt++ < 150)) {
145143
RUN_BACKGROUND_TASKS;
146-
COMPLETE_MEMORY_READS;
147144
}
148145
// Dummy value for the first channel.
149146
pwm->FIF1 = 0x000000;
150147
}
151148
icnt = 0;
152149
while ((pwm->STA_b.FULL1 == 1) && (icnt++ < 150)) {
153150
RUN_BACKGROUND_TASKS;
154-
COMPLETE_MEMORY_READS;
155151
}
156152
pwm->FIF1 = expanded;
157153
if (channel == 0) {
158154
icnt = 0;
159155
while ((pwm->STA_b.FULL1 == 1) && (icnt++ < 150)) {
160156
RUN_BACKGROUND_TASKS;
161-
COMPLETE_MEMORY_READS;
162157
}
163158
// Dummy value for the second channel.
164159
pwm->FIF1 = 0x000000;
@@ -168,23 +163,19 @@ void common_hal_neopixel_write(const digitalio_digitalinout_obj_t *digitalinout,
168163
icnt = 0;
169164
while ((pwm->STA_b.EMPT1 == 0) && (icnt++ < 2500)) {
170165
RUN_BACKGROUND_TASKS;
171-
COMPLETE_MEMORY_READS;
172166
}
173167
// Wait for transmission to start.
174168
icnt = 0;
175169
while (((pwm->STA_b.STA1 == 0) && (pwm->STA_b.STA2 == 0)) && (icnt++ < 150)) {
176170
RUN_BACKGROUND_TASKS;
177-
COMPLETE_MEMORY_READS;
178171
}
179172
// Wait for transmission to complete.
180173
icnt = 0;
181174
while (((pwm->STA_b.STA1 == 1) | (pwm->STA_b.STA2 == 1)) && (icnt++ < 150)) {
182175
RUN_BACKGROUND_TASKS;
183-
COMPLETE_MEMORY_READS;
184176
}
185177
// Shouldn't be anything left in queue but clear it so the clock doesn't crash if there is
186178
pwm->CTL = PWM0_CTL_CLRF1_Msk;
187-
COMPLETE_MEMORY_READS;
188179

189180
gpio_set_function(digitalinout->pin->number, GPIO_FUNCTION_OUTPUT);
190181

0 commit comments

Comments
 (0)