Reconfigures the SPI peripheral with the supplied settings (see
In addition to reconfiguring the SPI peripheral,
beginTransaction() also acquires the SPI peripheral lock, blocking other threads from using the selected SPI peripheral until
endTransaction() is called. See Synchronizing Access to Shared System Resources section for additional information on shared resource locks.
It is required that you use
- You have more than one SPI device and they have different settings (speed, bit order, or mode)
- You have more than one thread or use SPI from a Software Timer
- You want to be compatible with the Ethernet FeatherWing or support Ethernet on your B Series SoM base board
You must not use
beginTransaction() within a
SINGLE_THREADED_BLOCK as deadlock can occur.
// SYNTAX SPI.beginTransaction(SPISettings(4*MHZ, MSBFIRST, SPI_MODE0)); // Pre-declared SPISettings object SPI.beginTransaction(settings);
SPISettingsobject with chosen settings
Returns: Negative integer in case of an error.
You should set your SPI CS/SS pin between the calls to
endTransaction(). You typically use
pinResetFast() right after
pinSetFast() right before
Note that you must use the same
SPI object as used with
SPI.begin() so if you used
SPI1.begin() also use