From 056e556c8601dee1586409ee4b65984021521228 Mon Sep 17 00:00:00 2001 From: Yves BAZIN Date: Wed, 20 Nov 2024 17:00:44 +0100 Subject: [PATCH] adding esp32s3 suppport --- README.md | 20 ++++++++++++++----- examples/gettingstarted/gettingstarted.ino | 14 ++++++++++++- .../gettingstartedFastLED.ino | 14 ++++++++++++- examples/pixelpush/pixelpush.ino | 12 +++++++++++ .../pixelpushwithpalette.ino | 10 ++++++++++ examples/secondcore/secondcore.ino | 20 +++++++++++++++---- examples/waitnowaitmode/waitnowaitmode.ino | 20 +++++++++++++++---- 7 files changed, 95 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index eced933..b4f87cf 100644 --- a/README.md +++ b/README.md @@ -275,13 +275,23 @@ Thanks to the ESP32 LCD driver being faster you can overclock the leds output (w * `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 +* `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 + #include "I2SClocklessVirtualLedDriver.h" + + I2SClocklessVirtualLedDriver driver; + +Pixel leds[NUM_STRIPS*NUM_LEDS_PER_STRIP]; + int pins[NBIS2SERIALPINS] ={14, 12, 13, 25}; + driver.initled((uint8_t*)leds,pins,CLOCK_PIN,LATCH_PIN,clock_1111KHZ); + ``` + + ```C Pixel led1[NUM_LEDS]; diff --git a/examples/gettingstarted/gettingstarted.ino b/examples/gettingstarted/gettingstarted.ino index fa64af3..b10793d 100644 --- a/examples/gettingstarted/gettingstarted.ino +++ b/examples/gettingstarted/gettingstarted.ino @@ -1,13 +1,25 @@ #define NBIS2SERIALPINS 6 // the number of virtual pins here mavimum 6x8=48 strips #define NUM_LEDS_PER_STRIP 256 #define NUM_LEDS (NUM_LEDS_PER_STRIP * NBIS2SERIALPINS * 8) +#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 #define NUM_STRIPS (NBIS2SERIALPINS * 8) #include "I2SClocklessVirtualLedDriver.h" Pixel leds[NUM_STRIPS * NUM_LEDS_PER_STRIP]; -int Pins[6] = {14, 12, 13, 25, 33, 32}; + I2SClocklessVirtualLedDriver driver; void setup() diff --git a/examples/gettingstartedFastLED/gettingstartedFastLED.ino b/examples/gettingstartedFastLED/gettingstartedFastLED.ino index d917233..cfa2e42 100644 --- a/examples/gettingstartedFastLED/gettingstartedFastLED.ino +++ b/examples/gettingstartedFastLED/gettingstartedFastLED.ino @@ -4,12 +4,24 @@ #define NUM_STRIPS (NBIS2SERIALPINS * 8) #define USE_FASTLED #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 // here we have 3 colors per pixel CRGB leds[NUM_STRIPS * NUM_LEDS_PER_STRIP]; -int Pins[6] = {14, 12, 13, 25, 33, 32}; + I2SClocklessVirtualLedDriver driver; void setup() diff --git a/examples/pixelpush/pixelpush.ino b/examples/pixelpush/pixelpush.ino index d202c88..73f9613 100644 --- a/examples/pixelpush/pixelpush.ino +++ b/examples/pixelpush/pixelpush.ino @@ -6,10 +6,22 @@ #define NUM_STRIPS (NBIS2SERIALPINS * 8) #define I2S_MAPPING_MODE I2S_MAPPING_MODE_OPTION_DIRECT_CALCULATION #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; diff --git a/examples/pixelpushwithpalette/pixelpushwithpalette.ino b/examples/pixelpushwithpalette/pixelpushwithpalette.ino index bbb76d4..1bd3419 100644 --- a/examples/pixelpushwithpalette/pixelpushwithpalette.ino +++ b/examples/pixelpushwithpalette/pixelpushwithpalette.ino @@ -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; diff --git a/examples/secondcore/secondcore.ino b/examples/secondcore/secondcore.ino index 1748f59..291da7b 100644 --- a/examples/secondcore/secondcore.ino +++ b/examples/secondcore/secondcore.ino @@ -5,11 +5,23 @@ #define NUM_STRIPS (NBIS2SERIALPINS * 8) #define USE_FASTLED #include "I2SClocklessVirtualLedDriver.h" -#define _LATCH_PIN 27 -#define _CLOCK_PIN 26 -Pixel leds[NUM_STRIPS * NUM_LEDS_PER_STRIP]; +#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]; + + uint16_t mapfunction(uint16_t pos) { int panelnumber = pos / 256; @@ -42,7 +54,7 @@ void setup() { Serial.begin(115200); - driver.initled(leds, Pins, _CLOCK_PIN, _LATCH_PIN); + driver.initled(leds, Pins, CLOCK_PIN, LATCH_PIN); driver.setBrightness(20); driver.setMapLed(&mapfunction); delay(2000); diff --git a/examples/waitnowaitmode/waitnowaitmode.ino b/examples/waitnowaitmode/waitnowaitmode.ino index dfe1d48..96de2e6 100644 --- a/examples/waitnowaitmode/waitnowaitmode.ino +++ b/examples/waitnowaitmode/waitnowaitmode.ino @@ -5,11 +5,23 @@ #define NUM_STRIPS (NBIS2SERIALPINS * 8) #define USE_FASTLED #include "I2SClocklessVirtualLedDriver.h" -#define _LATCH_PIN 27 -#define _CLOCK_PIN 26 -Pixel leds[NUM_STRIPS * NUM_LEDS_PER_STRIP]; +#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]; + + uint16_t mapfunction(uint16_t pos) { int panelnumber = pos / 256; @@ -42,7 +54,7 @@ void setup() { Serial.begin(115200); - driver.initled(leds, Pins, _CLOCK_PIN, _LATCH_PIN); + driver.initled(leds, Pins, CLOCK_PIN, LATCH_PIN); driver.setBrightness(20); driver.setMapLed(&mapfunction); delay(2000);