@@ -118,17 +118,21 @@ Use the :mod:`time <utime>` module::
118
118
Timers
119
119
------
120
120
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) ::
123
123
124
124
from machine import Timer
125
125
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))
129
131
130
132
The period is in milliseconds.
131
133
134
+ Virtual timers are not currently supported on this port.
135
+
132
136
.. _Pins_and_GPIO :
133
137
134
138
Pins and GPIO
@@ -172,7 +176,7 @@ PWM (pulse width modulation)
172
176
173
177
PWM can be enabled on all output-enabled pins. The base frequency can
174
178
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
176
180
`LED Control <https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/peripherals/ledc.html >`_
177
181
for more details.
178
182
Currently the duty cycle has to be in the range of 0-1023.
@@ -273,7 +277,7 @@ class::
273
277
274
278
.. Warning ::
275
279
Currently *all * of ``sck ``, ``mosi `` and ``miso `` *must * be specified when
276
- initialising Software SPI.
280
+ initialising Software SPI.
277
281
278
282
Hardware SPI bus
279
283
----------------
@@ -445,11 +449,11 @@ Use the ``TouchPad`` class in the ``machine`` module::
445
449
from machine import TouchPad, Pin
446
450
447
451
t = TouchPad(Pin(14))
448
- t.read() # Returns a smaller number when touched
452
+ t.read() # Returns a smaller number when touched
449
453
450
454
``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
453
457
and surrounding composition so some calibration may be required.
454
458
455
459
There are ten capacitive touch-enabled pins that can be used on the ESP32: 0, 2, 4, 12, 13
0 commit comments