All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
spiport.hpp File Reference

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

Detailed Description

Definition of the Arduino 'SPI' interface.

Author
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...
 

Variables

SPIClass SPI
 : 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 significant bit first
 

Macro Definition Documentation

◆ MSBFIRST

#define MSBFIRST   (1)

most significant bit first

Definition at line 58 of file spiport.hpp.

◆ SPI_CLOCK_DIV128

#define SPI_CLOCK_DIV128   (3)

Best match for 125 kHz: 100 kHz.

Definition at line 51 of file spiport.hpp.

◆ SPI_CLOCK_DIV16

#define SPI_CLOCK_DIV16   (1)

Best match for 1 MHz: 1 MHz.

Definition at line 48 of file spiport.hpp.

◆ SPI_CLOCK_DIV2

#define SPI_CLOCK_DIV2   (0)

Best match for 8 MHz: 5 MHz.

Definition at line 45 of file spiport.hpp.

◆ SPI_CLOCK_DIV32

#define SPI_CLOCK_DIV32   (2)

Best match for 500 kHz: 400 kHz.

Definition at line 49 of file spiport.hpp.

◆ SPI_CLOCK_DIV4

#define SPI_CLOCK_DIV4   (1)

Best match for 4 MHz: 1 MHz.

Definition at line 46 of file spiport.hpp.

◆ SPI_CLOCK_DIV64

#define SPI_CLOCK_DIV64   (3)

Best match for 250 kHZ: 100 kHz.

Definition at line 50 of file spiport.hpp.

◆ SPI_CLOCK_DIV8

#define SPI_CLOCK_DIV8   (1)

Best match for 2 MHz: 1 MHz.

Definition at line 47 of file spiport.hpp.

◆ SPI_MODE0

#define SPI_MODE0   (0)

CPOL=0, CPHA=0.

Definition at line 31 of file spiport.hpp.

◆ SPI_MODE1

#define SPI_MODE1   (1)

CPOL=0, CPHA=1.

Definition at line 32 of file spiport.hpp.

◆ SPI_MODE2

#define SPI_MODE2   (2)

CPOL=1, CPHA=0.

Definition at line 33 of file spiport.hpp.

◆ SPI_MODE3

#define SPI_MODE3   (3)

CPOL=1, CPHA=1.

Definition at line 34 of file spiport.hpp.