docs/esp32: Fix machine.Timer quickref to specify HW timers.

Also remove trailing spaces on other lines.
This commit is contained in:
Josh Lloyd 2020-07-20 11:06:12 +12:00 committed by Damien George
parent 47289f4bc9
commit fe7d47971f

View File

@ -118,17 +118,21 @@ Use the :mod:`time <utime>` module::
Timers Timers
------ ------
Virtual (RTOS-based) timers are supported. Use the :ref:`machine.Timer <machine.Timer>` class The ESP32 port has four hardware timers. Use the :ref:`machine.Timer <machine.Timer>` class
with timer ID of -1:: with a timer ID from 0 to 3 (inclusive)::
from machine import Timer from machine import Timer
tim = Timer(-1) tim0 = Timer(0)
tim.init(period=5000, mode=Timer.ONE_SHOT, callback=lambda t:print(1)) tim0.init(period=5000, mode=Timer.ONE_SHOT, callback=lambda t:print(0))
tim.init(period=2000, mode=Timer.PERIODIC, callback=lambda t:print(2))
tim1 = Timer(1)
tim1.init(period=2000, mode=Timer.PERIODIC, callback=lambda t:print(1))
The period is in milliseconds. The period is in milliseconds.
Virtual timers are not currently supported on this port.
.. _Pins_and_GPIO: .. _Pins_and_GPIO:
Pins and GPIO Pins and GPIO