SPI (Member Function Version)
SPI (Method-based usage)
After initializing the hardware with the
begin()
method, use beginTransaction()
to enable bus communication. When beginTransaction()
is executed, the SPI select pin is asserted. Use the transfer()
function for reading and writing. SPI performs read and write operations simultaneously.beginTransaction()
void beginTransaction()
void beginTransaction(SPISettings settings)
Starts using the SPI bus. Asserts the SPI select pin.
When called with the settings
parameter, it also configures the bus settings.
endTransaction()
void endTransaction()
Ends the use of the SPI bus. Deasserts the SPI select pin.
transfer()
, transfer16()
, transfer32()
inline uint8_t transfer(uint8_t data)
inline uint16_t transfer16(uint16_t data)
inline uint32_t transfer32(uint32_t data)
Performs read/write operations on the SPI bus. transfer()
transfers 8 bits, transfer16()
transfers 16 bits, and transfer32()
transfers 32 bits.