Skip to content

Commit 8eb9e4c

Browse files
committed
Typehints: machine.Timer init()
1 parent ff0615e commit 8eb9e4c

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

typehints/micropython/machine.pyi

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,20 @@ class Timer(object):
676676
:param id: Timer ID.
677677
"""
678678

679+
def init(self, mode: int = PERIODIC, period: int = -1, callback: Callable = None) -> None:
680+
"""
681+
Initialise the timer.
682+
683+
Possible values for ``mode``:
684+
685+
* ``Timer.ONE_SHOT`` - The timer runs once until the configured period of the channel expires.
686+
* ``Timer.PERIODIC`` - The timer runs periodically at the configured frequency of the channel.
687+
688+
:param mode: Timer operating mode.
689+
:param period: The period in milliseconds.
690+
:param callback: Function to be called when the callback is triggered.
691+
"""
692+
679693
def deinit(self) -> None:
680694
"""
681695
Deinitialises the timer. Stops the timer, and disables the timer peripheral.
@@ -790,4 +804,4 @@ def time_pulse_us(pin: Pin, pulse_level: int, timeout_us: int = 1000000) -> int:
790804
:param timeout_us: Duration of wait for pin change conditions, in microsecond.
791805
:return: Result code (-1 or -2)
792806
"""
793-
...
807+
...

0 commit comments

Comments
 (0)