diff options
author | Marti Bolivar <mbolivar@leaflabs.com> | 2011-02-16 05:45:40 -0500 |
---|---|---|
committer | Marti Bolivar <mbolivar@leaflabs.com> | 2011-02-16 05:45:40 -0500 |
commit | c4177d18f5a433fcac11f8ce96a91bdb5a4207e7 (patch) | |
tree | 3db2b38b9543093832f2d9a9cf78ef47c4b69d16 /source/lang/api | |
parent | e6317f828d346adafad4f03e9f7cf74b1e9acfa8 (diff) | |
download | librambutan-c4177d18f5a433fcac11f8ce96a91bdb5a4207e7.tar.gz librambutan-c4177d18f5a433fcac11f8ce96a91bdb5a4207e7.zip |
docs fixes
Diffstat (limited to 'source/lang/api')
-rw-r--r-- | source/lang/api/hardwarespi.rst | 28 | ||||
-rw-r--r-- | source/lang/api/hardwaretimer.rst | 3 |
2 files changed, 23 insertions, 8 deletions
diff --git a/source/lang/api/hardwarespi.rst b/source/lang/api/hardwarespi.rst index c71b2c3..53a225d 100644 --- a/source/lang/api/hardwarespi.rst +++ b/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/source/lang/api/hardwaretimer.rst b/source/lang/api/hardwaretimer.rst index 3e5424c..c7a630d 100644 --- a/source/lang/api/hardwaretimer.rst +++ b/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 |