diff options
author | Chris Webb <chris@arachsys.com> | 2025-08-25 15:29:40 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2025-09-25 23:59:24 +1000 |
commit | b9523fd58c02dba74239015bf6b2a1983342a06b (patch) | |
tree | f49d94d0e4e0a654da41da169e8a4a734d71c896 /docs/library/pyb.Timer.rst | |
parent | ec6cdf3718ce49026940c5e2f65fb07f3fc23309 (diff) |
docs: Document the cross-port Timer hard= option.
Update the main machine.Timer specification, and any references to
hard/soft interrupts in port-specific documentation. There is a separate
copy of the machine.Timer documentation for the pyboard, so update that
too to keep everything consistent.
Signed-off-by: Chris Webb <chris@arachsys.com>
Diffstat (limited to 'docs/library/pyb.Timer.rst')
-rw-r--r-- | docs/library/pyb.Timer.rst | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/docs/library/pyb.Timer.rst b/docs/library/pyb.Timer.rst index c644e38d7..0e9e49c0e 100644 --- a/docs/library/pyb.Timer.rst +++ b/docs/library/pyb.Timer.rst @@ -62,7 +62,7 @@ Constructors Methods ------- -.. method:: Timer.init(*, freq, prescaler, period, mode=Timer.UP, div=1, callback=None, deadtime=0, brk=Timer.BRK_OFF) +.. method:: Timer.init(*, freq, prescaler, period, mode=Timer.UP, div=1, callback=None, deadtime=0, brk=Timer.BRK_OFF, hard=True) Initialise the timer. Initialisation must be either by frequency (in Hz) or by prescaler and period:: @@ -115,6 +115,18 @@ Methods ``mode=Pin.ALT, alt=Pin.AFn_TIMx``. The pin's GPIO input features are available in alt mode - ``pull=`` , ``value()`` and ``irq()``. + - ``hard`` can be one of: + + - ``True`` - The callback will be executed in hard interrupt + context, which minimises delay and jitter but is subject to the + limitations described in :ref:`isr_rules` including being unable + to allocate on the heap. + - ``False`` - The callback will be scheduled as a soft interrupt, + allowing it to allocate but possibly also introducing + garbage-collection delays and jitter. + + The default value of this option is True. + You must either specify freq or both of period and prescaler. .. method:: Timer.deinit() |