mirror of
https://github.com/micropython/micropython.git
synced 2025-12-16 09:50:15 +01:00
mimxrt/machine_timer: Use soft-timer implementation for machine.Timer.
This releases the hardware timers for other tasks, which need a higher resolution and faster response. And it is less port-specific code.
This commit is contained in:
@@ -56,21 +56,18 @@ Use the :mod:`time <time>` module::
|
||||
Timers
|
||||
------
|
||||
|
||||
The i.MXRT port has three hardware timers. Use the :ref:`machine.Timer <machine.Timer>` class
|
||||
with a timer ID from 0 to 2 (inclusive)::
|
||||
The i.MXRT port supports virtual Timers. Example of usage::
|
||||
|
||||
from machine import Timer
|
||||
|
||||
tim0 = Timer(0)
|
||||
tim0 = Timer(-1)
|
||||
tim0.init(period=5000, mode=Timer.ONE_SHOT, callback=lambda t:print(0))
|
||||
|
||||
tim1 = Timer(1)
|
||||
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.
|
||||
|
||||
.. _mimxrt_Pins_and_GPIO:
|
||||
|
||||
Pins and GPIO
|
||||
|
||||
Reference in New Issue
Block a user