summaryrefslogtreecommitdiff
path: root/docs/library
diff options
context:
space:
mode:
Diffstat (limited to 'docs/library')
-rw-r--r--docs/library/esp32.rst17
1 files changed, 14 insertions, 3 deletions
diff --git a/docs/library/esp32.rst b/docs/library/esp32.rst
index 33b779a21..715afddde 100644
--- a/docs/library/esp32.rst
+++ b/docs/library/esp32.rst
@@ -151,6 +151,11 @@ used to transmit or receive many other types of digital signals::
r = esp32.RMT(0, pin=Pin(18), clock_div=8)
r # RMT(channel=0, pin=18, source_freq=80000000, clock_div=8)
+
+ # To use carrier frequency
+ r = esp32.RMT(0, pin=Pin(18), clock_div=8, carrier_freq=38000)
+ r # RMT(channel=0, pin=18, source_freq=80000000, clock_div=8, carrier_freq=38000, carrier_duty_percent=50)
+
# The channel resolution is 100ns (1/(source_freq/clock_div)).
r.write_pulses((1, 20, 2, 40), start=0) # Send 0 for 100ns, 1 for 2000ns, 0 for 200ns, 1 for 4000ns
@@ -164,6 +169,9 @@ define the pulses.
multiplying the resolution by a 15-bit (0-32,768) number. There are eight
channels (0-7) and each can have a different clock divider.
+To enable the carrier frequency feature of the esp32 hardware, specify the
+``carrier_freq`` as something like 38000, a typical IR carrier frequency.
+
So, in the example above, the 80MHz clock is divided by 8. Thus the
resolution is (1/(80Mhz/8)) 100ns. Since the ``start`` level is 0 and toggles
with each number, the bitstream is ``0101`` with durations of [100ns, 2000ns,
@@ -174,17 +182,20 @@ For more details see Espressif's `ESP-IDF RMT documentation.
.. Warning::
The current MicroPython RMT implementation lacks some features, most notably
- receiving pulses and carrier transmit. RMT should be considered a
+ receiving pulses. RMT should be considered a
*beta feature* and the interface may change in the future.
-.. class:: RMT(channel, \*, pin=None, clock_div=8)
+.. class:: RMT(channel, \*, pin=None, clock_div=8, carrier_freq=0, carrier_duty_percent=50)
This class provides access to one of the eight RMT channels. *channel* is
required and identifies which RMT channel (0-7) will be configured. *pin*,
also required, configures which Pin is bound to the RMT channel. *clock_div*
is an 8-bit clock divider that divides the source clock (80MHz) to the RMT
- channel allowing the resolution to be specified.
+ channel allowing the resolution to be specified. *carrier_freq* is used to
+ enable the carrier feature and specify its frequency, default value is ``0``
+ (not enabled). To enable, specify a positive integer. *carrier_duty_percent*
+ defaults to 50.
.. method:: RMT.source_freq()