Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
102 commits
Select commit Hold shift + click to select a range
3a3853c
feat(core): Add wait time before setup
tanakamasayuki May 15, 2025
eaec282
Update Arduino.h
tanakamasayuki May 15, 2025
756bde2
Update Arduino.h
tanakamasayuki May 15, 2025
22fba0c
feat(arduino): changing it to use time in ms
SuGlider Jun 21, 2025
a258a1e
feat(arduino): changing it to use time in ms
SuGlider Jun 21, 2025
12d7cde
feat(arduino): changing it to use time in ms
SuGlider Jun 21, 2025
c3d1ab0
Merge branch 'master' into patch-3
SuGlider Jun 21, 2025
ea28f54
feat(arduino): example for SET_TIME_BEFORE_STARTING_SEKETCH_MS
SuGlider Jun 21, 2025
1f7d449
feat(arduino): changing it to use time in ms
SuGlider Jun 21, 2025
e800462
fix(arduino): spacing and commentary error
SuGlider Jun 21, 2025
6638ed6
fix(arduino): spacing and commentary error
SuGlider Jun 21, 2025
f430084
Merge branch 'master' into patch-3
SuGlider Jun 22, 2025
87819f6
feat(usb): allow the MIDI constructor to define a device name
SuGlider Aug 12, 2025
e8d506c
feat(usb): changes the MIDI device descriptor in the example
SuGlider Aug 12, 2025
36ac341
feat(usb): changes the MIDI device descriptor in the example
SuGlider Aug 12, 2025
74fa530
fix(usb): typo in commentary - start CI again
SuGlider Aug 12, 2025
5af16d1
feat(usb): allow the MIDI constructor to define a device name
SuGlider Aug 12, 2025
8bb446b
fix(usb): correct constructor declaration
SuGlider Aug 12, 2025
fdd6ccd
fix(usb): typo in commentary - start CI again
SuGlider Aug 12, 2025
374e2d4
fix(uart): always applies the user selected UART Clock Source
SuGlider Aug 20, 2025
3078091
feat(rmt): adds new function to send specific number of loops
SuGlider Aug 20, 2025
ddf778a
feat(rmt): adds new function to send specific number of loops
SuGlider Aug 20, 2025
a9fe74d
fix(rmt): bad code formatting
SuGlider Aug 20, 2025
5413697
fix(rmt): bad code formatting
SuGlider Aug 20, 2025
473a4c6
feat(usb_midi): Enhance USBMIDI with device name
SuGlider Aug 22, 2025
75d04db
feat(usb_midi): Refactor USBMIDI with device name handling
SuGlider Aug 22, 2025
b3fbce7
feat(usb_midi): Add macro to set USB MIDI device name
SuGlider Aug 22, 2025
c930bc1
feat(usb_midi): demonstrate the use of macro to change the device name
SuGlider Aug 22, 2025
40fbd4f
fix(usb_midi): reduce changes to the code
SuGlider Aug 22, 2025
059a037
Merge branch 'master' into feature/device_name_usb_midi
SuGlider Aug 22, 2025
fb36be8
fix(usb_midi): Add macro guards
SuGlider Aug 22, 2025
69549c8
feat(http-client): add support for collecting all HTTP headers, close…
JakubAndrysek Aug 28, 2025
a2df766
refactor(CustomHeaders): replace USE_SERIAL with Serial for consistency
JakubAndrysek Aug 29, 2025
3bd54ba
Merge branch 'master' into http-client/collecting-headers
JakubAndrysek Sep 1, 2025
7a5df40
Merge branch 'master' into rmt_loop_count
SuGlider Sep 4, 2025
75941cd
ci(pre-commit): Comment when fixes are needed
lucasssvaz Sep 5, 2025
507e7a9
fix(pre-commit): Fix message and preserve comment
lucasssvaz Sep 5, 2025
0f61b4f
Merge branch 'master' into rmt_loop_count
SuGlider Sep 5, 2025
f5d0513
feat(rmt): check the loop count parameter
SuGlider Sep 5, 2025
e9aa349
feat(rmt): improve commentaries
SuGlider Sep 5, 2025
3641446
feat(rmt): improve commentaries
SuGlider Sep 5, 2025
6c8007f
feat(rmt): Refine loop handling in RMT transmission
SuGlider Sep 5, 2025
8346673
fix(rmt): bad spelling in commentary
SuGlider Sep 5, 2025
182eef8
feat(rmt): improve code clarity
SuGlider Sep 5, 2025
7d8bf25
feat(rmt): single logv line for all looping cases
SuGlider Sep 5, 2025
00989d4
feat(rmt): rmtWriteLoopingCount improvement
SuGlider Sep 5, 2025
3bb70e7
feat(rmt): improve verbose logging code
SuGlider Sep 5, 2025
f2218ba
fix(rmt): code identation
SuGlider Sep 5, 2025
55b8244
fix(rmt): bad copy & paste of function signature
SuGlider Sep 5, 2025
fdd3ac4
feat(rmt): code improvement and clarity
SuGlider Sep 5, 2025
198a49c
feat(rmt): improved commentaries and code clarity
SuGlider Sep 5, 2025
a198804
rmt(fix): improve code reliability
SuGlider Sep 5, 2025
8883c30
feat(rmt): improved code readness
SuGlider Sep 5, 2025
c9c00f8
fix(rmt): typo in commentary
SuGlider Sep 5, 2025
d4b31b2
fix(rmt): increase buffer size for loop count loop log msg
SuGlider Sep 5, 2025
c5993be
fix(rmt): typo in commentary
SuGlider Sep 5, 2025
a92d64f
fix(rmt): typo in commentary
SuGlider Sep 5, 2025
9915feb
fix(rmt): buffer size for log message
SuGlider Sep 5, 2025
eedf368
rmt(fix): improve code readness
SuGlider Sep 5, 2025
a4f3e63
feat(rmt): guarding SOC_RMT_SUPPORT_TX_LOOP_COUNT
SuGlider Sep 6, 2025
c3b1919
feat(rmt): adds new function to the example
SuGlider Sep 6, 2025
b9a054f
fix(rmt): remove repeated function name in log msg
SuGlider Sep 6, 2025
5ab1ee5
fix(rmt): remove repeated function name in log msg
SuGlider Sep 6, 2025
0682d37
fix(rmt): fixes the example to wait for rmt TX
SuGlider Sep 6, 2025
7da1885
fix(rmt): fixes bad code formating
SuGlider Sep 6, 2025
85113f9
fix(rmt): fixes bad code formating
SuGlider Sep 6, 2025
d6d715a
fix(rmt): fixes bad code formating
SuGlider Sep 6, 2025
8775dd1
fix(rmt): fixes bad code formating
SuGlider Sep 6, 2025
4d836d0
fix(rmt): commentary complement
SuGlider Sep 6, 2025
7fffb38
fix(rmt): adds missing return value
SuGlider Sep 6, 2025
d1434bd
feat(rmt): improve commentaries
SuGlider Sep 6, 2025
7aee326
Merge branch 'master' into uart_user_defined_clock_source
SuGlider Sep 6, 2025
2f4667a
Merge branch 'master' into feature/device_name_usb_midi
SuGlider Sep 8, 2025
b7b61c3
feat(midi): add midi dev name from macro
SuGlider Sep 9, 2025
1b4aea2
feat(midi): Enhance USBMIDI device name handling
SuGlider Sep 9, 2025
60e4a0b
feat(midi): USBMIDI class for device name
SuGlider Sep 9, 2025
219f838
fix(midi): comment typo
SuGlider Sep 9, 2025
10e1948
fix(rmt): fixes bad commentary formating
SuGlider Sep 9, 2025
62659c9
feat(rmt): more commentaries
SuGlider Sep 9, 2025
0d4dce2
fix(midi): move commentaries
SuGlider Sep 9, 2025
f3bd145
fix(midi): move commentaries
SuGlider Sep 9, 2025
c5cb5f0
feat(midi): add more commentaries
SuGlider Sep 9, 2025
fa7d041
fix(midi): fixes constructor commentary
SuGlider Sep 9, 2025
ce55c99
fix(midi): safeguard for memory leak
SuGlider Sep 9, 2025
c14e769
fix(midi): removes debug logging
SuGlider Sep 9, 2025
861abb9
feat(midi): explicit safer test and return
SuGlider Sep 9, 2025
13d7442
Merge branch 'master' into patch-3
SuGlider Sep 9, 2025
3f59ac6
feat(midi): avoids possible strlen(NULL)
SuGlider Sep 9, 2025
0c8076d
Merge branch 'master' into patch-3
SuGlider Sep 10, 2025
d9f89b8
Merge branch 'master' into feature/device_name_usb_midi
SuGlider Sep 10, 2025
3f3e4a6
Merge branch 'master' into uart_user_defined_clock_source
SuGlider Sep 10, 2025
29a1edc
Merge branch 'master' into rmt_loop_count
SuGlider Sep 10, 2025
a77a94b
ci(pre-commit): Apply automatic fixes
pre-commit-ci-lite[bot] Sep 10, 2025
87cce35
ci(pre-commit): Apply automatic fixes
pre-commit-ci-lite[bot] Sep 10, 2025
4bca706
ci(pre-commit): Apply automatic fixes
pre-commit-ci-lite[bot] Sep 10, 2025
ba60ffa
fix(rmt): typo in commentary
SuGlider Sep 10, 2025
a42f4a7
Merge pull request #11367 from tanakamasayuki/patch-3
me-no-dev Sep 10, 2025
6952595
Merge pull request #11720 from espressif/feature/device_name_usb_midi
me-no-dev Sep 10, 2025
6dedab3
Merge pull request #11747 from espressif/uart_user_defined_clock_source
me-no-dev Sep 10, 2025
2272489
Merge pull request #11748 from espressif/rmt_loop_count
me-no-dev Sep 10, 2025
fdff7be
Merge pull request #11768 from JakubAndrysek/http-client/collecting-h…
me-no-dev Sep 10, 2025
56842da
Merge pull request #11802 from lucasssvaz/ci/pre-commit-comment
me-no-dev Sep 10, 2025
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/pre-commit-status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,24 @@ jobs:
gh pr edit ${{ steps.pr-info.outputs.pr_number }} --repo ${{ github.repository }} --remove-label 'Status: Pre-commit fixes required ⚠️'
env:
GH_TOKEN: ${{ github.token }}

