Need Help Rewriting TLC5973 Library for ESP32 using RMT

Hello fellow developers,

I’m diving into a project with the TLC5973 LED driver from TI, specifically for the ESP32. I’ve been working with a library from miandehe on GitHub (GitHub - miandehe/Arduino-TLC5973) optimized for Arduino, which uses a bit-banging method. The challenge I’m facing is corrupted output when both WiFi and Bluetooth are activated concurrently on the ESP32. My aim is to leverage the RMT functionality of the ESP32 to address this and improve efficiency.

To add a layer of complexity, there’s another library for the TLC5973 by Caffein93 available (GitHub - caffeine93/esp32-tlc59731-driver: TLC59731 driver for ESP32 (ESP-IDF)). While it already uses the RMT functionality of the ESP, it’s designed specifically for the ESP-IDE. My workflow, however, is rooted in the Arduino-IDE for ESP32.

Below is a segment from my attempt at adjusting the TLC5973.cpp:

cpp


#include <driver/rmt.h>

// Konstanten für RMT Timing 
#define RMT_TICKS_PER_US (80 / 2) // 80MHz clock, 2 ticks pro μs
#define RMT_PULSE_TICKS (50 * RMT_TICKS_PER_US) // 50us Pulse
#define RMT_SHORT_TICKS (10 * RMT_TICKS_PER_US) // 10us Short
#define RMT_LONG_TICKS (40 * RMT_TICKS_PER_US) // 40us Long

// RMT Objekt
rmt_config_t rmtConfig;
rmt_item32_t rmtItems[MAX_LED_COUNT * 24];

// RMT initialisieren    
void begin() {

  rmtConfig.channel = RMT_CHANNEL;
  rmtConfig.gpio_num = RMT_PIN;
  rmtConfig.clk_div = 2;
  
  rmt_config(&rmtConfig);
  rmt_driver_install(rmtConfig.channel, 0, 0);

}

// Bit senden
void sendBit(uint8_t bit) {

  if(bit) {
    rmtItems[index].level0 = 1;
    rmtItems[index++].duration0 = RMT_PULSE_TICKS;
    rmtItems[index].level0 = 0;
    rmtItems[index++].duration0 = RMT_SHORT_TICKS; 
  } else {
    rmtItems[index].level0 = 1;
    rmtItems[index++].duration0 = RMT_SHORT_TICKS;
    rmtItems[index].level0 = 0;
    rmtItems[index++].duration0 = RMT_LONG_TICKS;
  }

}

// Byte senden  
void sendByte(uint8_t byte) {

  for(int i=0; i<8; i++) {
    sendBit(byte & 0x80);
    byte <<= 1; 
  }

}

// Daten senden
void show() {
  
  int index = 0;
  
  // Startbit
  sendBit(0); 
  
  // Datenbytes
  for(int i=0; i<numLEDs; i++) {
    sendByte(red[i]);
    sendByte(green[i]); 
    sendByte(blue[i]);
  }

  // Stopbit
  sendBit(0);

  // Über RMT senden
  rmt_write_items(rmtConfig.channel, rmtItems, index, false);

}

I’m hoping for:

  1. Suggestions on reworking the TLC5973 driver to utilize RMT within the Arduino IDE for ESP32.
  2. Tips, guides, or any references that align with my objectives.
  3. Shared experiences or insights about the “Arduino core for the ESP32” in the Arduino IDE.

While my strengths lie predominantly in hardware development, C programming tends to be a hurdle for me. I’d deeply appreciate any assistance or guidance. If anyone’s open to collaborating on creating a new driver for the TLC5973 compatible with ESP32 (with WiFi/BT enabled), I’d be more than willing to offer compensation.

Your insights would be invaluable, and I’m keen on learning and collaborating with this amazing community.

Thank you for your consideration and time!