We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 06521a4 commit 6f44590Copy full SHA for 6f44590
platforms/arm/k66/fastspi_arm_k66.h
@@ -285,13 +285,19 @@ class ARMHardwareSPIOutput {
285
286
static void waitFully() __attribute__((always_inline)) {
287
// Wait for the last byte to get shifted into the register
288
- cli();
289
- while( (SPIX.SR & 0xF000) > 0) {
290
- // reset the TCF flag
291
- SPIX.SR |= SPI_SR_TCF;
292
- }
293
- sei();
294
-
+ bool empty = false;
+
+ do {
+ cli();
+ if ((SPIX.SR & 0xF000) > 0) {
+ // reset the TCF flag
+ SPIX.SR |= SPI_SR_TCF;
295
+ } else {
296
+ empty = true;
297
+ }
298
+ sei();
299
+ } while (!empty);
300
301
// wait for the TCF flag to get set
302
while (!(SPIX.SR & SPI_SR_TCF));
303
SPIX.SR |= (SPI_SR_TCF | SPI_SR_EOQF);
0 commit comments