- name: Comment on PR about pre-commit failures
if: |
steps.pr-info.outputs.artifacts_found == 'true' &&
steps.pr-info.outputs.pre_commit_outcome == 'failure' &&
steps.pr-info.outputs.pending_commit == '0'
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
with:
pr-number: ${{ steps.pr-info.outputs.pr_number }}
message: |
## ⚠️ Pre-commit Hooks Failed

Some pre-commit hooks failed and require manual fixes. Please see the detailed error report below.

**What to do:**
1. 📋 [**View the detailed error report**](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}) to see which hooks failed
2. 🔧 Fix the issues locally in your code
3. 💾 Commit and push your changes
4. 🔄 The hooks will run again automatically

**Need help?** Ask in the comments below.
24 changes: 24 additions & 0 deletions cores/esp32/Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,36 @@ size_t getArduinoLoopTaskStackSize(void);
return sz; \
}

#define ESP32_USB_MIDI_DEFAULT_NAME "TinyUSB MIDI"
/**
* @brief Set the current device name
* 1. Name set via constructor (if any)
* 2. Name set via SET_USB_MIDI_DEVICE_NAME() macro (if defined)
* 3. Default name "TinyUSB MIDI"
* If device name is set as "", it will be ignored
*/
#define SET_USB_MIDI_DEVICE_NAME(name) \
const char *getUSBMIDIDefaultDeviceName() { \
if (!name || strlen(name) == 0) { \
return ESP32_USB_MIDI_DEFAULT_NAME; \
} \
return name; \
}

