← index #7015Issue #16589
Related · high · value 0.442
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 receive

closedby Zibriopened 2025-01-15updated 2025-12-11
enhancement

Description

I just found out that microphthon can send RMT but not receive. That's a shame which forces me to use nodemcu while I prefer microphthon by a long shot. RMT receive is very important and without it, receiving pulses is way more inaccurate.
In my project I need to determine the pulse length accurately. Please implement RMT receive!

Code Size

Should not be so big. But honestly I don't know.

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