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

Also remove trailing spaces on other lines.
pull/6273/head
Josh Lloyd 2020-07-20 11:06:12 +12:00 zatwierdzone przez Damien George
rodzic 47289f4bc9
commit fe7d47971f
1 zmienionych plików z 14 dodań i 10 usunięć

Wyświetl plik

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