File tree 1 file changed +21
-0
lines changed
1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change 1
1
Reference
2
2
=========
3
3
4
+ Interrupts
5
+ ----------
6
+
7
+ Interrupts can be used on the ESP8266, but they must be used with care
8
+ and have several limitations:
9
+
10
+ * Interrupt callback functions must be in IRAM, because the flash may be
11
+ in the middle of other operations when they occur. Do this by adding
12
+ the ``ICACHE_RAM_ATTR `` attribute on the function definition.
13
+
14
+ * Interrupts should not perform delay() or any long-running (>1ms) task.
15
+ WiFi and other portiong of the code can become unstable if interrupts
16
+ are blocked by a long-running interrupt. If you have much to do, you can
17
+ set a volatile global flag that your main ``loop() `` can check each pass
18
+ or use a scheduled function (which will be called by the OS when it is
19
+ safe, and not at IRQ level) to do the work.
20
+
21
+ * Memory operations can be dangerous and avoided in interrupts. Calls to
22
+ ``new `` or ``malloc `` should be minimized, and calls to ``realloc `` and
23
+ ``free `` must NEVER be used.
24
+
4
25
Digital IO
5
26
----------
6
27
You can’t perform that action at this time.
0 commit comments