aboutsummaryrefslogtreecommitdiffstats
path: root/docs/source/lang/api
diff options
context:
space:
mode:
Diffstat (limited to 'docs/source/lang/api')
-rw-r--r--docs/source/lang/api/attachinterrupt.rst31
-rw-r--r--docs/source/lang/api/constants.rst14
-rw-r--r--docs/source/lang/api/detachinterrupt.rst16
-rw-r--r--docs/source/lang/api/hardwaretimer.rst2
-rw-r--r--docs/source/lang/api/millis.rst2
-rw-r--r--docs/source/lang/api/pwmwrite.rst13
-rw-r--r--docs/source/lang/api/random.rst8
7 files changed, 58 insertions, 28 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
diff --git a/docs/source/lang/api/constants.rst b/docs/source/lang/api/constants.rst
index 4426293..72738b8 100644
--- a/docs/source/lang/api/constants.rst
+++ b/docs/source/lang/api/constants.rst
@@ -242,10 +242,18 @@ type, follow it with:
For example, ``33U`` is an :ref:`unsigned int <lang-unsignedint>`.
- an ``l`` or ``L`` to interpret the constant as a long value. For
- example, ``100000L`` is a :ref:`long <lang-long>`.
+ example, ``100000L`` is a :ref:`long <lang-long>`. On the Maple,
+ ``long`` is just a synonym for ``int``.
- a ``ul`` or ``UL`` to do both. For example, ``32767UL`` is an
- :ref:`unsigned long <lang-unsignedlong>`.
+ :ref:`unsigned long <lang-unsignedlong>`. On the Maple, ``unsigned
+ long`` is just a synonym for ``unsigned int``.
+
+- an ``ll`` or ``LL`` to interpret the constant as a :ref:`long long
+ <lang-longlong>` value.
+
+- a ``ull`` or ``ULL`` to interpret the constant as an :ref:`unsigned
+ long long <lang-unsignedlonglong>`.
.. _lang-constants-fp:
@@ -321,6 +329,8 @@ See Also
- :ref:`unsigned int <lang-unsignedint>`
- :ref:`long <lang-long>`
- :ref:`unsigned long <lang-unsignedlong>`
+- :ref:`long long <lang-longlong>`
+- :ref:`unsigned long long <lang-unsignedlonglong>`
- :ref:`float <lang-float>`
- :ref:`double <lang-double>`
diff --git a/docs/source/lang/api/detachinterrupt.rst b/docs/source/lang/api/detachinterrupt.rst
index adb2439..41642a7 100644
--- a/docs/source/lang/api/detachinterrupt.rst
+++ b/docs/source/lang/api/detachinterrupt.rst
@@ -6,11 +6,20 @@ detachInterrupt()
Used to disable an interrupt specified with
:ref:`lang-attachinterrupt`\ .
-
Library Documentation
---------------------
-.. doxygenfunction:: detachInterrupt
+.. FIXME once breathe knows how to get the correct detachInterupt
+.. (right now it's copying from HardwareTimer), replace with a
+.. doxygenfunction directive
+
+.. cpp:function:: void detachInterrupt(uint8 pin)
+
+ Disable any registered external interrupt on the given pin.
+
+ *Parameters*
+
+ - ``pin`` Maple pin number
Arduino Compatibility
---------------------
@@ -31,7 +40,4 @@ See Also
- :ref:`attachInterrupt() <lang-attachInterrupt>`
-
-
-
.. include:: cc-attribution.txt
diff --git a/docs/source/lang/api/hardwaretimer.rst b/docs/source/lang/api/hardwaretimer.rst
index 258471b..3e5424c 100644
--- a/docs/source/lang/api/hardwaretimer.rst
+++ b/docs/source/lang/api/hardwaretimer.rst
@@ -317,6 +317,8 @@ For example, to set the prescale factor on timer 1 to 5, call
The :ref:`setPeriod() <lang-hardwaretimer-setperiod>` method may
also be used as a convenient alternative.
+.. _lang-hardwaretimer-resume:
+
.. cpp:function:: void HardwareTimer::resume()
Resume a paused timer, without affecting its configuration.
diff --git a/docs/source/lang/api/millis.rst b/docs/source/lang/api/millis.rst
index 54e4507..0288c56 100644
--- a/docs/source/lang/api/millis.rst
+++ b/docs/source/lang/api/millis.rst
@@ -40,7 +40,7 @@ Tip
Since the return value for ``millis()`` is an :ref:`unsigned long
<lang-unsignedlong>`, overflow errors may occur if you try to do math
-with other data types, such as :ref:`ints <lang-int>`.
+with other data types, such as :ref:`chars <lang-char>`.
See Also
--------
diff --git a/docs/source/lang/api/pwmwrite.rst b/docs/source/lang/api/pwmwrite.rst
index 2c858ab..9d50077 100644
--- a/docs/source/lang/api/pwmwrite.rst
+++ b/docs/source/lang/api/pwmwrite.rst
@@ -33,21 +33,20 @@ Sets the output to the LED proportional to the value read from the
potentiometer::
int analogPin = 3; // potentiometer connected to analog pin 3
- int val = 0; // variable to store the read value
void setup() {
pinMode(BOARD_LED_PIN, OUTPUT); // sets the LED pin as output
- pinMode(analogPin, PWM); // sets the potentiometer pin as PWM
- // output
+ pinMode(analogPin, INPUT_ANALOG); // sets the potentiometer pin as
+ // analog input
}
void loop() {
- val = analogRead(analogPin); // read the input pin
+ int val = analogRead(analogPin); // read the input pin
- analogWrite(BOARD_LED_PIN, val / 16); // analogRead values go from 0
- // to 4095, analogWrite values
- // from 0 to 65535
+ pwmWrite(BOARD_LED_PIN, val * 16); // analogRead values go from 0
+ // to 4095, pwmWrite values
+ // from 0 to 65535, so scale roughly
}
See Also
diff --git a/docs/source/lang/api/random.rst b/docs/source/lang/api/random.rst
index f2a9762..dd8871d 100644
--- a/docs/source/lang/api/random.rst
+++ b/docs/source/lang/api/random.rst
@@ -7,13 +7,13 @@ random()
The ``random()`` function generates pseudo-random numbers.
-.. TODO keep tracking Sphinx/Breathe's ability to reference overloaded
-.. functions so we can use doxygenfunction instead of manually
-.. documenting this.
-
Library Documentation
---------------------
+.. FIXME keep tracking Sphinx/Breathe's ability to reference
+.. overloaded functions so we can use doxygenfunction instead of
+.. manually documenting.
+
.. cpp:function:: random(long max)
Same as a call to ``random(0, max)``.