summaryrefslogtreecommitdiff
path: root/docs/library/machine.Timer.rst
diff options
context:
space:
mode:
authordanicampora <daniel@wipy.io>2016-02-21 20:38:56 +0100
committerdanicampora <daniel@wipy.io>2016-02-21 21:53:20 +0100
commit0d210a0be827d956b7a4af7b591c3d268a569a7d (patch)
tree97ada045fecfc96e229e39162496536a734f228e /docs/library/machine.Timer.rst
parentfe9620a2bdf2d60acfb1e883d18dc0c9bf47d7f1 (diff)
docs: Correct WiPy Timer docs.
Diffstat (limited to 'docs/library/machine.Timer.rst')
-rw-r--r--docs/library/machine.Timer.rst6
1 files changed, 3 insertions, 3 deletions
diff --git a/docs/library/machine.Timer.rst b/docs/library/machine.Timer.rst
index 751f6536a..868470f67 100644
--- a/docs/library/machine.Timer.rst
+++ b/docs/library/machine.Timer.rst
@@ -20,7 +20,7 @@ class Timer -- control internal timers
tim = Timer(3) # create a timer object using timer 3
tim.init(mode=Timer.PERIODIC) # initialize it in periodic mode
tim_ch = tim.channel(Timer.A, freq=5) # configure channel A at a frequency of 5Hz
- tim_ch.irq(handler=lambda t:led.toggle()) # toggle a LED on every cycle of the timer
+ tim_ch.irq(handler=lambda t:led.toggle(), trigger=Timer.TIMEOUT) # toggle a LED on every cycle of the timer
Example using named function for the callback::
@@ -32,10 +32,10 @@ class Timer -- control internal timers
led = Pin('GP16', mode=Pin.OUT) # enable GP16 as output to drive the LED
def tick(timer): # we will receive the timer object when being called
- print(timer.time()) # show current timer's time value (is microseconds)
+ global led
led.toggle() # toggle the LED
- tim_a.irq(handler=tick) # create the interrupt
+ tim_a.irq(handler=tick, trigger=Timer.TIMEOUT) # create the interrupt
Further examples::