hpwit / fastled-esp32-16PINS

MIT License
19 stars 3 forks source link

WS2811_PORTA error #1

Open ScobbyDoo opened 3 years ago

ScobbyDoo commented 3 years ago

I cant find any example code in yore repo I tried this one getting error WS2811_PORTA error I'm implementing this code in https://github.com/hpwit/artnetESP32

#define FASTLED_ALLOW_INTERRUPTS 0
#include "FastLED.h"
#define FASTLED_USING_NAMESPACE
#define FASTLED_SHOW_CORE 0

#define NUM_STRIPS 5
#define NUM_LEDS_PER_STRIP 100

// 5 strips 2 6 12 16 19 - bit mask R to L
#define PORT_MASK 0b1001000100000100010

#define NUM_LEDS NUM_STRIPS * NUM_LEDS_PER_STRIP
CRGB leds[NUM_LEDS];
static uint8_t hue = 0;

static TaskHandle_t FastLEDshowTaskHandle = 0;
static TaskHandle_t userTaskHandle = 0;

void FastLEDshowESP32()
{
  if (userTaskHandle == 0)
  {
    const TickType_t xMaxBlockTime = pdMS_TO_TICKS(200);

    userTaskHandle = xTaskGetCurrentTaskHandle();

    //  Trig show task
    xTaskNotifyGive(FastLEDshowTaskHandle);
    ulTaskNotifyTake(pdTRUE, portMAX_DELAY); userTaskHandle = 0; //wait till compl...
  }
}

void FastLEDshowTask(void *pvParameters)
{
  const TickType_t xMaxBlockTime = pdMS_TO_TICKS(500);
  // -- Run forever... for(;;) {
  // -- Wait for the trigger
  ulTaskNotifyTake(pdTRUE, portMAX_DELAY);
  FastLED.show();
  xTaskNotifyGive(userTaskHandle);
}

void setup()
{
  xTaskCreatePinnedToCore(FastLEDshowTask, "FastLEDshowTask", 2048, NULL, 2, &FastLEDshowTaskHandle, FASTLED_SHOW_CORE);
  //FastLED.addLeds<WS2811_PORTA,NUM_STRIPS,PORT_MASK>(leds, NUM_LEDS_PER_STRIP); //
  //OR
  FastLED.addLeds<WS2812B_PORTA, NUM_STRIPS, PORT_MASK>(leds, NUM_LEDS_PER_STRIP); //
}

void loop()
{
  for (int i = 0; i < NUM_STRIPS; i++)
  {
    for (int j = 0; j < NUM_LEDS_PER_STRIP; j++)
    {
      leds[(i * NUM_LEDS_PER_STRIP) + j] = CHSV((32 * i) + hue + j, 192, 255);
    }
  }
  // Set the first n leds on each strip to show which strip it is
  for (int i = 0; i < NUM_STRIPS; i++) {
    for (int j = 0; j <= i; j++) {
      leds[(i * NUM_LEDS_PER_STRIP) + j] = CRGB::Red;
    }
  }
  hue++;
  FastLEDshowESP32(); // FastLED.show();
}
hpwit commented 3 years ago

Hello I do not use this library anymore. you can either use the normal version of fastled or use my new library https://github.com/hpwit/I2SClocklessLedDriver

ScobbyDoo commented 3 years ago

is it possible to use this i2s driver with esp8266 i want to drive 8 output with 1 ic

hpwit commented 3 years ago

I will need to study that but it should be possible. To drive 8 strips from one ic you will still need 3 pins (clock/latch/data)