@@ -52,6 +52,7 @@ class Timer:
5252 mode : int = PERIODIC ,
5353 period : int | None = None ,
5454 callback : Callable [[Timer ], None ] | None = None ,
55+ hard : bool | None = None ,
5556 ):
5657 """
5758 Construct a new timer object of the given ``id``. ``id`` of -1 constructs a
@@ -70,6 +71,7 @@ class Timer:
7071 mode : int = PERIODIC ,
7172 freq : int | None = None ,
7273 callback : Callable [[Timer ], None ] | None = None ,
74+ hard : bool | None = None ,
7375 ):
7476 """
7577 Construct a new timer object of the given ``id``. ``id`` of -1 constructs a
@@ -88,6 +90,7 @@ class Timer:
8890 mode : int = PERIODIC ,
8991 tick_hz : int | None = None ,
9092 callback : Callable [[Timer ], None ] | None = None ,
93+ hard : bool | None = None ,
9194 ):
9295 """
9396 Construct a new timer object of the given ``id``. ``id`` of -1 constructs a
@@ -104,6 +107,7 @@ class Timer:
104107 mode : int = PERIODIC ,
105108 period : int | None = None ,
106109 callback : Callable [[Timer ], None ] | None = None ,
110+ hard : bool | None = None ,
107111 ) -> None : ...
108112 @overload
109113 def init (
@@ -112,6 +116,7 @@ class Timer:
112116 mode : int = PERIODIC ,
113117 freq : int | None = None ,
114118 callback : Callable [[Timer ], None ] | None = None ,
119+ hard : bool | None = None ,
115120 ) -> None : ...
116121 @overload
117122 def init (
@@ -120,6 +125,7 @@ class Timer:
120125 mode : int = PERIODIC ,
121126 tick_hz : int | None = None ,
122127 callback : Callable [[Timer ], None ] | None = None ,
128+ hard : bool | None = None ,
123129 ) -> None :
124130 """
125131 Initialise the timer. Example::
@@ -157,6 +163,19 @@ class Timer:
157163 The ``callback`` argument shall be specified. Otherwise an exception
158164 will occur upon timer expiration:
159165 ``TypeError: 'NoneType' object isn't callable``
166+
167+ - ``hard`` can be one of:
168+
169+ - ``True`` - The callback will be executed in hard interrupt
170+ context, which minimises delay and jitter but is subject to the
171+ limitations described in :ref:`isr_rules` including being unable
172+ to allocate on the heap.
173+ - ``False`` - The callback will be scheduled as a soft interrupt,
174+ allowing it to allocate but possibly also introducing
175+ garbage-collection delays and jitter.
176+
177+ The default value of this option is port-specific for historical
178+ reasons.
160179 """
161180 ...
162181
0 commit comments