https://github.com/espressif/arduino-es ... oPixel.ino
I have a global buffer that I fill with data to send out the pixels.
Code: Select all
#define NR_OF_LEDS 8*4
#define NR_OF_ALL_BITS 24*NR_OF_LEDS
rmt_data_t led_data[NR_OF_ALL_BITS];
Code: Select all
if ((rmt_send = rmtInit(17, true, RMT_MEM_64)) == NULL) {
Serial.println("init sender failed\n");
}
float realTick = rmtSetTick(rmt_send, 100);
Code: Select all
int led, col, bit;
int i = 0;
for (led = 0; led < NR_OF_PIXELS; led++) {
for (col = 0; col < 3; col++) {
for (bit = 0; bit < 8; bit++) {
led_data[i].level0 = 1;
led_data[i].duration0 = 8; // T1H
led_data[i].level1 = 0;
led_data[i].duration1 = 5; // T1L
i++;
}
}
}
rmtWrite(rmt_send, led_data, NR_OF_ALL_BITS);
(I am using the Ardunio IDE but I don't think this topic of race condition is specific to the IDE.)