AVRTools
A Library for the AVR ATmega328 and ATmega2560 Microcontrollers
Classes | Namespaces | Enumerations | Functions
SPI.h File Reference

This file provides an interface to SPI subsystem available on the AVR ATMega328p (Arduino Uno) and ATMega2560 (Arduino Mega) microcontrollers. More...

#include <stdint.h>
#include <stddef.h>
#include <avr/io.h>
Include dependency graph for SPI.h:

Go to the source code of this file.

Classes

class  SPI::SPISettings
 A class that binds settings for configuring SPI transmissions. More...
 

Namespaces

 SPI
 This namespace bundles an interface to the SPI hardware subsystem on the AVR ATMega328p (Arduino Uno) and ATMega2560 (Arduino Mega) microcontrollers. It provides logical cohesion for functions implement the Master portion of the SPI protocol and prevents namespace collisions.
 

Enumerations

enum  SPI::ByteOrder { SPI::kLsbFirst, SPI::kMsbFirst }
 An enumeration that defines the byte order for multibyte SPI transmissions. More...
 
enum  SPI::SpiMode { SPI::kSpiMode0, SPI::kSpiMode1, SPI::kSpiMode2, SPI::kSpiMode3 }
 An enumeration that defines the modes available for SPI transmissions. More...
 

Functions

void SPI::enable ()
 Enable the SPI subsystem for transmission. More...
 
void SPI::disable ()
 Disable the SPI subsystem, precluding further transmissions. More...
 
void SPI::configure (SPISettings settings)
 Set the configuration of SPI subsystem to match the needs of the system you are going to communicate with. More...
 
uint8_t SPI::transmit (uint8_t data)
 Transmit a single byte using the SPI subsystem. More...
 
uint16_t SPI::transmit16 (uint16_t data)
 Transmit a word-sized integer (two bytes) using the SPI subsystem. The order in which the bytes are sent is determined by the bit order configuration that has been set. More...
 
uint32_t SPI::transmit32 (uint32_t data)
 Transmit a long-word-sized integer (four bytes) using the SPI subsystem. The order in which the bytes are sent is determined by the bit order configuration that has been set. More...
 
void SPI::transmit (uint8_t *buffer, size_t count)
 Transmit an array of bytes using the SPI subsystem. The bytes are transmitted in array order. More...
 

Detailed Description

This file provides an interface to SPI subsystem available on the AVR ATMega328p (Arduino Uno) and ATMega2560 (Arduino Mega) microcontrollers.