Skip to content

Commit f5d0513

Browse files
SuGliderCopilot
andauthored
feat(rmt): check the loop count parameter
Co-authored-by: Copilot <[email protected]>
1 parent 0f61b4f commit f5d0513

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cores/esp32/esp32-hal-rmt.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,10 @@ bool rmtWriteLooping(int pin, rmt_data_t *data, size_t num_rmt_symbols) {
420420

421421
// Same as rmtWriteLooping(...) but limits number of loops to "loop_count"
422422
bool rmtWriteLoopingCount(int pin, rmt_data_t *data, size_t num_rmt_symbols, uint32_t loop_count) {
423+
if (loop_count <= 1) {
424+
log_w("rmtWriteLoopingCount: Invalid loop_count (%u). Must be greater than 1.", loop_count);
425+
return false;
426+
}
423427
return _rmtWrite(pin, data, num_rmt_symbols, false /*blocks*/, loop_count /*looping*/, 0 /*N/A*/);
424428
}
425429

0 commit comments

Comments
 (0)