aboutsummaryrefslogtreecommitdiffstats
path: root/docs/source/lang/api/attachinterrupt.rst
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2011-02-08 22:19:40 -0500
committerMarti Bolivar <mbolivar@leaflabs.com>2011-02-08 22:19:40 -0500
commit90adb6bff63e3ecad81d300651a40d8835efc608 (patch)
tree17a4641d6da3face5cb31e4027f51ca00e646ddb /docs/source/lang/api/attachinterrupt.rst
parent8ffa051f2df2b380930ca10ce030134b57b976d3 (diff)
downloadlibrambutan-90adb6bff63e3ecad81d300651a40d8835efc608.tar.gz
librambutan-90adb6bff63e3ecad81d300651a40d8835efc608.zip
Documentation bugfixes
Diffstat (limited to 'docs/source/lang/api/attachinterrupt.rst')
-rw-r--r--docs/source/lang/api/attachinterrupt.rst31
1 files changed, 22 insertions, 9 deletions
diff --git a/docs/source/lang/api/attachinterrupt.rst b/docs/source/lang/api/attachinterrupt.rst
index 0b8907f..7c5a6c7 100644
--- a/docs/source/lang/api/attachinterrupt.rst
+++ b/docs/source/lang/api/attachinterrupt.rst
@@ -15,7 +15,28 @@ occurs.
Library Documentation
---------------------
-.. doxygenfunction:: attachInterrupt
+.. FIXME once breathe knows how to get the correct attachInterupt
+.. (right now it's copying from HardwareTimer), replace with a
+.. doxygenfunction directive
+
+.. cpp:function:: void attachInterrupt(uint8 pin, voidFuncPtr handler, ExtIntTriggerMode mode)
+
+ Registers an interrupt handler on a pin.
+
+ The interrupt will be triggered on a given transition on the pin,
+ as specified by the mode parameter. The handler runs in interrupt
+ context. The new handler will replace whatever handler is
+ currently registered for the pin, if any.
+
+ *Parameters*
+
+ - ``pin`` - Maple pin number
+
+ - ``handler`` - Function to run upon external interrupt trigger.
+ The handler should take no arguments, and have void return type.
+
+ - ``mode`` - Type of transition to trigger on, e.g. falling,
+ rising, etc.
.. doxygenenum:: ExtIntTriggerMode
@@ -34,7 +55,6 @@ There are a few constraints you should be aware of if you're using
more than one interrupt at a time; the :ref:`external-interrupts` page
has the details.
-
Using Interrupts
----------------
@@ -43,7 +63,6 @@ microcontroller programs, and can help solve timing problems. A
good task for using an interrupt might be reading a rotary encoder,
or monitoring user input.
-
If you wanted to insure that a program always caught the pulses
from a rotary encoder, never missing a pulse, it would make it very
tricky to write a program to do anything else, because the program
@@ -55,7 +74,6 @@ sensor that is trying to catch a click, or an infrared slot sensor
situations, using an interrupt can free the microcontroller to get
some other work done while not missing the doorbell.
-
Example
-------
@@ -78,7 +96,6 @@ Example
state = !state;
}
-
Arduino Compatibility
---------------------
@@ -89,14 +106,10 @@ additional four: numbers 2 (pin 21), 3 (pin 20), 4 (pin 19), and 5
number goes with which pin -- just tell ``attachInterrupt()`` the pin
you want.
-
See also
--------
-
- :ref:`detachInterrupt <lang-detachinterrupt>`
- :ref:`external-interrupts`
-
-
.. include:: cc-attribution.txt