aboutsummaryrefslogtreecommitdiffstats
path: root/docs/source/libraries.rst
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@mit.edu>2010-12-15 01:50:56 -0500
committerMarti Bolivar <mbolivar@mit.edu>2010-12-15 16:16:31 -0500
commitd744fb826f4a6d6ce560f3b78f2e63a1f9666d9e (patch)
tree35d0939c959cec372e1a6ce2f4bdf95dbe977918 /docs/source/libraries.rst
parent74c8937446e1be4e0d21f69a8c098e2caf7814d5 (diff)
downloadlibrambutan-d744fb826f4a6d6ce560f3b78f2e63a1f9666d9e.tar.gz
librambutan-d744fb826f4a6d6ce560f3b78f2e63a1f9666d9e.zip
Finalized 0.0.9 documentation.
Diffstat (limited to 'docs/source/libraries.rst')
-rw-r--r--docs/source/libraries.rst67
1 files changed, 66 insertions, 1 deletions
diff --git a/docs/source/libraries.rst b/docs/source/libraries.rst
index 567aec8..7623963 100644
--- a/docs/source/libraries.rst
+++ b/docs/source/libraries.rst
@@ -21,13 +21,69 @@ in the description of the library.
.. contents:: Contents
:local:
+.. toctree::
+ :hidden:
+
+ libs/servo.rst
+
+.. _libraries-servo:
+
+Servo
+-----
+
+The Servo library is provided for convenient control of RC
+servomotors. For more information, see the :ref:`Servo <libs-servo>`
+reference.
+
+**Compatibility Note**
+
+The Servo class provides a public interface identical to the Arduino
+version's documented functionality (as of Arduino 0021), so in most
+cases, this library will be a drop-in replacement.
+
+However, there are some differences, essentially at the level of
+implementation details.
+
+The major difference is that while the Arduino implementation drives
+the servos with "bit-banged" :ref:`PWM <pwm>`, the Maple
+implementation uses :ref:`timers <timers>` to drive the PWM directly.
+
+Consequently, **the Maple implementation only allows Servo instances
+to** :ref:`attach <libs-servo-attach>` **to pins that support PWM**.
+
+To determine if a pin supports PWM (15 Maple pins do), you can either
+check if "PWM" appears next to its number on the Maple silkscreen, or
+consult the :ref:`pwmWrite() <lang-pwmwrite>` documentation.
+
+RC Servos expect a pulse approximately every 20ms. In the Maple
+implementation, :ref:`periods <lang-hardwaretimer-setperiod>` are set
+for entire timers, rather than individual channels. Thus,
+``attach()``\ ing a Servo to a pin can interfere with other pins
+associated with the same timer\ [#fard-servo]_.
+
+Because of this, we recommend connecting multiple servomotors to pins
+which share a timer, in order to keep as many timers free for other
+purposes as possible. Consult the :ref:`table provided in the timers
+reference <timers-pin-channel-map>` to match up pins and timer
+channels.
+
+Another difference: although it is not publicly documented to do so,
+the Arduino implementation of `attach()
+<http://arduino.cc/en/Reference/ServoAttach>`_ returns the timer
+channel associated with the newly-attached pin, or 0 on failure (as of
+Arduino 0021). The Maple implementation returns true on success, and
+false on failure (and this is its documented behavior).
+
.. _libraries-liquid-crystal:
LiquidCrystal
-------------
+.. TODO 0.0.10 make our own LiquidCrystal docs
+
The LiquidCrystal library allows Maple to control LCD screens. For
-more information, see the Arduino LiquidCrystal documentation.
+more information, see the `Arduino LiquidCrystal documentation
+<http://www.arduino.cc/en/Reference/LiquidCrystal>`_.
**Compatibility Note**
@@ -57,6 +113,8 @@ the hardware i2c peripheral on the stm32 as well as the DMA for
performance. Support for slave, smBUS, and multimaster modes are also
slated for inclusion in the enhanced Wire port.
+.. TODO 0.0.10 Wire docs in the cpp domain in own page under /libs/
+
Wire Function Reference
^^^^^^^^^^^^^^^^^^^^^^^
@@ -127,3 +185,10 @@ Wire Function Reference
Returns the number of bytes which are still available for reading
(with ``Wire.receive()``) from the last call to
``Wire.requestFrom(uint8, int)``.
+
+.. rubric:: Footnotes
+
+.. [#fard-servo] The Arduino implementation also captures timer
+ channels in groups as more Servo objects are attached, but the
+ details of which channels have their periods reset when are
+ slightly different.