upyt.utils package¶
Submodules¶
upyt.utils.interrupts module¶
-
upyt.utils.interrupts.
external_interrupt
(pin_id, pull, transition)¶ Triggers the decorated function from an external interrupt.
Example:
keepalive = True @external_interrupt('SW', machine.Pin.PULL_UP, pyb.ExtInt.IRQ_FALLING) def do_stuff(interrupt): global keepalive keepalive = False while keepalive: do_stuff() time.sleep(0.01)
upyt.utils.leds module¶
-
upyt.utils.leds.
led_on
(*args, **kwargs)¶ Keeps a LED on while in context.
For example, the following code will turn the red LED on for 100ms:
>>> from time import sleep >>> from utils import led_on >>> with led_on(1): ... sleep(0.1)
Module contents¶
-
upyt.utils.
external_interrupt
(pin_id, pull, transition)¶ Triggers the decorated function from an external interrupt.
Example:
keepalive = True @external_interrupt('SW', machine.Pin.PULL_UP, pyb.ExtInt.IRQ_FALLING) def do_stuff(interrupt): global keepalive keepalive = False while keepalive: do_stuff() time.sleep(0.01)
-
upyt.utils.
led_on
(*args, **kwargs)¶ Keeps a LED on while in context.
For example, the following code will turn the red LED on for 100ms:
>>> from time import sleep >>> from utils import led_on >>> with led_on(1): ... sleep(0.1)