docs/rp2: Document the new rp2 Timer hard= option.

Signed-off-by: Chris Webb <chris@arachsys.com>
This commit is contained in:
Chris Webb
2025-06-16 12:35:51 +01:00
parent 8f85edad86
commit 816246836e

View File

@@ -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: