MichaelMeissner
Senior Member+
I was modifying my all dancing, all singing neopixel libraries to add support for WS2812Serial. In looking at the header file, I noticed there was a busy function that returned a bool. I assumed this would allow me to poll whether the previous request had finished (assuming that show would be non-blocking).
But it looks like there is a busy function in the header file, there is no busy function in the C++ file.
Here is the BasicTest example with a busy test added:
And here is the error message I got with Teensydunio 1.57 using the Arduino 1.8.19 libraries on a Fedora 36 x86_64 system:
But it looks like there is a busy function in the header file, there is no busy function in the C++ file.
Here is the BasicTest example with a busy test added:
Code:
/* WS2812Serial BasicTest Example
Test LEDs by turning then 7 different colors.
This example code is in the public domain. */
#include <WS2812Serial.h>
const int numled = 64;
const int pin = 1;
// Usable pins:
// Teensy LC: 1, 4, 5, 24
// Teensy 3.2: 1, 5, 8, 10, 31 (overclock to 120 MHz for pin 8)
// Teensy 3.5: 1, 5, 8, 10, 26, 32, 33, 48
// Teensy 3.6: 1, 5, 8, 10, 26, 32, 33
// Teensy 4.0: 1, 8, 14, 17, 20, 24, 29, 39
// Teensy 4.1: 1, 8, 14, 17, 20, 24, 29, 35, 47, 53
byte drawingMemory[numled*3]; // 3 bytes per LED
DMAMEM byte displayMemory[numled*12]; // 12 bytes per LED
WS2812Serial leds(numled, displayMemory, drawingMemory, pin, WS2812_GRB);
#define RED 0xFF0000
#define GREEN 0x00FF00
#define BLUE 0x0000FF
#define YELLOW 0xFFFF00
#define PINK 0xFF1088
#define ORANGE 0xE05800
#define WHITE 0xFFFFFF
// Less intense...
/*
#define RED 0x160000
#define GREEN 0x001600
#define BLUE 0x000016
#define YELLOW 0x101400
#define PINK 0x120009
#define ORANGE 0x100400
#define WHITE 0x101010
*/
void setup() {
leds.begin();
}
void loop() {
// change all the LEDs in 1.5 seconds
int microsec = 1500000 / leds.numPixels();
colorWipe(RED, microsec);
colorWipe(GREEN, microsec);
colorWipe(BLUE, microsec);
colorWipe(YELLOW, microsec);
colorWipe(PINK, microsec);
colorWipe(ORANGE, microsec);
colorWipe(WHITE, microsec);
}
void colorWipe(int color, int wait) {
for (int i=0; i < leds.numPixels(); i++) {
leds.setPixel(i, color);
leds.show();
delayMicroseconds(wait);
while (leds.busy ()) {
yield ();
}
}
}
And here is the error message I got with Teensydunio 1.57 using the Arduino 1.8.19 libraries on a Fedora 36 x86_64 system:
Code:
/tmp/arduino_build_245626/sketch/Ws2812Serial_test.ino.cpp.o: In function `colorWipe(int, int)':
/home/meissner/Arduino/Tests/NeoPixel/Ws2812Serial_test/Ws2812Serial_test.ino:66: undefined reference to `WS2812Serial::busy()'
/home/meissner/Arduino/Tests/NeoPixel/Ws2812Serial_test/Ws2812Serial_test.ino:66: undefined reference to `WS2812Serial::busy()'
collect2: error: ld returned 1 exit status
Error compiling for board Teensy 4.1.