summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPatrick Joy <74940387+ThinkTransit@users.noreply.github.com>2022-04-13 21:32:13 +1000
committerDamien George <damien@micropython.org>2022-06-21 17:25:11 +1000
commit3d58bb23c28394fedd26151ab69cc4ba793043f1 (patch)
tree72fa16326e30c7d0eab5cf506d79faed3d7a500e
parentf12754af06c83f06f2651f50109b84a9b700e12a (diff)
downloadmicropython-3d58bb23c28394fedd26151ab69cc4ba793043f1.tar.gz
micropython-3d58bb23c28394fedd26151ab69cc4ba793043f1.zip
docs/library/machine: Add note on interrupts being critical to system.
-rw-r--r--docs/library/machine.rst17
1 files changed, 17 insertions, 0 deletions
diff --git a/docs/library/machine.rst b/docs/library/machine.rst
index d66423d0d4..c3bf438961 100644
--- a/docs/library/machine.rst
+++ b/docs/library/machine.rst
@@ -48,6 +48,23 @@ Reset related functions
Interrupt related functions
---------------------------
+The following functions allow control over interrupts. Some systems require
+interrupts to operate correctly so disabling them for long periods may
+compromise core functionality, for example watchdog timers may trigger
+unexpectedly. Interrupts should only be disabled for a minimum amount of time
+and then re-enabled to their previous state. For example::
+
+ import machine
+
+ # Disable interrupts
+ state = machine.disable_irq()
+
+ # Do a small amount of time-critical work here
+
+ # Enable interrupts
+ machine.enable_irq(state)
+
+
.. function:: disable_irq()
Disable interrupt requests.