Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FastLED/FastLED.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--platforms/arm/k66/fastspi_arm_k66.h20
1 files changed, 13 insertions, 7 deletions
diff --git a/platforms/arm/k66/fastspi_arm_k66.h b/platforms/arm/k66/fastspi_arm_k66.h
index b13f0ddc..7e598cff 100644
--- a/platforms/arm/k66/fastspi_arm_k66.h
+++ b/platforms/arm/k66/fastspi_arm_k66.h
@@ -285,13 +285,19 @@ public:
static void waitFully() __attribute__((always_inline)) {
// Wait for the last byte to get shifted into the register
- cli();
- while( (SPIX.SR & 0xF000) > 0) {
- // reset the TCF flag
- SPIX.SR |= SPI_SR_TCF;
- }
- sei();
-
+ bool empty = false;
+
+ do {
+ cli();
+ if ((SPIX.SR & 0xF000) > 0) {
+ // reset the TCF flag
+ SPIX.SR |= SPI_SR_TCF;
+ } else {
+ empty = true;
+ }
+ sei();
+ } while (!empty);
+
// wait for the TCF flag to get set
while (!(SPIX.SR & SPI_SR_TCF));
SPIX.SR |= (SPI_SR_TCF | SPI_SR_EOQF);