Arduino-SPI
Serial Peripheral Interface (SPI) library for Arduino
|
#include <SPI.h>
Classes | |
class | Device |
Public Member Functions | |
SPI () | |
virtual uint8_t | prescale (uint32_t frequency) |
virtual void | acquire (uint8_t mode, uint8_t bitorder, uint8_t prescale) |
virtual void | release () |
virtual uint8_t | transfer (uint8_t value)=0 |
SPI & | operator>> (uint8_t &value) |
SPI & | operator<< (uint8_t value) |
virtual void | transfer (void *dest, const void *src, size_t count) |
virtual void | read (void *buf, size_t count) |
virtual void | write (const void *buf, size_t count) |
Static Public Attributes | |
static const uint32_t | MAX_FREQ = F_CPU / 2 |
Protected Member Functions | |
void | lock () |
void | unlock () |
Protected Attributes | |
volatile bool | m_busy |
|
inlinevirtual |
Acquire bus access with given mode.
[in] | mode | of access. |
[in] | bitorder | of serial data. |
[in] | prescale | for device. |
Reimplemented in Hardware::SPI, Software::SPI< MOSI_PIN, MISO_PIN, SCK_PIN >, and Hardware::SPI.
|
inline |
|
inline |
|
inlinevirtual |
Calculate clock prescale from device frequency.
[in] | frequency | device access. |
Reimplemented in Hardware::SPI.
|
inlinevirtual |
Read given number of bytes from device and store in buffer.
[in] | buf | buffer pointer. |
[in] | count | number of bytes. |
Reimplemented in Hardware::SPI, and Hardware::SPI.
|
inlinevirtual |
Release bus access.
Reimplemented in Software::SPI< MOSI_PIN, MISO_PIN, SCK_PIN >.
|
pure virtual |
Send given byte to device. Returns byte received from device.
[in] | value | to send to device. |
Implemented in Hardware::SPI, Software::SPI< MOSI_PIN, MISO_PIN, SCK_PIN >, and Hardware::SPI.
|
inlinevirtual |
Transfer given number of bytes from source buffer to device. Store received bytes in destination buffer.
[in] | dest | destination buffer. |
[in] | src | source buffer. |
[in] | count | number of bytes to transfer. |
Reimplemented in Hardware::SPI, and Hardware::SPI.
|
inlinevirtual |
Write given number of bytes from buffer to device.
[in] | buf | buffer pointer. |
[in] | count | number of bytes. |
Reimplemented in Hardware::SPI, and Hardware::SPI.
|
static |