8000 docs/library/machine: Add note on interrupts being critical to system. · micropython/micropython@3d58bb2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3d58bb2

Browse files
ThinkTransitdpgeorge
authored andcommitted
docs/library/machine: Add note on interrupts being critical to system.
1 parent f12754a commit 3d58bb2

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

docs/library/machine.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,23 @@ Reset related functions
4848
Interrupt related functions
4949
---------------------------
5050

51+
The following functions allow control over interrupts. Some systems require
52+
interrupts to operate correctly so disabling them for long periods may
53+
compromise core functionality, for example watchdog timers may trigger
54+
unexpectedly. Interrupts should only be disabled for a minimum amount of time
55+
and then re-enabled to their previous state. For example::
56+
57+
import machine
58+
59+
# Disable interrupts
60+
state = machine.disable_irq()
61+
62+
# Do a small amount of time-critical work here
63+
64+
# Enable interrupts
65+
machine.enable_irq(state)
66+
67+
5168
.. function:: disable_irq()
5269

5370
Disable interrupt requests.

0 commit comments

Comments
 (0)
0