mirror of
https://github.com/micropython/micropython.git
synced 2025-07-21 04:51:12 +02:00
docs/rp2: Document the new rp2 Timer hard= option.
Signed-off-by: Chris Webb <chris@arachsys.com>
This commit is contained in:
@@ -135,6 +135,12 @@ Use the :mod:`machine.Timer` class::
|
||||
tim = Timer(period=5000, mode=Timer.ONE_SHOT, callback=lambda t:print(1))
|
||||
tim.init(period=2000, mode=Timer.PERIODIC, callback=lambda t:print(2))
|
||||
|
||||
By default, timer callbacks run as soft IRQs so they can allocate but
|
||||
are prone to GC jitter and delays. Pass ``hard=True`` to the ``Timer()``
|
||||
constructor or ``init()`` method to run the callback in hard-IRQ context
|
||||
instead. This reduces delay and jitter, but see :ref:`isr_rules` for the
|
||||
restrictions that apply to hard-IRQ handlers.
|
||||
|
||||
|
||||
.. _rp2_Pins_and_GPIO:
|
||||
|
||||
|
Reference in New Issue
Block a user