#include <SPIBase.h>
Public Member Functions | |
virtual | ~SPIBase () |
virtual bool | begin ()=0 |
Initialize the SPI bus by setting SCK, MOSI, and SS to outputs, pulling SCK and MOSI low, and SS high. More... | |
virtual void | end ()=0 |
Disable the SPI bus (leaving pin modes unchanged). More... | |
void | beginTransaction (SPISettings &settings) |
Initialize the SPI bus using the defined SPISettings. More... | |
void | beginTransaction (const SPISettings &settings) |
virtual void | endTransaction () |
Stop using the SPI bus. Normally this is called after de-asserting the chip select, to allow other libraries to use the SPI bus. More... | |
virtual uint8_t | read8 () |
Read one byte from SPI without setting up registers. More... | |
Send/receive some data | |
SPI transfer is based on a simultaneous send and receive: the received data is returned in receivedVal (or receivedVal16). In case of buffer transfers the received data is stored in the buffer in-place (the old data is replaced with the data received). receivedVal = SPI.transfer(val) receivedVal16 = SPI.transfer16(val16) SPI.transfer(buffer, size) | |
uint8_t | transfer (uint8_t val) |
Send/receive one bytes of data. More... | |
uint16_t | transfer16 (uint16_t val) |
Send/receive one 16-bit word of data. More... | |
virtual uint32_t | transfer32 (uint32_t val, uint8_t bits=32) |
Send/receive a word of variable size. More... | |
virtual void | transfer (uint8_t *buffer, size_t size)=0 |
Send/receive a variable-length block of data. More... | |
Public Attributes | |
SPISettings | SPIDefaultSettings |
Default settings used by the SPI bus until reset by beginTransaction(SPISettings) More... | |
Protected Member Functions | |
virtual void | prepare (SPISettings &settings)=0 |
Prepare/configure with settings. More... | |
Constructor & Destructor Documentation
◆ ~SPIBase()
|
inlinevirtual |
Member Function Documentation
◆ begin()
|
pure virtual |
◆ beginTransaction() [1/2]
|
inline |
Initialize the SPI bus using the defined SPISettings.
◆ beginTransaction() [2/2]
|
inline |
◆ end()
|
pure virtual |
◆ endTransaction()
|
inlinevirtual |
Stop using the SPI bus. Normally this is called after de-asserting the chip select, to allow other libraries to use the SPI bus.
◆ prepare()
|
protectedpure virtual |
◆ read8()
|
inlinevirtual |
Read one byte from SPI without setting up registers.
- Parameters
-
none
- Return values
-
byte received
used for performance tuning when doing continuous reads this method does not reset the registers , so make sure that a regular transfer(data) call was performed
Note: this method is not found on the Arduino API
USE WITH CARE !!
◆ transfer() [1/2]
|
inline |
Send/receive one bytes of data.
- Parameters
-
val The byte to send
- Return values
-
uint8_t The received byte
◆ transfer() [2/2]
|
pure virtual |
◆ transfer16()
Send/receive one 16-bit word of data.
- Parameters
-
val The word to send
- Return values
-
uint8_t The received word
◆ transfer32()
|
inlinevirtual |
Send/receive a word of variable size.
- Parameters
-
val Word to send bits Number of bits to send
SPI transfer is based on a simultaneous send and receive: the received data is returned in receivedVal (or receivedVal16).
receivedVal = SPI.transfer(val) : single byte receivedVal16 = SPI.transfer16(val16) : single short
Member Data Documentation
◆ SPIDefaultSettings
SPISettings SPIBase::SPIDefaultSettings |
Default settings used by the SPI bus until reset by beginTransaction(SPISettings)
Note: not included in std Arduino lib
The documentation for this class was generated from the following file: