The Serial Peripheral Interface Bus or SPI bus is a synchronous serial data link standard named by Motorola that operates in full duplex mode. Devices communicate in a master/slave mode where the master device initiates the data frame. Multiple slave devices are allowed with individual slave select (chip select) lines using a pin for each device. There is a wide availability of sensors that communicate using SPI as protocol. Check the examples included with the library.

Including this library automatically defines constants for the pins involved: SS, SCK, MOSI, MISO, making it possible to use them in regular commands like: digitalWrite(SS, HIGH); For the physical location of these pins check the hardware reference. On Wiring v1 boards the SPI pins are: SS=24, MOSI=25, MISO=26 and SCK=27. On Wiring S board the SPI pins are: SS=20, MOSI=21, MISO=22 and SCK=23.

Wiring I/O board internal SPI.

Starts SPI communication.

Stops SPI communication.

Exchanges bytes of data.

Sets the bit order to use for SPI communication.

Sets the SPI communication mode.

Sets clockDivider for the SPI communication speed.

Activate the SPI interrupt and attaches a function to be executed when the SPI transfer complete interruption is generated during communication.

Deactivate the SPI interrupt and detaches the interruption function.