FastArduino  v1.8
C++ library to build fast but small Arduino/AVR projects
spi::AbstractSPIDevice Class Reference

Contain general payload transfer API for an SPI device. More...

#include <fastarduino/spi.h>

Inheritance diagram for spi::AbstractSPIDevice:

Protected Member Functions

 AbstractSPIDevice (const AbstractSPIDevice &)=delete
 
AbstractSPIDeviceoperator= (const AbstractSPIDevice &)=delete
 
uint8_t transfer (uint8_t data)
 Transfer one byte to the currently selected SPI slave device through MOSI pin, and get the byte returned by the device through MISO pin. More...
 
void transfer (uint8_t *data, uint16_t size)
 Transfer an array of payload data to the currently selected SPI slave device through MOSI pin, and get all data bytes simultaneously received from that device through MISO pin. More...
 
void transfer (const uint8_t *data, uint16_t size)
 Transfer an array of payload data to the currently selected SPI slave device through MOSI pin; any data bytes simultaneously received from that device through MISO pin are lost. More...
 
void transfer (uint8_t *data, uint16_t size, uint8_t sent)
 Transfer the provided byte sent several times to the currently selected SPI slave device through MOSI pin, and get all data bytes simultaneously received from that device through MISO pin. More...
 
void transfer (uint16_t size, uint8_t sent)
 Transfer the provided byte sent several times to the currently selected SPI slave device through MOSI pin; any data bytes simultaneously received from that device through MISO pin are lost. More...
 

Detailed Description

Contain general payload transfer API for an SPI device.

This is not supposed to be used directly, as it does not include start/end transfer methods. SPI device implementers shall use SPIDevice template class instead.

See also
SPIDevice

Definition at line 152 of file spi.h.

Member Function Documentation

◆ transfer() [1/5]

uint8_t spi::AbstractSPIDevice::transfer ( uint8_t  data)
inlineprotected

Transfer one byte to the currently selected SPI slave device through MOSI pin, and get the byte returned by the device through MISO pin.

Parameters
datathe byte to transmit to slave device
Returns
the byte received from slave device
See also
transfer(uint8_t*, uint16_t)
transfer(uint8_t*, uint16_t, uint8_t)

Definition at line 169 of file spi.h.

◆ transfer() [2/5]

void spi::AbstractSPIDevice::transfer ( uint8_t *  data,
uint16_t  size 
)
inlineprotected

Transfer an array of payload data to the currently selected SPI slave device through MOSI pin, and get all data bytes simultaneously received from that device through MISO pin.

Parameters
datapointer to the payload to transmit; is also the placeholder for payload simultaneously returned by the slave.
sizethe payload size
See also
transfer(uint8_t)
transfer(uint8_t*, uint16_t, uint8_t)
transfer(const uint8_t*, uint16_t)

Definition at line 205 of file spi.h.

◆ transfer() [3/5]

void spi::AbstractSPIDevice::transfer ( const uint8_t *  data,
uint16_t  size 
)
inlineprotected

Transfer an array of payload data to the currently selected SPI slave device through MOSI pin; any data bytes simultaneously received from that device through MISO pin are lost.

Parameters
datapointer to the payload to transmit
sizethe payload size
See also
transfer(uint8_t)
transfer(uint16_t, uint8_t)
transfer(uint8_t*, uint16_t)

Definition at line 225 of file spi.h.

◆ transfer() [4/5]

void spi::AbstractSPIDevice::transfer ( uint8_t *  data,
uint16_t  size,
uint8_t  sent 
)
inlineprotected

Transfer the provided byte sent several times to the currently selected SPI slave device through MOSI pin, and get all data bytes simultaneously received from that device through MISO pin.

This method is useful when you have requested information from the slave device and then you must always send the same byte to receive all requested information: with this method, you do not need to initialize data with sent size times.

Parameters
dataplaceholder for the payload returned by the slave whilst transmitting size times the sent byte
sizethe number of times to transmit sent byte to the SPI slave
sentthe data byte to transmit several times
See also
transfer(uint8_t)
transfer(uint8_t*, uint16_t)
transfer(uint16_t, uint8_t)

Definition at line 248 of file spi.h.

◆ transfer() [5/5]

void spi::AbstractSPIDevice::transfer ( uint16_t  size,
uint8_t  sent 
)
inlineprotected

Transfer the provided byte sent several times to the currently selected SPI slave device through MOSI pin; any data bytes simultaneously received from that device through MISO pin are lost.

Parameters
sizethe number of times to transmit sent byte to the SPI slave
sentthe data byte to transmit several times
See also
transfer(uint8_t)
transfer(const uint8_t*, uint16_t)
transfer(uint8_t*, uint16_t, uint8_t)

Definition at line 265 of file spi.h.


The documentation for this class was generated from the following file: