Skip to content

Commit fe7d479

Browse files
nevercastdpgeorge
authored andcommitted
docs/esp32: Fix machine.Timer quickref to specify HW timers.
Also remove trailing spaces on other lines.
1 parent 47289f4 commit fe7d479

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

docs/esp32/quickref.rst

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -118,17 +118,21 @@ Use the :mod:`time <utime>` module::
118118
Timers
119119
------
120120

121-
Virtual (RTOS-based) timers are supported. Use the :ref:`machine.Timer <machine.Timer>` class
122-
with timer ID of -1::
121+
The ESP32 port has four hardware timers. Use the :ref:`machine.Timer <machine.Timer>` class
122+
with a timer ID from 0 to 3 (inclusive)::
123123

124124
from machine import Timer
125125

126-
tim = Timer(-1)
127-
tim.init(period=5000, mode=Timer.ONE_SHOT, callback=lambda t:print(1))
128-
tim.init(period=2000, mode=Timer.PERIODIC, callback=lambda t:print(2))
126+
tim0 = Timer(0)
127+
tim0.init(period=5000, mode=Timer.ONE_SHOT, callback=lambda t:print(0))
128+
129+
tim1 = Timer(1)
130+
tim1.init(period=2000, mode=Timer.PERIODIC, callback=lambda t:print(1))
129131

130132
The period is in milliseconds.
131133

134+
Virtual timers are not currently supported on this port.
135+
132136
.. _Pins_and_GPIO:
133137

134138
Pins and GPIO
@@ -172,7 +176,7 @@ PWM (pulse width modulation)
172176

173177
PWM can be enabled on all output-enabled pins. The base frequency can
174178
range from 1Hz to 40MHz but there is a tradeoff; as the base frequency
175-
*increases* the duty resolution *decreases*. See
179+
*increases* the duty resolution *decreases*. See
176180
`LED Control <https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/peripherals/ledc.html>`_
177181
for more details.
178182
Currently the duty cycle has to be in the range of 0-1023.
@@ -273,7 +277,7 @@ class::
273277

274278
.. Warning::
275279
Currently *all* of ``sck``, ``mosi`` and ``miso`` *must* be specified when
276-
initialising Software SPI.
280+
initialising Software SPI.
277281

278282
Hardware SPI bus
279283
----------------
@@ -445,11 +449,11 @@ Use the ``TouchPad`` class in the ``machine`` module::
445449
from machine import TouchPad, Pin
446450

447451
t = TouchPad(Pin(14))
448-
t.read() # Returns a smaller number when touched
452+
t.read() # Returns a smaller number when touched
449453

450454
``TouchPad.read`` returns a value relative to the capacitive variation. Small numbers (typically in
451-
the *tens*) are common when a pin is touched, larger numbers (above *one thousand*) when
452-
no touch is present. However the values are *relative* and can vary depending on the board
455+
the *tens*) are common when a pin is touched, larger numbers (above *one thousand*) when
456+
no touch is present. However the values are *relative* and can vary depending on the board
453457
and surrounding composition so some calibration may be required.
454458

455459
There are ten capacitive touch-enabled pins that can be used on the ESP32: 0, 2, 4, 12, 13

0 commit comments

Comments
 (0)