Skip to content

Commit

Permalink
Merge pull request #29 from hpwit/integration
Browse files Browse the repository at this point in the history
Integration
  • Loading branch information
hpwit authored Nov 20, 2024
2 parents 942cd71 + 7a7a39c commit b90611c
Show file tree
Hide file tree
Showing 12 changed files with 638 additions and 86 deletions.
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
[![build status](https://github.com/hpwit/I2SClocklessVirtualLedDriver/actions/workflows/testcode.yml/badge.svg)](https://github.com/hpwit/I2SClocklessVirtualLedDriver/actions/workflows/testcode.yml)   [![Badge Version](https://img.shields.io/github/v/release/hpwit/I2SClocklessVirtualLedDriver?label=latest%20release)](https://github.com/hpwit/I2SClocklessVirtualLedDriver/releases/latest)   [![Badge Version](https://img.shields.io/badge/release_note-blue)](Releasenote.md)

# I2SClocklessVirtualLedDriver for esp32
# I2SClocklessVirtualLedDriver for esp32 and esp32S3
## Introduction
Hello led afficionados !! Here is the new version of the Virtual pins library. In reality this version of the library had been sitting more or less finalized on my laptop for a while. I needed to take the time and energy to write the correct examples and of course update the documentation.
I have been writing led drivers for the past couple of years now while I was building [my 123x48 panel](https://hackaday.io/project/158268-5904-leds-panel).
It inspired me to create the I2S driver implemented in FastLED and then the Virtual pins library.
I am also planning to merge all my different led libraries (4 of them in total)

**NB : On the ESP32SS3 you can [overclock the leds](#for-esp32s3-only) up to 1125KHZ instead of 800KHZ**

### What kind of led do you want to drive
This library is a new take on driving ws2812 leds with I2S on an esp32. It allows to drive up to 120 strips !!! leds in parallel of
Expand Down Expand Up @@ -36,6 +37,9 @@ I have rewritten the library out of the FastLED framework to allow easier testin
I am trying to be kinda lenghtly on this readme. I hope to explain the why of some functions and for the user to use the one most suitable for its use case.
Some of the 'maybe most' of the functionailities will never been used be it was fun and intersting to implement.




## Let's start
### How can 120 strips can de driven in parallel with an esp32 !!!
The esp32 has 24 pins that can act as outputs pins. This is far away from 120 pins ...
Expand Down Expand Up @@ -256,11 +260,29 @@ Pixel leds[NUM_STRIPS*NUM_LEDS_PER_STRIP];
```

#### Other initialization functions:


* `void initled(Pixel leds, int *Pinsq, int CLOCK_PIN, int LATCH_PIN)`
* `void initled(CRGB leds, int *Pinsq, int CLOCK_PIN, int LATCH_PIN)`
* `void initled(frameBuffer *leds, int *Pinsq, int CLOCK_PIN, int LATCH_PIN)` this will be explained later on how to use a frameBuffer
* `void initled(int *Pinsq, int CLOCK_PIN, int LATCH_PIN)`: you can initialized the driver without a led buffer.
this is also used in the case of direct pixel calculation

#### For esp32S3 only
Thanks to the ESP32 LCD driver being faster you can overclock the leds output (which is limited on the esp32 to send 8 pixels per pin at 800KHZ you need a 19.2Mhz clock and the esp32 above 20Mhz is not reliable)
* `void initled(Pixel leds, int *Pinsq, int CLOCK_PIN, int LATCH_PIN,clock_speed clock)`
* `void initled(CRGB leds, int *Pinsq, int CLOCK_PIN, int LATCH_PIN,clock_speed clock)`
* `void initled((uint8_t*)leds,pins,CLOCK_PIN,LATCH_PIN,clock_speed clock)`

Here are the possible values
* `clock_800KHZ` : default value
* `clock_1000KHZ` : works really fine
* `clock_1111KHZ` : depending on your boards
* `clock_1123KHZ` : the max I manage to get

example:
`driver.initled(pins,CLOCK_PIN,LATCH_PIN,clock_1111KHZ)`

```C
Pixel led1[NUM_LEDS];
Pixel leds2[NUM_LEDS];
Expand Down
10 changes: 10 additions & 0 deletions examples/colorpalette/colorpalette.ino
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,20 @@
#define _USE_PALETTE
#define USE_FASTLED // to have the CHSV mapping
#include "I2SClocklessVirtualLedDriver.h"
#ifdef CONFIG_IDF_TARGET_ESP32S3
#define LATCH_PIN 46
#define CLOCK_PIN 3
#else

#define LATCH_PIN 27
#define CLOCK_PIN 26
#endif

#ifdef CONFIG_IDF_TARGET_ESP32S3
int Pins[6] = {9, 10,12,8,18,17};
#else
int Pins[6] = {14, 12, 13, 25, 33, 32};
#endif

I2SClocklessVirtualLedDriver driver;
uint8_t leds[NUM_LEDS];
Expand Down
20 changes: 16 additions & 4 deletions examples/framebuffer/framebuffer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,20 @@
#define NUM_LEDS (NUM_LEDS_PER_STRIP * NBIS2SERIALPINS * 8)
#define NUM_STRIPS (NBIS2SERIALPINS * 8)
#include "I2SClocklessVirtualLedDriver.h"
#define _LATCH_PIN 27
#define _CLOCK_PIN 26
#ifdef CONFIG_IDF_TARGET_ESP32S3
#define LATCH_PIN 46
#define CLOCK_PIN 3
#else

#define LATCH_PIN 27
#define CLOCK_PIN 26
#endif

#ifdef CONFIG_IDF_TARGET_ESP32S3
int Pins[6] = {9, 10,12,8,18,17};
#else
int Pins[6] = {14, 12, 13, 25, 33, 32};
#endif

#if TEST_USE_FRAMEBUFFER == 1
frameBuffer leds = frameBuffer(NUM_LEDS);
Expand All @@ -22,9 +34,9 @@ void setup()
{
Serial.begin(115200);
#if TEST_USE_FRAMEBUFFER == 1
driver.initled(&leds, Pins, _CLOCK_PIN, _LATCH_PIN);
driver.initled(&leds, Pins, CLOCK_PIN, LATCH_PIN);
#else
driver.initled(leds, Pins, _CLOCK_PIN, _LATCH_PIN);
driver.initled(leds, Pins, CLOCK_PIN, LATCH_PIN);
#endif
driver.setBrightness(20);
}
Expand Down
18 changes: 15 additions & 3 deletions examples/gettingstartedRGBW/gettingstartedRGBW.ino
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,23 @@
#define COLOR_RGBW
// here we have 4 colors per pixel
#include "I2SClocklessVirtualLedDriver.h"
#define CLOCK_PIN 16
#define LATCH_PIN 26
#ifdef CONFIG_IDF_TARGET_ESP32S3
#define LATCH_PIN 46
#define CLOCK_PIN 3
#else

#define LATCH_PIN 27
#define CLOCK_PIN 26
#endif

#ifdef CONFIG_IDF_TARGET_ESP32S3
int Pins[6] = {9, 10,12,8,18,17};
#else
int Pins[6] = {14, 12, 13, 25, 33, 32};
#endif
Pixel leds[NUM_STRIPS * NUM_LEDS_PER_STRIP];

int pins[16] = {0, 2, 4, 5, 12, 13, 14, 15, 16, 18, 19, 21, 22, 23, 25, 26};


I2SClocklessVirtualLedDriver driver;
void setup()
Expand Down
14 changes: 13 additions & 1 deletion examples/interruptlines/interruptlines.ino
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,23 @@

#define NUM_LEDS (LED_HEIGHT * LED_WIDTH)
#include "pics.h"
#ifdef CONFIG_IDF_TARGET_ESP32S3
#define LATCH_PIN 46
#define CLOCK_PIN 3
#else

#define LATCH_PIN 27
#define CLOCK_PIN 26
Pixel leds[LED_HEIGHT * LED_WIDTH]; // 48*256=12288 leds 36,864 bytes
#endif

#ifdef CONFIG_IDF_TARGET_ESP32S3
int Pins[6] = {9, 10,12,8,18,17};
#else
int Pins[6] = {14, 12, 13, 25, 33, 32};
#endif
Pixel leds[LED_HEIGHT * LED_WIDTH]; // 48*256=12288 leds 36,864 bytes



I2SClocklessVirtualLedDriver driver;
OffsetDisplay offd;
Expand Down
14 changes: 13 additions & 1 deletion examples/mapping/mapping.ino
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,23 @@
#include "I2SClocklessVirtualLedDriver.h"

#define NUM_LEDS (LED_HEIGHT * LED_WIDTH)
#ifdef CONFIG_IDF_TARGET_ESP32S3
#define LATCH_PIN 46
#define CLOCK_PIN 3
#else

#define LATCH_PIN 27
#define CLOCK_PIN 26
Pixel leds[LED_HEIGHT * LED_WIDTH]; // 48*256=12288 leds 36,864 bytes
#endif

#ifdef CONFIG_IDF_TARGET_ESP32S3
int Pins[6] = {9, 10,12,8,18,17};
#else
int Pins[6] = {14, 12, 13, 25, 33, 32};
#endif
Pixel leds[LED_HEIGHT * LED_WIDTH]; // 48*256=12288 leds 36,864 bytes



I2SClocklessVirtualLedDriver driver;

Expand Down
14 changes: 13 additions & 1 deletion examples/panelhardwarescroll/panelhardwarescroll.ino
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,23 @@

#define NUM_LEDS (LED_HEIGHT * LED_WIDTH)
#include "pics.h"
#ifdef CONFIG_IDF_TARGET_ESP32S3
#define LATCH_PIN 46
#define CLOCK_PIN 3
#else

#define LATCH_PIN 27
#define CLOCK_PIN 26
Pixel leds[LED_HEIGHT * LED_WIDTH + 1]; // 48*256=12288 leds 36,864 bytes
#endif

#ifdef CONFIG_IDF_TARGET_ESP32S3
int Pins[6] = {9, 10,12,8,18,17};
#else
int Pins[6] = {14, 12, 13, 25, 33, 32};
#endif
Pixel leds[LED_HEIGHT * LED_WIDTH + 1]; // 48*256=12288 leds 36,864 bytes



I2SClocklessVirtualLedDriver driver;
OffsetDisplay offd;
Expand Down
Empty file added for-esp32s3-only
Empty file.
4 changes: 2 additions & 2 deletions library.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "I2SClocklessVirtualLedDriver",
"keywords": "NeoPixel, WS2811, WS2812, WS2813, SK6812, DotStar, RGB, RGBW",
"description": "Supports for Esp32. Support for RGBW pixels. up to 120 stips in full parallel mode.",
"description": "Supports for Esp32 and esp32s3. Support for RGBW pixels. up to 120 stips in full parallel mode.",
"homepage": "ttps://github.com/hpwit/I2SClocklessVirtualLedDriver",
"repository":
{
"type": "git",
"url": "https://github.com/hpwit/I2SClocklessVirtualLedDriver"
},
"version": "2.0.0",
"version": "2.1.0",
"frameworks": "arduino",
"platforms": "*"
}
Expand Down
4 changes: 2 additions & 2 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name=I2SClocklessVirtualLedDriver
version=2.0.0
version=2.1.0
author=Yves BAZIN
maintainer=Yves BAZIN
sentence=A library that makes controlling NeoPixels (WS2811, WS2812, WS2813 & SK6812) in parallel mode for esp32.
paragraph=Supports for Esp32. Support for RGBW pixels. up to 120 stips in full parallel mode.
paragraph=Supports for Esp32 and esp32s3. Support for RGBW pixels. up to 120 stips in full parallel mode.
category=Display
url=https://github.com/hpwit/I2SClocklessVirtualLedDriver
architectures=*
Loading

0 comments on commit b90611c

Please sign in to comment.