bool shouldPrintChipDebugReport(void);
#define ENABLE_CHIP_DEBUG_REPORT \
bool shouldPrintChipDebugReport(void) { \
return true; \
}

// macro SET_TIME_BEFORE_STARTING_SKETCH_MS(time_ms) can set a time in milliseconds
// before the sketch would start its execution. It gives the user time to open the Serial Monitor
uint64_t getArduinoSetupWaitTime_ms(void);
#define SET_TIME_BEFORE_STARTING_SKETCH_MS(time_ms) \
uint64_t getArduinoSetupWaitTime_ms() { \
return (time_ms); \
}

// allows user to bypass esp_spiram_test()
bool esp_psram_extram_test(void);
#define BYPASS_SPIRAM_TEST(bypass) \
Expand Down
57 changes: 45 additions & 12 deletions cores/esp32/esp32-hal-rmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ bool rmtDeinit(int pin) {
return false;
}

static bool _rmtWrite(int pin, rmt_data_t *data, size_t num_rmt_symbols, bool blocking, bool loop, uint32_t timeout_ms) {
static bool _rmtWrite(int pin, rmt_data_t *data, size_t num_rmt_symbols, bool blocking, uint32_t loop, uint32_t timeout_ms) {
rmt_bus_handle_t bus = _rmtGetBus(pin, __FUNCTION__);
if (bus == NULL) {
return false;
Expand All @@ -303,11 +303,21 @@ static bool _rmtWrite(int pin, rmt_data_t *data, size_t num_rmt_symbols, bool bl
}
}

#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_VERBOSE
log_v("GPIO: %d - Request: %d RMT Symbols - %s - Timeout: %d", pin, num_rmt_symbols, blocking ? "Blocking" : "Non-Blocking", timeout_ms);
log_v(
"GPIO: %d - Currently in Loop Mode: [%s] | Asked to Loop: %s, LoopCancel: %s", pin, bus->rmt_ch_is_looping ? "YES" : "NO", loop ? "YES" : "NO",
loopCancel ? "YES" : "NO"
);
// loop parameter semantics:
// loop == 0: no looping (single transmission)
// loop == 1: infinite looping
// loop > 1: transmit the data 'loop' times
{
char buf[17]; // placeholder for up to maximum uint32_t value (4294967295) = 10 digits + " times" (6 chars) + null terminator (17 bytes)
snprintf(buf, sizeof(buf), "%lu times", loop);
log_v(
"GPIO: %d - Currently in Loop Mode: [%s] | Loop Request: [%s], LoopCancel: [%s]", pin, bus->rmt_ch_is_looping ? "YES" : "NO",
loop == 0 ? "NO" : (loop == 1 ? "FOREVER" : buf), loopCancel ? "YES" : "NO"
);
}
#endif

if ((xEventGroupGetBits(bus->rmt_events) & RMT_FLAG_TX_DONE) == 0) {
log_v("GPIO %d - RMT Write still pending to be completed.", pin);
Expand Down Expand Up @@ -336,8 +346,8 @@ static bool _rmtWrite(int pin, rmt_data_t *data, size_t num_rmt_symbols, bool bl
bus->rmt_ch_is_looping = false;
} else { // new writing | looping request
// looping | Writing over a previous looping state is valid
if (loop) {
transmit_cfg.loop_count = -1; // enable infinite loop mode
if (loop > 0) {
transmit_cfg.loop_count = (loop == 1) ? -1 : loop;
// keeps RMT_FLAG_TX_DONE set - it never changes
} else {
// looping mode never sets this flag (IDF 5.1) in the callback
Expand All @@ -348,8 +358,10 @@ static bool _rmtWrite(int pin, rmt_data_t *data, size_t num_rmt_symbols, bool bl
retCode = false;
log_w("GPIO %d - RMT Transmission failed.", pin);
} else { // transmit OK
if (loop) {
bus->rmt_ch_is_looping = true; // for ever... until a channel canceling or new writing
if (loop > 0) {
// rmt_ch_is_looping is used as a flag to indicate that RMT is in looping execution in order to
// be canceled whenever a new _rmtWrite() is executed while it is looping
bus->rmt_ch_is_looping = true;
} else {
if (blocking) {
// wait for transmission confirmation | timeout
Expand Down Expand Up @@ -402,15 +414,36 @@ static bool _rmtRead(int pin, rmt_data_t *data, size_t *num_rmt_symbols, bool wa
}

bool rmtWrite(int pin, rmt_data_t *data, size_t num_rmt_symbols, uint32_t timeout_ms) {
return _rmtWrite(pin, data, num_rmt_symbols, true /*blocks*/, false /*looping*/, timeout_ms);
return _rmtWrite(pin, data, num_rmt_symbols, true /*blocks*/, 0 /*looping*/, timeout_ms);
}

bool rmtWriteAsync(int pin, rmt_data_t *data, size_t num_rmt_symbols) {
return _rmtWrite(pin, data, num_rmt_symbols, false /*blocks*/, false /*looping*/, 0 /*N/A*/);
return _rmtWrite(pin, data, num_rmt_symbols, false /*blocks*/, 0 /*looping*/, 0 /*N/A*/);
}

bool rmtWriteLooping(int pin, rmt_data_t *data, size_t num_rmt_symbols) {
return _rmtWrite(pin, data, num_rmt_symbols, false /*blocks*/, true /*looping*/, 0 /*N/A*/);
return _rmtWrite(pin, data, num_rmt_symbols, false /*blocks*/, 1 /*looping*/, 0 /*N/A*/);
}

// Same as rmtWriteLooping(...) but it transmits the data a fixed number of times ("loop_count").
// loop_count == 0 is invalid (no transmission); loop_count == 1 transmits once (no looping); loop_count > 1 transmits the data repeatedly (looping).
bool rmtWriteRepeated(int pin, rmt_data_t *data, size_t num_rmt_symbols, uint32_t loop_count) {
if (loop_count == 0) {
log_e("RMT TX GPIO %d : Invalid loop_count (%u). Must be at least 1.", pin, loop_count);
return false;
}
if (loop_count == 1) {
// send the RMT symbols once using non-blocking write (single non-looping transmission)
return _rmtWrite(pin, data, num_rmt_symbols, false /*blocks*/, 0 /*looping*/, 0 /*N/A*/);
} else {
// write the RMT symbols for loop_count times
#if SOC_RMT_SUPPORT_TX_LOOP_COUNT
return _rmtWrite(pin, data, num_rmt_symbols, false /*blocks*/, loop_count /*looping*/, 0 /*N/A*/);
#else
log_e("RMT TX GPIO %d : Loop Count is not supported. Writing failed.", pin);
return false;
#endif
}
}

bool rmtTransmitCompleted(int pin) {
Expand Down
8 changes: 6 additions & 2 deletions cores/esp32/esp32-hal-rmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ bool rmtWrite(int pin, rmt_data_t *data, size_t num_rmt_symbols, uint32_t timeou
bool rmtWriteAsync(int pin, rmt_data_t *data, size_t num_rmt_symbols);

/**
Writing data up to the reserved memsize, looping continuously
Writing data up to the reserved memsize, looping continuously (rmtWriteLooping()) or fixed
number of <loop_count> times (rmtWriteRepeated())

<rmt_symbol> is a 32 bits structure as defined by rmt_data_t type.
It is possible to use the macro RMT_SYMBOLS_OF(data), if data is an array of rmt_data_t

Expand All @@ -133,9 +135,11 @@ bool rmtWriteAsync(int pin, rmt_data_t *data, size_t num_rmt_symbols);
Non-Blocking mode - returns right after execution
Returns <true> on execution success, <false> otherwise

<bool rmtTransmitCompleted(int pin)> will return always <true> while it is looping.
<bool rmtTransmitCompleted(int pin)> will return always <true> while it is looping mode.
looping mode is active for rmtWriteLooping() and for rmtWriteRepeated() when loop_count > 1.
*/
bool rmtWriteLooping(int pin, rmt_data_t *data, size_t num_rmt_symbols);
bool rmtWriteRepeated(int pin, rmt_data_t *data, size_t num_rmt_symbols, uint32_t loop_count);

/**
Checks if transmission is completed and the rmtChannel ready for transmitting new data.
Expand Down
27 changes: 8 additions & 19 deletions cores/esp32/esp32-hal-uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct uart_struct_t {
uint16_t _rx_buffer_size, _tx_buffer_size; // UART RX and TX buffer sizes
bool _inverted; // UART inverted signal
uint8_t _rxfifo_full_thrhd; // UART RX FIFO full threshold
int8_t _uart_clock_source; // UART Clock Source used when it is started using uartBegin()
int8_t _uart_clock_source; // UART Clock Source that should be used if user defines an specific one with setClockSource()
};

#if CONFIG_DISABLE_HAL_LOCKS
Expand Down Expand Up @@ -820,7 +820,7 @@ uart_t *uartBegin(
uart_config.baud_rate = baudrate;
#if SOC_UART_LP_NUM >= 1
if (uart_nr >= SOC_UART_HP_NUM) { // it is a LP UART NUM
if (uart->_uart_clock_source > 0) {
if (uart->_uart_clock_source >= 0) {
uart_config.lp_source_clk = (soc_periph_lp_uart_clk_src_t)uart->_uart_clock_source; // use user defined LP UART clock
log_v("Setting UART%d to user defined LP clock source (%d) ", uart_nr, uart->_uart_clock_source);
} else {
Expand Down Expand Up @@ -881,14 +881,7 @@ uart_t *uartBegin(
uart->_tx_buffer_size = tx_buffer_size;
uart->has_peek = false;
uart->peek_byte = 0;
#if SOC_UART_LP_NUM >= 1
if (uart_nr >= SOC_UART_HP_NUM) {
uart->_uart_clock_source = uart_config.lp_source_clk;
} else
#endif
{
uart->_uart_clock_source = uart_config.source_clk;
}
// uart->_uart_clock_source can only change by explicit user API request/call
}
UART_MUTEX_UNLOCK();

Expand Down Expand Up @@ -1149,10 +1142,9 @@ bool uartSetBaudRate(uart_t *uart, uint32_t baud_rate) {
}
bool retCode = true;
soc_module_clk_t newClkSrc = UART_SCLK_DEFAULT;
int8_t previousClkSrc = uart->_uart_clock_source;
#if SOC_UART_LP_NUM >= 1
if (uart->num >= SOC_UART_HP_NUM) { // it is a LP UART NUM
if (uart->_uart_clock_source > 0) {
if (uart->_uart_clock_source >= 0) {
newClkSrc = (soc_periph_lp_uart_clk_src_t)uart->_uart_clock_source; // use user defined LP UART clock
log_v("Setting UART%d to user defined LP clock source (%d) ", uart->num, newClkSrc);
} else {
Expand Down Expand Up @@ -1187,13 +1179,10 @@ bool uartSetBaudRate(uart_t *uart, uint32_t baud_rate) {
}
}
UART_MUTEX_LOCK();
// if necessary, set the correct UART Clock Source before changing the baudrate
if (previousClkSrc < 0 || previousClkSrc != newClkSrc) {
HP_UART_SRC_CLK_ATOMIC() {
uart_ll_set_sclk(UART_LL_GET_HW(uart->num), newClkSrc);
}
uart->_uart_clock_source = newClkSrc;
HP_UART_SRC_CLK_ATOMIC() {
uart_ll_set_sclk(UART_LL_GET_HW(uart->num), newClkSrc);
}
// uart->_uart_clock_source can only change by explicit user API request/call
if (uart_set_baudrate(uart->num, baud_rate) == ESP_OK) {
log_v("Setting UART%d baud rate to %ld.", uart->num, baud_rate);
uart->_baudrate = baud_rate;
Expand Down Expand Up @@ -1312,7 +1301,7 @@ bool uartSetClockSource(uint8_t uartNum, uart_sclk_t clkSrc) {
{
uart->_uart_clock_source = clkSrc;
}
//log_i("UART%d set clock source to %d", uart->num, uart->_uart_clock_source);
log_v("UART%d set clock source to %d", uart->num, uart->_uart_clock_source);
return true;
}

Expand Down
8 changes: 8 additions & 0 deletions cores/esp32/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,18 @@ __attribute__((weak)) bool shouldPrintChipDebugReport(void) {
return false;
}

// this function can be changed by the sketch using the macro SET_TIME_BEFORE_STARTING_SKETCH_MS(time_ms)
__attribute__((weak)) uint64_t getArduinoSetupWaitTime_ms(void) {
return 0;
}

void loopTask(void *pvParameters) {
#if !defined(NO_GLOBAL_INSTANCES) && !defined(NO_GLOBAL_SERIAL)
// sets UART0 (default console) RX/TX pins as already configured in boot or as defined in variants/pins_arduino.h
Serial0.setPins(gpioNumberToDigitalPin(SOC_RX0), gpioNumberToDigitalPin(SOC_TX0));
// time in ms that the sketch may wait before starting its execution - default is zero
// usually done for opening the Serial Monitor and seeing all debug messages
delay(getArduinoSetupWaitTime_ms());
#endif
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
printBeforeSetupInfo();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// macro SET_TIME_BEFORE_STARTING_SKETCH_MS(time_ms) can set a time in milliseconds
// before the sketch would start its execution. It gives the user time to open the Serial Monitor

// This will force the Sketch execution to wait for 5 seconds before starting it execution
// setup() will be executed only after this time
SET_TIME_BEFORE_STARTING_SKETCH_MS(5000);

void setup() {
Serial.begin(115200);
Serial.println("After 5 seconds... this message will be seen in the Serial Monitor.");
}

void loop() {}
25 changes: 25 additions & 0 deletions libraries/ESP32/examples/RMT/RMT_LED_Blink/RMT_LED_Blink.ino
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,30 @@ void RMT_Loop_Write_Blink() {
delay(2000);
}

void RMT_Repeated_Write_Blink() {
Serial.println("Using RMT Writing repeated N times to blink an LED.");
Serial.println("Blinking at 1s on + 1s off :: 2 blinks");
// repeating blink_1s_rmt_data (1s on + 1s off) 2 times for 2 blinks
if (!rmtWriteRepeated(BLINK_GPIO, blink_1s_rmt_data, RMT_SYMBOLS_OF(blink_1s_rmt_data), 2)) {
Serial.println("===> rmtWrite Blink 1s Error!");
}
delay(4000 + 1000); // it should blink 2 times and stop automatically
Serial.println("Blinking at 500ms on + 500ms off :: 4 blinks");
// repeating blink_500ms_rmt_data (500ms on + 500ms off) 4 times for 4 blinks
if (!rmtWriteRepeated(BLINK_GPIO, blink_500ms_rmt_data, RMT_SYMBOLS_OF(blink_500ms_rmt_data), 4)) {
Serial.println("===> rmtWrite Blink 0.5s Error!");
}
delay(4000 + 1000); // it should blink 4 times and stop automatically
Serial.println("Blinking at 250ms on + 250ms off :: 8 blinks");
// repeating blink_250ms_rmt_data (250ms on + 250ms off) 8 times for 8 blinks
if (!rmtWriteRepeated(BLINK_GPIO, blink_250ms_rmt_data, RMT_SYMBOLS_OF(blink_250ms_rmt_data), 8)) {
Serial.println("===> rmtWrite Blink 0.25s Error!");
}
delay(4000 + 1000); // it should blink 8 times and stop automatically
Serial.println("Blinking is OFF for 2 seconds");
delay(2000);
}

void RMT_Single_Write_Blocking_Blink() {
Serial.println("Using RMT Writing and its Completion to blink an LED.");
Serial.println("Blinking at 1s on + 1s off :: 2 blinks");
Expand Down Expand Up @@ -356,6 +380,7 @@ void setup() {
void loop() {
RMT_Write_Aync_Non_Blocking_Blink();
RMT_Loop_Write_Blink();
RMT_Repeated_Write_Blink();
RMT_Single_Write_Blocking_Blink();
Serial.println("\nStarting OVER...\n");
}
Loading