spiport.hpp File Reference

Definition of the Arduino 'SPI' interface. More...

Detailed Description

Definition of the Arduino 'SPI' interface.

Marian Buschsieweke maria.nosp@m.n.bu.nosp@m.schsi.nosp@m.ewek.nosp@m.e@ovg.nosp@m.u.de

Definition in file spiport.hpp.

#include "arduino_board.h"
#include "byteorder.h"
#include "periph/spi.h"
#include "rmutex.h"
+ Include dependency graph for spiport.hpp:

Go to the source code of this file.

Data Structures

class  SPISettings
 Arduino SPI configuration interface. More...
class  SPIClass
 Arduino SPI interface. More...


 : Instance of the SPI interface as required by the Arduino API

Arduino compatible SPI modes

#define SPI_MODE0   (0)
 CPOL=0, CPHA=0.
#define SPI_MODE1   (1)
 CPOL=0, CPHA=1.
#define SPI_MODE2   (2)
 CPOL=1, CPHA=0.
#define SPI_MODE3   (3)
 CPOL=1, CPHA=1.

Arduino compatible SPI frequency selection via clock divider

This API assumes the library was targeting a 16 MHz Arduino.

It will choose the SPI clock frequency matching the requested frequency best, but never a frequency greater than the one it would have on Arduinos.

#define SPI_CLOCK_DIV2   (0)
 Best match for 8 MHz: 5 MHz.
#define SPI_CLOCK_DIV4   (1)
 Best match for 4 MHz: 1 MHz.
#define SPI_CLOCK_DIV8   (1)
 Best match for 2 MHz: 1 MHz.
#define SPI_CLOCK_DIV16   (1)
 Best match for 1 MHz: 1 MHz.
#define SPI_CLOCK_DIV32   (2)
 Best match for 500 kHz: 400 kHz.
#define SPI_CLOCK_DIV64   (3)
 Best match for 250 kHZ: 100 kHz.
#define SPI_CLOCK_DIV128   (3)
 Best match for 125 kHz: 100 kHz.

Arduino compatible bit order values for SPI

#define MSBFIRST   (1)
 most significat bit first