diff options
author | Marti Bolivar <mbolivar@mit.edu> | 2010-12-21 10:27:37 -0500 |
---|---|---|
committer | Marti Bolivar <mbolivar@mit.edu> | 2010-12-21 10:27:37 -0500 |
commit | c45bccad44187da27505cf5808424e709e3f54a1 (patch) | |
tree | 18a459a50f8d0551ba046e30462c93999d982725 /docs/source/spi.rst | |
parent | 84fd2532a7f23d20354ff590790b3f892cb7e7d7 (diff) | |
parent | d5ad2a27f4e69e6cc9324331945937c983c30366 (diff) | |
download | librambutan-c45bccad44187da27505cf5808424e709e3f54a1.tar.gz librambutan-c45bccad44187da27505cf5808424e709e3f54a1.zip |
Merge branch 'master' into debug-serialusb.
Chose debug-serialusb version in cases of conflict.
Conflicts:
libmaple/usb/usb_callbacks.c
Diffstat (limited to 'docs/source/spi.rst')
-rw-r--r-- | docs/source/spi.rst | 55 |
1 files changed, 8 insertions, 47 deletions
diff --git a/docs/source/spi.rst b/docs/source/spi.rst index 4cfd7e7..ba43eef 100644 --- a/docs/source/spi.rst +++ b/docs/source/spi.rst @@ -4,54 +4,16 @@ SPI ===== -The Maple has two SPI ports. The first has NSS on D10, MOSI on D11, -MISO on D12, and SCK on D13. The second has NSS on D31, SCK on D32, -MISO on D33, and MOSI on D34. +The Serial Peripheral Interface Bus (SPI) is a serial data transfer +protocol useful for interacting with a wide variety of hardware +peripherals. -.. _spi-speeds: +The Maple has two SPI ports. The first has NSS on D10, MOSI on +D11, MISO on D12, and SCK on D13. The second has NSS on D31, SCK on +D32, MISO on D33, and MOSI on D34. -Each port can be configured at one of the following speeds: - -* ``SPI_18MHZ``: 18 MHz -* ``SPI_9MHZ``: 9 MHz -* ``SPI_4_5MHZ``: 4.5 MHz -* ``SPI_2_25MHZ``: 2.25 MHz -* ``SPI_1_125MHZ``: 1.124 MHz -* ``SPI_562_500KHZ``: 562.500 KHz -* ``SPI_281_250KHZ``: 281.250 KHz -* ``SPI_140_625KHZ``: 140.625 KHz - -.. contents:: Contents - :local: - -Function Reference ------------------- - -``HardwareSPI Spi(number);`` - - This declaration must be included at the start of any sketch or - program that uses the SPI interface. The argument number is either - 1 or 2 and specifies which port to use. - -``Spi.begin(freq, endianness, mode)`` - - ``begin`` is usually called in `setup()`_ to configure the - baudrate of the given SPI port and to set up the header pins - appropriately. ``freq`` is one of the set listed :ref:`above - <spi-speeds>`; ``endianness`` is either ``LSBFIRST`` or - ``MSBFIRST``; mode is one of 0, 1, 2, 3, and specifies which "SPI - Mode" is used (see specification docs linked below). - -``Spi.begin()`` - - A default ``begin`` with no arguments is provided for the lazy; it - is equivalent to ``Spi.begin(SPI_1_125MHZ, MSBFIRST, 0)``. - -``Spi.send(data, size)`` - - Writes data into the port buffer to be transmitted as soon as - possible. ``data`` should be an array of type ``byte*``; ``size`` - should be the number of elements in ``data``. +The public libmaple API for managing the SPI ports is the +:ref:`HardwareSpi <lang-hardwarespi>` class. Recommended Reading ------------------- @@ -63,7 +25,6 @@ Recommended Reading * `Hardcore SPI on Arduino <http://klk64.com/arduino-spi/>`_ by kik64 * STMicro documentation for STM32F103RB microcontroller: - * `All <http://www.st.com/mcu/devicedocs-STM32F103RB-110.html>`_ * `Datasheet <http://www.st.com/stonline/products/literature/ds/13587.pdf>`_ (pdf) * `Reference Manual <http://www.st.com/stonline/products/literature/rm/13902.pdf>`_ (pdf) |