Arduino Core for STM32  1.0
SPI transaction initializers

Optimized methods for performance for initializing transaction. More...

Functions

SPI_Status HardwareSPI_O::beginTransaction (SPISettings settings) override
 Enables SPI periphery and sets some settings. More...
 
SPI_Status HardwareSPI_O::endTransaction () override
 Disables SPI periphery and checks or sends CRC if enabled. More...
 

Detailed Description

Optimized methods for performance for initializing transaction.

Note
In class HardwareSPI_O, methods beginTransaction() and endTransaction() have to be called before using Optimized transaction methods, else they will be disabled. There is also an exception, array optimized transaction methods can be called without calling beginTransaction() or endTransaction().
See also
Base transaction initializers

Methods for initializing transaction and flushing buffers.

Function Documentation

◆ beginTransaction()

SPI_Status HardwareSPI_O::beginTransaction ( SPISettings  settings)
overridevirtual

Enables SPI periphery and sets some settings.

Note
This method have to be called before using transfer(), transfer16(), transfer32(), write(), write16(), write32(), receive(), receive16(), receive32() methods, else those methods will return error code. Methods, that transact arrays of data, can be used without calling beginTransaction(), those methods are: transfer(void *buf, uint16_t count, bool lastByte), transferBytes(), writeBytes(), receiveBytes(), transferBytesNonBlocking(), writeBytesNonBlocking(), receiveBytesNonBlocking().
Parameters
settingsClass, that contains basic SPI settings.
Returns
Returns status. See SPI_Status enum.

Reimplemented from HardwareSPI.

◆ endTransaction()

SPI_Status HardwareSPI_O::endTransaction ( )
overridevirtual

Disables SPI periphery and checks or sends CRC if enabled.

If an error happen during transaction, all transaction methods will be forbidden and will return false, until endTransaction() will be called.

Returns
Returns the last transaction status, see: lastTransactionStatus().

Reimplemented from HardwareSPI.