-
Notifications
You must be signed in to change notification settings - Fork 1.3k
ESP32-S2: Add PulseOut and PulseIn #3279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this! Just a few corner cases to think about.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing to make the builds pass and then should be good. Thanks!
@tannewt I think this should be good to go. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Looks great.
This PR adds the PulseOut and PulseIn IR transmission and reception modules to the ESP32-S2 port. Unlike other ports, which transmit pulse trains using timers and PWMOut carrier objects, the ESP32-S2 has a dedicated pulse train peripheral, the "RMT", which is capable of both sending and receiving pulses with and without carrier modulation.
Because of this, PulseOut does not require a PWMOut object, which uses an entirely different peripheral, the LEDC PWM controller. Thus, the API for PulseOut has been expanded to allow the ESP32 to receive a pin object, frequency and duty cycle in place of a PWMOut object. Other ports have been correspondingly internally updated for the change, but should see no difference in their python calls for the time being.
PulseIn has a couple of quirks that should be noted when reviewing.
The RMT is shared by the Neopixel Write system. A mediator system in Peripherals reserves RMT channels individually. Up to 4 channels are available on any pin, so you can have a combination of 4 total PulseOut, PulseIn, and Neopixel lines active at any given time.
Tested on the ESP32-S2 Saola1 Wrover. Resolves #3264