aboutsummaryrefslogtreecommitdiffstats
path: root/docs/source/lang
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2011-02-16 05:45:40 -0500
committerMarti Bolivar <mbolivar@leaflabs.com>2011-02-16 05:45:40 -0500
commit1af21fad4997e72438d2c10114d97d7a5ada8572 (patch)
treecea3850e2e589827dd9901fb2b75b67680feaaa8 /docs/source/lang
parent2764748208816043a3149eae3a433d02325a1a36 (diff)
downloadlibrambutan-1af21fad4997e72438d2c10114d97d7a5ada8572.tar.gz
librambutan-1af21fad4997e72438d2c10114d97d7a5ada8572.zip
docs fixes
Diffstat (limited to 'docs/source/lang')
-rw-r--r--docs/source/lang/api/hardwarespi.rst28
-rw-r--r--docs/source/lang/api/hardwaretimer.rst3
2 files changed, 23 insertions, 8 deletions
diff --git a/docs/source/lang/api/hardwarespi.rst b/docs/source/lang/api/hardwarespi.rst
index c71b2c3..53a225d 100644
--- a/docs/source/lang/api/hardwarespi.rst
+++ b/docs/source/lang/api/hardwarespi.rst
@@ -39,17 +39,29 @@ pins for other purposes.
Library Documentation
---------------------
+Using the SPI Class
+^^^^^^^^^^^^^^^^^^^
+
+You can declare that you want to use SPI in your sketch by putting
+``HardwareSPI Spi(number);`` with your variables, where ``number`` is
+1 or 2, depending on which SPI you want to use. Then you can use the
+functions described in the next section. For example::
+
+ // Use SPI 1
+ HardwareSpi Spi(1);
+
+ void setup() {
+ Spi.begin(SPI_18MHZ);
+ }
+
+ void loop() {
+ // Get the next byte from the peripheral
+ uint8 byte = Spi.recv();
+ }
+
HardwareSPI Class Reference
^^^^^^^^^^^^^^^^^^^^^^^^^^^
-You can use the SPI interface by including a declaration ``HardwareSPI
-Spi(number);`` at the start of the sketch or program. The ``number``
-must be either 1 or 2 and specifies which port to use. Once this is
-done, you can call any of the methods documented here using
-``Spi.method(arguments)``; for example, ``Spi.send(0x13)`` would send
-the value ``0x13`` into the port buffer to be transmitted as soon as
-possible.
-
.. cpp:class:: HardwareSPI
Class for interacting with SPI.
diff --git a/docs/source/lang/api/hardwaretimer.rst b/docs/source/lang/api/hardwaretimer.rst
index 3e5424c..c7a630d 100644
--- a/docs/source/lang/api/hardwaretimer.rst
+++ b/docs/source/lang/api/hardwaretimer.rst
@@ -21,6 +21,9 @@ documented below on one of the predefined ``HardwareTimer`` instances.
For example, to set the prescale factor on timer 1 to 5, call
``Timer1.setPrescaleFactor(5)``.
+.. TODO add code examples that people can copy and paste in case
+.. they're unfamiliar with namespace syntax
+
.. cpp:class:: HardwareTimer
Class for interacting with a timer. There are four predefined