From 35910a237632e128ddd1ba50385547b400d183dd Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Fri, 16 Feb 2024 11:08:37 -0800 Subject: [PATCH] corrections (#769) --- src/internal/colors/HtmlColor.h | 2 ++ src/internal/methods/NeoAvrMethod.h | 4 ++-- src/internal/methods/NeoPixelAvr.c | 10 +++++----- src/internal/methods/Ws2801GenericMethod.h | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/internal/colors/HtmlColor.h b/src/internal/colors/HtmlColor.h index 3e63421..1eecd83 100644 --- a/src/internal/colors/HtmlColor.h +++ b/src/internal/colors/HtmlColor.h @@ -249,10 +249,12 @@ struct HtmlColor return Parse(name, MAX_HTML_COLOR_NAME_LEN + 1); } +#if !defined(ARDUINO_AVR_DIGISPARK) template size_t Parse(String const &name) { return Parse(name.c_str(), name.length() + 1); } +#endif // ------------------------------------------------------------------------ // Converts this color code to its HTML4/CSS3 name diff --git a/src/internal/methods/NeoAvrMethod.h b/src/internal/methods/NeoAvrMethod.h index c72b993..a17f425 100644 --- a/src/internal/methods/NeoAvrMethod.h +++ b/src/internal/methods/NeoAvrMethod.h @@ -223,7 +223,7 @@ public: // rather than stalling for the latch. while (!IsReadyToUpdate()) { -#if !defined(ARDUINO_TEEONARDU_LEO) && !defined(ARDUINO_TEEONARDU_FLORA) +#if !defined(ARDUINO_TEEONARDU_LEO) && !defined(ARDUINO_TEEONARDU_FLORA) && !defined(ARDUINO_AVR_DIGISPARK) yield(); // allows for system yield if needed #endif } @@ -292,7 +292,7 @@ public: // rather than stalling for the latch. while (!NeoAvrMethodBase::IsReadyToUpdate()) { -#if !defined(ARDUINO_TEEONARDU_LEO) && !defined(ARDUINO_TEEONARDU_FLORA) +#if !defined(ARDUINO_TEEONARDU_LEO) && !defined(ARDUINO_TEEONARDU_FLORA) && !defined(ARDUINO_AVR_DIGISPARK) yield(); // allows for system yield if needed #endif } diff --git a/src/internal/methods/NeoPixelAvr.c b/src/internal/methods/NeoPixelAvr.c index e6572c6..4c28f18 100644 --- a/src/internal/methods/NeoPixelAvr.c +++ b/src/internal/methods/NeoPixelAvr.c @@ -678,7 +678,7 @@ void send_data_16mhz_600(uint8_t* data, bit = 8; asm volatile( - "head40:" "\n\t" // Clk Pseudocode (T = 0) + "head60:" "\n\t" // Clk Pseudocode (T = 0) "st %a[port], %[hi]" "\n\t" // 2 PORT = hi (T = 2) "sbrc %[byte] , 7" "\n\t" // 1-2 if(b & 0b10000000) "mov %[next] , %[hi]" "\n\t" // 0-1 next = hi (T = 4) @@ -689,18 +689,18 @@ void send_data_16mhz_600(uint8_t* data, "rjmp .+0" "\n\t" // 2 nop nop (T = 13) "rjmp .+0" "\n\t" // 2 nop nop (T = 15) "dec %[bit]" "\n\t" // 1 bit-- (T = 16) - "breq nextbyte40" "\n\t" // 1-2 if(bit == 0) + "breq nextbyte60" "\n\t" // 1-2 if(bit == 0) "st %a[port], %[lo]" "\n\t" // 2 PORT = lo (T = 18) duplicate here improves high length for non byte boundary "rol %[byte]" "\n\t" // 1 b <<= 1 (T = 21) "nop" "\n\t" // 1 nop (T = 22) "rjmp .+0" "\n\t" // 2 nop nop (T = 24) - "rjmp head40" "\n\t" // 2 -> head40 (next bit out) - "nextbyte40:" "\n\t" // (T = 18) + "rjmp head60" "\n\t" // 2 -> head40 (next bit out) + "nextbyte60:" "\n\t" // (T = 18) "st %a[port], %[lo]" "\n\t" // 2 PORT = lo (T = 20) duplicate here improves high length while reducing interbyte "ldi %[bit] , 8" "\n\t" // 1 bit = 8 (T = 21) "ld %[byte] , %a[ptr]+" "\n\t" // 2 b = *ptr++ (T = 23) "sbiw %[count], 1" "\n\t" // 2 i-- (T = 25) - "brne head40" "\n" // 1-2 if(i != 0) -> (next byte) + "brne head60" "\n" // 1-2 if(i != 0) -> (next byte) : [port] "+e" (port), [byte] "+r" (b), [bit] "+r" (bit), diff --git a/src/internal/methods/Ws2801GenericMethod.h b/src/internal/methods/Ws2801GenericMethod.h index 4eb8957..33d8da0 100644 --- a/src/internal/methods/Ws2801GenericMethod.h +++ b/src/internal/methods/Ws2801GenericMethod.h @@ -86,7 +86,7 @@ public: { while (!IsReadyToUpdate()) { -#if !defined(ARDUINO_TEEONARDU_LEO) && !defined(ARDUINO_TEEONARDU_FLORA) +#if !defined(ARDUINO_TEEONARDU_LEO) && !defined(ARDUINO_TEEONARDU_FLORA) && !defined(ARDUINO_AVR_DIGISPARK) yield(); // allows for system yield if needed #endif }