← index #7015Issue #15521
Off-topic · high · value 0.399
QUERY · ISSUE

ESP32 RMT: two enhancement suggestions

openby peterhinchopened 2021-03-11updated 2022-11-08

These stem from my use of RMT for its original purpose. My "blaster" libraries for 433Mhz and IR remote controls support Pyboard, RP2 and ESP32. In each case ESP32 RAM use was larger than on Pyboard and RP2. This could be fixed with two non-breaking changes.

  1. RMT.write_pulses(pulses, start) Allow pulses to be any object supporting the buffer protocol. This would allow half-word arrays or bytearrays, saving RAM. This behaviour would be similar to that of other MicroPython interface classes.
  2. Provide a mechanism for looping N times. 433MHz remotes typically send the same set of pulses N times in quick succession, where N is 5-10. Currently I do this (on ESP32 only) by copying. Ugly and wasteful.

I can see two alternatives for doing N times looping.

  1. Add a count=None arg to .write_pulses() or even .loop().
  2. More flexibly, provide a callback to .write_pulses(). The callback would take a single arg being the RMT instance, and would run on completion of the output. This would enable the user to implement a count (typically by passing a method as the callback). This would be my preferred solution because of its flexibility. Complex modulation schemes could be implemented efficiently in a nonblocking fashion.
    My first thought was a callback=None arg to .write_pulses() but this poses a recursion issue. A new .done_callback(cb=None) method would be better, with the default removing any current callback.
CANDIDATE · ISSUE

RMT read pulses?

openby MarkHmnvopened 2024-07-22updated 2025-12-09
enhancementport-esp32

Description

The esp32.RMT has a method for sending pulses, but no method for reading them. I would like to know if there are plans to implement this functionality in the future?

Code Size

No response

Implementation

I hope the MicroPython maintainers or community will implement this feature

Code of Conduct

Yes, I agree

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied