FastArduino v1.10
C++ library to build fast but small Arduino/AVR projects
Loading...
Searching...
No Matches
spi.h File Reference

SPI support for AVR MCU. More...

#include "boards/board.h"
#include "gpio.h"
Include dependency graph for spi.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  spi::AbstractSPIDevice
 Contain general payload transfer API for an SPI device. More...
 
class  spi::SPIDevice< CS, CS_MODE, RATE, MODE, ORDER >
 Base class for any SPI slave device. More...
 

Namespaces

namespace  spi
 Define API to define and manage SPI devices.
 

Enumerations

enum class  spi::ClockRate : uint8_t {
  CLOCK_DIV_4 = 0x00 ,
  CLOCK_DIV_16 = 0x01 ,
  CLOCK_DIV_64 = 0x02 ,
  CLOCK_DIV_128 = 0x03 ,
  CLOCK_DIV_2 = 0x10 ,
  CLOCK_DIV_8 = 0x11 ,
  CLOCK_DIV_32 = 0x12
}
 Define SPI clock rate as a divider of MCU clock frequency. More...
 
enum class  spi::DataOrder : uint8_t {
  spi::MSB_FIRST = 0 ,
  spi::LSB_FIRST = bits::BV8(DORD)
}
 Bit ordering per byte. More...
 
enum class  spi::Mode : uint8_t {
  spi::MODE_0 = 0 ,
  spi::MODE_1 = bits::BV8(CPHA) ,
  spi::MODE_2 = bits::BV8(CPOL) ,
  spi::MODE_3 = bits::BV8(CPHA, CPOL)
}
 SPI transmission mode. More...
 
enum class  spi::ChipSelect : uint8_t {
  spi::ACTIVE_LOW = 0 ,
  spi::ACTIVE_HIGH = 1
}
 Active polarity of slave selection pin. More...
 

Functions

void spi::init ()
 This function must be called once in your program, before any use of an SPI device. More...
 
constexpr ClockRate spi::compute_clockrate (uint32_t frequency)
 Calculate ClockRate for the given frequency. More...
 

Detailed Description

SPI support for AVR MCU.

Definition in file spi.h.