Skip to content

Commit 6a97f1e

Browse files
authored
Fixes RMT examples and adds ESP32-S3 config (#6235)
1 parent c0ed66e commit 6a97f1e

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

libraries/ESP32/examples/RMT/RMTCallback/RMTCallback.ino

+5-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ class MyProcessor {
1212

1313
public:
1414
MyProcessor(uint8_t pin, float nanoTicks) {
15-
assert((rmt_recv = rmtInit(21, RMT_RX_MODE, RMT_MEM_192)));
15+
if ((rmt_recv = rmtInit(pin, RMT_RX_MODE, RMT_MEM_192)) == NULL)
16+
{
17+
Serial.println("init receiver failed\n");
18+
}
1619

1720
realNanoTick = rmtSetTick(rmt_recv, nanoTicks);
1821
};
@@ -59,6 +62,6 @@ void setup()
5962

6063
void loop()
6164
{
62-
Serial.printf("GPIO 4: %08x 5: %08x 6: %08x\n", mp1.val(), mp2.val(), mp3.val());
65+
Serial.printf("GPIO 4: %08x 5: %08x 10: %08x\n", mp1.val(), mp2.val(), mp3.val());
6366
delay(500);
6467
}

libraries/ESP32/examples/RMT/RMTWriteNeoPixel/RMTWriteNeoPixel.ino

+12-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@
55

66
#include "esp32-hal.h"
77

8+
// The effect seen in ESP32C3, ESP32S2 and ESP32S3 is like a Blink of RGB LED
9+
#if CONFIG_IDF_TARGET_ESP32S2
10+
#define BUILTIN_RGBLED_PIN 18
11+
#elif CONFIG_IDF_TARGET_ESP32S3
12+
#define BUILTIN_RGBLED_PIN 48
13+
#elif CONFIG_IDF_TARGET_ESP32C3
14+
#define BUILTIN_RGBLED_PIN 8
15+
#else
16+
#define BUILTIN_RGBLED_PIN 21 // ESP32 has no builtin RGB LED
17+
#endif
18+
819
#define NR_OF_LEDS 8*4
920
#define NR_OF_ALL_BITS 24*NR_OF_LEDS
1021

@@ -41,7 +52,7 @@ void setup()
4152
{
4253
Serial.begin(115200);
4354

44-
if ((rmt_send = rmtInit(18, RMT_TX_MODE, RMT_MEM_64)) == NULL)
55+
if ((rmt_send = rmtInit(BUILTIN_RGBLED_PIN, RMT_TX_MODE, RMT_MEM_64)) == NULL)
4556
{
4657
Serial.println("init sender failed\n");
4758
}

0 commit comments

Comments
 (0)