Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
SPI Interface

SPI Interface. More...

Data Structures

struct  spi_cs_control
 SPI Chip Select control structure. More...
 
struct  spi_config
 SPI controller configuration structure. More...
 
struct  spi_dt_spec
 Complete SPI DT information. More...
 
struct  spi_buf
 SPI buffer structure. More...
 
struct  spi_buf_set
 SPI buffer array structure. More...
 
struct  spi_driver_api
 SPI driver API This is the mandatory API any SPI driver needs to expose. More...
 

Macros

#define SPI_OP_MODE_MASTER   0
 SPI operational mode. More...
 
#define SPI_OP_MODE_SLAVE   BIT(0)
 
#define SPI_OP_MODE_MASK   0x1
 
#define SPI_OP_MODE_GET(_operation_)   ((_operation_) & SPI_OP_MODE_MASK)
 
#define SPI_MODE_CPOL   BIT(1)
 SPI Polarity & Phase Modes. More...
 
#define SPI_MODE_CPHA   BIT(2)
 
#define SPI_MODE_LOOP   BIT(3)
 
#define SPI_MODE_MASK   (0xE)
 
#define SPI_MODE_GET(_mode_)    ((_mode_) & SPI_MODE_MASK)
 
#define SPI_TRANSFER_MSB   (0)
 SPI Transfer modes (host controller dependent) More...
 
#define SPI_TRANSFER_LSB   BIT(4)
 
#define SPI_WORD_SIZE_SHIFT   (5)
 SPI word size. More...
 
#define SPI_WORD_SIZE_MASK   (0x3F << SPI_WORD_SIZE_SHIFT)
 
#define SPI_WORD_SIZE_GET(_operation_)    (((_operation_) & SPI_WORD_SIZE_MASK) >> SPI_WORD_SIZE_SHIFT)
 
#define SPI_WORD_SET(_word_size_)    ((_word_size_) << SPI_WORD_SIZE_SHIFT)
 
#define SPI_LINES_SINGLE   (0 << 11)
 SPI MISO lines. More...
 
#define SPI_LINES_DUAL   (1 << 11)
 
#define SPI_LINES_QUAD   (2 << 11)
 
#define SPI_LINES_OCTAL   (3 << 11)
 
#define SPI_LINES_MASK   (0x3 << 11)
 
#define SPI_HOLD_ON_CS   BIT(13)
 Specific SPI devices control bits. More...
 
#define SPI_LOCK_ON   BIT(14)
 
#define SPI_CS_ACTIVE_HIGH   BIT(15)
 
#define SPI_CS_CONTROL_PTR_DT(node_id, delay_)
 Initialize and get a pointer to a spi_cs_control from a devicetree node identifier. More...
 
#define SPI_CS_CONTROL_PTR_DT_INST(inst, delay_)    SPI_CS_CONTROL_PTR_DT(DT_DRV_INST(inst), delay_)
 Get a pointer to a spi_cs_control from a devicetree node. More...
 
#define SPI_CONFIG_DT(node_id, operation_, delay_)
 Structure initializer for spi_config from devicetree. More...
 
#define SPI_CONFIG_DT_INST(inst, operation_, delay_)    SPI_CONFIG_DT(DT_DRV_INST(inst), operation_, delay_)
 Structure initializer for spi_config from devicetree instance. More...
 
#define SPI_DT_SPEC_GET(node_id, operation_, delay_)
 Structure initializer for spi_dt_spec from devicetree. More...
 
#define SPI_DT_SPEC_INST_GET(inst, operation_, delay_)    SPI_DT_SPEC_GET(DT_DRV_INST(inst), operation_, delay_)
 Structure initializer for spi_dt_spec from devicetree instance. More...
 

Typedefs

typedef int(* spi_api_io) (const struct device *dev, const struct spi_config *config, const struct spi_buf_set *tx_bufs, const struct spi_buf_set *rx_bufs)
 Callback API for I/O See spi_transceive() for argument descriptions. More...
 
typedef int(* spi_api_io_async) (const struct device *dev, const struct spi_config *config, const struct spi_buf_set *tx_bufs, const struct spi_buf_set *rx_bufs, struct k_poll_signal *async)
 
typedef int(* spi_api_release) (const struct device *dev, const struct spi_config *config)
 Callback API for unlocking SPI device. See spi_release() for argument descriptions. More...
 

Functions

static bool spi_is_ready (const struct spi_dt_spec *spec)
 Validate that SPI bus is ready. More...
 
int spi_transceive (const struct device *dev, const struct spi_config *config, const struct spi_buf_set *tx_bufs, const struct spi_buf_set *rx_bufs)
 Read/write the specified amount of data from the SPI driver. More...
 
static int spi_transceive_dt (const struct spi_dt_spec *spec, const struct spi_buf_set *tx_bufs, const struct spi_buf_set *rx_bufs)
 Read/write data from an SPI bus specified in spi_dt_spec. More...
 
static int spi_read (const struct device *dev, const struct spi_config *config, const struct spi_buf_set *rx_bufs)
 Read the specified amount of data from the SPI driver. More...
 
static int spi_read_dt (const struct spi_dt_spec *spec, const struct spi_buf_set *rx_bufs)
 Read data from a SPI bus specified in spi_dt_spec. More...
 
static int spi_write (const struct device *dev, const struct spi_config *config, const struct spi_buf_set *tx_bufs)
 Write the specified amount of data from the SPI driver. More...
 
static int spi_write_dt (const struct spi_dt_spec *spec, const struct spi_buf_set *tx_bufs)
 Write data to a SPI bus specified in spi_dt_spec. More...
 
static int spi_transceive_async (const struct device *dev, const struct spi_config *config, const struct spi_buf_set *tx_bufs, const struct spi_buf_set *rx_bufs, struct k_poll_signal *async)
 Read/write the specified amount of data from the SPI driver. More...
 
static int spi_read_async (const struct device *dev, const struct spi_config *config, const struct spi_buf_set *rx_bufs, struct k_poll_signal *async)
 Read the specified amount of data from the SPI driver. More...
 
static int spi_write_async (const struct device *dev, const struct spi_config *config, const struct spi_buf_set *tx_bufs, struct k_poll_signal *async)
 Write the specified amount of data from the SPI driver. More...
 
int spi_release (const struct device *dev, const struct spi_config *config)
 Release the SPI device locked on by the current config. More...
 
static int spi_release_dt (const struct spi_dt_spec *spec)
 Release the SPI device specified in spi_dt_spec. More...
 

Detailed Description

SPI Interface.

Macro Definition Documentation

◆ SPI_CONFIG_DT

#define SPI_CONFIG_DT (   node_id,
  operation_,
  delay_ 
)

#include <include/drivers/spi.h>

Value:
{ \
.frequency = DT_PROP(node_id, spi_max_frequency), \
.operation = (operation_), \
.slave = DT_REG_ADDR(node_id), \
.cs = COND_CODE_1( \
(SPI_CS_CONTROL_PTR_DT(node_id, delay_)), \
(NULL)), \
}
#define DT_PROP(node_id, prop)
Get a devicetree property value.
Definition: devicetree.h:531
#define DT_REG_ADDR(node_id)
Get a node's (only) register block address.
Definition: devicetree.h:1355
#define DT_SPI_DEV_HAS_CS_GPIOS(spi_dev)
Does a SPI device have a chip select line configured? Example devicetree fragment:
Definition: spi.h:117
#define SPI_CS_CONTROL_PTR_DT(node_id, delay_)
Initialize and get a pointer to a spi_cs_control from a devicetree node identifier.
Definition: spi.h:190
#define COND_CODE_1(_flag, _if_1_code, _else_code)
Insert code depending on whether _flag expands to 1 or not.
Definition: util_macro.h:156

Structure initializer for spi_config from devicetree.

This helper macro expands to a static initializer for a struct spi_config by reading the relevant frequency, slave, and cs data from the devicetree.

Important: the cs field is initialized using SPI_CS_CONTROL_PTR_DT(). The gpio_dev value pointed to by this structure must be checked using device_is_ready() before use.

This macro is not available in C++.

Parameters
node_idDevicetree node identifier for the SPI device whose struct spi_config to create an initializer for
operation_the desired operation field in the struct spi_config
delay_the desired delay field in the struct spi_config's spi_cs_control, if there is one

◆ SPI_CONFIG_DT_INST

#define SPI_CONFIG_DT_INST (   inst,
  operation_,
  delay_ 
)     SPI_CONFIG_DT(DT_DRV_INST(inst), operation_, delay_)

#include <include/drivers/spi.h>

Structure initializer for spi_config from devicetree instance.

This is equivalent to SPI_CONFIG_DT(DT_DRV_INST(inst), operation_, delay_).

This macro is not available in C++.

Parameters
instDevicetree instance number
operation_the desired operation field in the struct spi_config
delay_the desired delay field in the struct spi_config's spi_cs_control, if there is one

◆ SPI_CS_ACTIVE_HIGH

#define SPI_CS_ACTIVE_HIGH   BIT(15)

◆ SPI_CS_CONTROL_PTR_DT

#define SPI_CS_CONTROL_PTR_DT (   node_id,
  delay_ 
)

#include <include/drivers/spi.h>

Value:
(&(struct spi_cs_control) { \
.gpio_dev = DEVICE_DT_GET( \
.delay = (delay_), \
.gpio_dt_flags = DT_SPI_DEV_CS_GPIOS_FLAGS(node_id), \
})
#define DEVICE_DT_GET(node_id)
Obtain a pointer to a device object by node_id.
Definition: device.h:247
#define DT_SPI_DEV_CS_GPIOS_CTLR(spi_dev)
Get a SPI device's chip select GPIO controller's node identifier.
Definition: spi.h:150
#define DT_SPI_DEV_CS_GPIOS_FLAGS(spi_dev)
Get a SPI device's chip select GPIO flags.
Definition: spi.h:249
#define DT_SPI_DEV_CS_GPIOS_PIN(spi_dev)
Get a SPI device's chip select GPIO pin number.
Definition: spi.h:221
SPI Chip Select control structure.
Definition: spi.h:138
gpio_pin_t gpio_pin
Definition: spi.h:141

Initialize and get a pointer to a spi_cs_control from a devicetree node identifier.

This helper is useful for initializing a device on a SPI bus. It initializes a struct spi_cs_control and returns a pointer to it. Here, node_id is a node identifier for a SPI device, not a SPI controller.

Example devicetree fragment:

spi@... {
        cs-gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
        spidev: spi-device@0 { ... };
};

Assume that gpio0 follows the standard convention for specifying GPIOs, i.e. it has the following in its binding:

gpio-cells:
- pin
- flags

Example usage:

struct spi_cs_control *ctrl =
        SPI_CS_CONTROL_PTR_DT(DT_NODELABEL(spidev), 2);

This example is equivalent to:

struct spi_cs_control *ctrl =
        &(struct spi_cs_control) {
                .gpio_dev = DEVICE_DT_GET(DT_NODELABEL(gpio0)),
                .delay = 2,
                .gpio_pin = 1,
                .gpio_dt_flags = GPIO_ACTIVE_LOW
        };

This macro is not available in C++.

Parameters
node_idDevicetree node identifier for a device on a SPI bus
delay_The delay field to set in the spi_cs_control
Returns
a pointer to the spi_cs_control structure

◆ SPI_CS_CONTROL_PTR_DT_INST

#define SPI_CS_CONTROL_PTR_DT_INST (   inst,
  delay_ 
)     SPI_CS_CONTROL_PTR_DT(DT_DRV_INST(inst), delay_)

#include <include/drivers/spi.h>

Get a pointer to a spi_cs_control from a devicetree node.

This is equivalent to SPI_CS_CONTROL_PTR_DT(DT_DRV_INST(inst), delay).

Therefore, DT_DRV_COMPAT must already be defined before using this macro.

This macro is not available in C++.

Parameters
instDevicetree node instance number
delay_The delay field to set in the spi_cs_control
Returns
a pointer to the spi_cs_control structure

◆ SPI_DT_SPEC_GET

#define SPI_DT_SPEC_GET (   node_id,
  operation_,
  delay_ 
)

#include <include/drivers/spi.h>

Value:
{ \
.bus = DEVICE_DT_GET(DT_BUS(node_id)), \
.config = SPI_CONFIG_DT(node_id, operation_, delay_) \
}
#define DT_BUS(node_id)
Node's bus controller.
Definition: devicetree.h:2022
#define SPI_CONFIG_DT(node_id, operation_, delay_)
Structure initializer for spi_config from devicetree.
Definition: spi.h:272

Structure initializer for spi_dt_spec from devicetree.

This helper macro expands to a static initializer for a struct spi_dt_spec by reading the relevant bus, frequency, slave, and cs data from the devicetree.

Important: multiple fields are automatically constructed by this macro which must be checked before use. spi_is_ready performs the required device_is_ready checks.

This macro is not available in C++.

Parameters
node_idDevicetree node identifier for the SPI device whose struct spi_dt_spec to create an initializer for
operation_the desired operation field in the struct spi_config
delay_the desired delay field in the struct spi_config's spi_cs_control, if there is one

◆ SPI_DT_SPEC_INST_GET

#define SPI_DT_SPEC_INST_GET (   inst,
  operation_,
  delay_ 
)     SPI_DT_SPEC_GET(DT_DRV_INST(inst), operation_, delay_)

#include <include/drivers/spi.h>

Structure initializer for spi_dt_spec from devicetree instance.

This is equivalent to SPI_DT_SPEC_GET(DT_DRV_INST(inst), operation_, delay_).

This macro is not available in C++.

Parameters
instDevicetree instance number
operation_the desired operation field in the struct spi_config
delay_the desired delay field in the struct spi_config's spi_cs_control, if there is one

◆ SPI_HOLD_ON_CS

#define SPI_HOLD_ON_CS   BIT(13)

#include <include/drivers/spi.h>

Specific SPI devices control bits.

◆ SPI_LINES_DUAL

#define SPI_LINES_DUAL   (1 << 11)

◆ SPI_LINES_MASK

#define SPI_LINES_MASK   (0x3 << 11)

◆ SPI_LINES_OCTAL

#define SPI_LINES_OCTAL   (3 << 11)

◆ SPI_LINES_QUAD

#define SPI_LINES_QUAD   (2 << 11)

◆ SPI_LINES_SINGLE

#define SPI_LINES_SINGLE   (0 << 11)

#include <include/drivers/spi.h>

SPI MISO lines.

Some controllers support dual, quad or octal MISO lines connected to slaves. Default is single, which is the case most of the time.

◆ SPI_LOCK_ON

#define SPI_LOCK_ON   BIT(14)

◆ SPI_MODE_CPHA

#define SPI_MODE_CPHA   BIT(2)

#include <include/drivers/spi.h>

Clock Phase: this dictates when is the data captured, and depends clock's polarity. When SPI_MODE_CPOL is set and this bit as well, capture will occur on low to high transition and high to low if this bit is not set (default). This is fully reversed if CPOL is not set.

◆ SPI_MODE_CPOL

#define SPI_MODE_CPOL   BIT(1)

#include <include/drivers/spi.h>

SPI Polarity & Phase Modes.

Clock Polarity: if set, clock idle state will be 1 and active state will be 0. If untouched, the inverse will be true which is the default.

◆ SPI_MODE_GET

#define SPI_MODE_GET (   _mode_)     ((_mode_) & SPI_MODE_MASK)

◆ SPI_MODE_LOOP

#define SPI_MODE_LOOP   BIT(3)

#include <include/drivers/spi.h>

Whatever data is transmitted is looped-back to the receiving buffer of the controller. This is fully controller dependent as some may not support this, and can be used for testing purposes only.

◆ SPI_MODE_MASK

#define SPI_MODE_MASK   (0xE)

◆ SPI_OP_MODE_GET

#define SPI_OP_MODE_GET (   _operation_)    ((_operation_) & SPI_OP_MODE_MASK)

◆ SPI_OP_MODE_MASK

#define SPI_OP_MODE_MASK   0x1

◆ SPI_OP_MODE_MASTER

#define SPI_OP_MODE_MASTER   0

#include <include/drivers/spi.h>

SPI operational mode.

◆ SPI_OP_MODE_SLAVE

#define SPI_OP_MODE_SLAVE   BIT(0)

◆ SPI_TRANSFER_LSB

#define SPI_TRANSFER_LSB   BIT(4)

◆ SPI_TRANSFER_MSB

#define SPI_TRANSFER_MSB   (0)

#include <include/drivers/spi.h>

SPI Transfer modes (host controller dependent)

◆ SPI_WORD_SET

#define SPI_WORD_SET (   _word_size_)     ((_word_size_) << SPI_WORD_SIZE_SHIFT)

◆ SPI_WORD_SIZE_GET

#define SPI_WORD_SIZE_GET (   _operation_)     (((_operation_) & SPI_WORD_SIZE_MASK) >> SPI_WORD_SIZE_SHIFT)

◆ SPI_WORD_SIZE_MASK

#define SPI_WORD_SIZE_MASK   (0x3F << SPI_WORD_SIZE_SHIFT)

◆ SPI_WORD_SIZE_SHIFT

#define SPI_WORD_SIZE_SHIFT   (5)

#include <include/drivers/spi.h>

SPI word size.

Typedef Documentation

◆ spi_api_io

spi_api_io

#include <include/drivers/spi.h>

Callback API for I/O See spi_transceive() for argument descriptions.

Callback API for asynchronous I/O See spi_transceive_async() for argument descriptions.

◆ spi_api_io_async

typedef int(* spi_api_io_async) (const struct device *dev, const struct spi_config *config, const struct spi_buf_set *tx_bufs, const struct spi_buf_set *rx_bufs, struct k_poll_signal *async)

◆ spi_api_release

spi_api_release

#include <include/drivers/spi.h>

Callback API for unlocking SPI device. See spi_release() for argument descriptions.

Function Documentation

◆ spi_is_ready()

static bool spi_is_ready ( const struct spi_dt_spec spec)
inlinestatic

#include <include/drivers/spi.h>

Validate that SPI bus is ready.

Parameters
specSPI specification from devicetree
Return values
trueif the SPI bus is ready for use.
falseif the SPI bus is not ready for use.

◆ spi_read()

static int spi_read ( const struct device dev,
const struct spi_config config,
const struct spi_buf_set rx_bufs 
)
inlinestatic

#include <include/drivers/spi.h>

Read the specified amount of data from the SPI driver.

Note
This function is synchronous.
This function is an helper function calling spi_transceive.
Parameters
devPointer to the device structure for the driver instance
configPointer to a valid spi_config structure instance. Pointer-comparison may be used to detect changes from previous operations.
rx_bufsBuffer array where data to be read will be written to.
Return values
0If successful.
-errnoNegative errno code on failure.

◆ spi_read_async()

static int spi_read_async ( const struct device dev,
const struct spi_config config,
const struct spi_buf_set rx_bufs,
struct k_poll_signal async 
)
inlinestatic

#include <include/drivers/spi.h>

Read the specified amount of data from the SPI driver.

Note
This function is asynchronous.
This function is an helper function calling spi_transceive_async.
This function is available only if
embed:rst:inline :kconfig:`CONFIG_SPI_ASYNC` 
is selected.
Parameters
devPointer to the device structure for the driver instance
configPointer to a valid spi_config structure instance. Pointer-comparison may be used to detect changes from previous operations.
rx_bufsBuffer array where data to be read will be written to.
asyncA pointer to a valid and ready to be signaled struct k_poll_signal. (Note: if NULL this function will not notify the end of the transaction, and whether it went successfully or not).
Return values
0If successful
-errnoNegative errno code on failure.

◆ spi_read_dt()

static int spi_read_dt ( const struct spi_dt_spec spec,
const struct spi_buf_set rx_bufs 
)
inlinestatic

#include <include/drivers/spi.h>

Read data from a SPI bus specified in spi_dt_spec.

This is equivalent to:

spi_read(spec->bus, &spec->config, rx_bufs);
Parameters
specSPI specification from devicetree
rx_bufsBuffer array where data to be read will be written to.
Returns
a value from spi_read().

◆ spi_release()

int spi_release ( const struct device dev,
const struct spi_config config 
)

#include <include/drivers/spi.h>

Release the SPI device locked on by the current config.

Note: This synchronous function is used to release the lock on the SPI device that was kept if, and if only, given config parameter was the last one to be used (in any of the above functions) and if it has the SPI_LOCK_ON bit set into its operation bits field. This can be used if the caller needs to keep its hand on the SPI device for consecutive transactions.

Parameters
devPointer to the device structure for the driver instance
configPointer to a valid spi_config structure instance. Pointer-comparison may be used to detect changes from previous operations.
Return values
0If successful.
-errnoNegative errno code on failure.

◆ spi_release_dt()

static int spi_release_dt ( const struct spi_dt_spec spec)
inlinestatic

#include <include/drivers/spi.h>

Release the SPI device specified in spi_dt_spec.

This is equivalent to:

spi_release(spec->bus, &spec->config);
Parameters
specSPI specification from devicetree
Returns
a value from spi_release().

◆ spi_transceive()

int spi_transceive ( const struct device dev,
const struct spi_config config,
const struct spi_buf_set tx_bufs,
const struct spi_buf_set rx_bufs 
)

#include <include/drivers/spi.h>

Read/write the specified amount of data from the SPI driver.

Note
This function is synchronous.
Parameters
devPointer to the device structure for the driver instance
configPointer to a valid spi_config structure instance. Pointer-comparison may be used to detect changes from previous operations.
tx_bufsBuffer array where data to be sent originates from, or NULL if none.
rx_bufsBuffer array where data to be read will be written to, or NULL if none.
Return values
framesPositive number of frames received in slave mode.
0If successful in master mode.
-errnoNegative errno code on failure.

◆ spi_transceive_async()

static int spi_transceive_async ( const struct device dev,
const struct spi_config config,
const struct spi_buf_set tx_bufs,
const struct spi_buf_set rx_bufs,
struct k_poll_signal async 
)
inlinestatic

#include <include/drivers/spi.h>

Read/write the specified amount of data from the SPI driver.

Note
This function is asynchronous.
This function is available only if
embed:rst:inline :kconfig:`CONFIG_SPI_ASYNC` 
is selected.
Parameters
devPointer to the device structure for the driver instance
configPointer to a valid spi_config structure instance. Pointer-comparison may be used to detect changes from previous operations.
tx_bufsBuffer array where data to be sent originates from, or NULL if none.
rx_bufsBuffer array where data to be read will be written to, or NULL if none.
asyncA pointer to a valid and ready to be signaled struct k_poll_signal. (Note: if NULL this function will not notify the end of the transaction, and whether it went successfully or not).
Return values
framesPositive number of frames received in slave mode.
0If successful in master mode.
-errnoNegative errno code on failure.

◆ spi_transceive_dt()

static int spi_transceive_dt ( const struct spi_dt_spec spec,
const struct spi_buf_set tx_bufs,
const struct spi_buf_set rx_bufs 
)
inlinestatic

#include <include/drivers/spi.h>

Read/write data from an SPI bus specified in spi_dt_spec.

This is equivalent to:

spi_transceive(spec->bus, &spec->config, tx_bufs, rx_bufs);
Parameters
specSPI specification from devicetree
tx_bufsBuffer array where data to be sent originates from, or NULL if none.
rx_bufsBuffer array where data to be read will be written to, or NULL if none.
Returns
a value from spi_transceive().

◆ spi_write()

static int spi_write ( const struct device dev,
const struct spi_config config,
const struct spi_buf_set tx_bufs 
)
inlinestatic

#include <include/drivers/spi.h>

Write the specified amount of data from the SPI driver.

Note
This function is synchronous.
This function is an helper function calling spi_transceive.
Parameters
devPointer to the device structure for the driver instance
configPointer to a valid spi_config structure instance. Pointer-comparison may be used to detect changes from previous operations.
tx_bufsBuffer array where data to be sent originates from.
Return values
0If successful.
-errnoNegative errno code on failure.

◆ spi_write_async()

static int spi_write_async ( const struct device dev,
const struct spi_config config,
const struct spi_buf_set tx_bufs,
struct k_poll_signal async 
)
inlinestatic

#include <include/drivers/spi.h>

Write the specified amount of data from the SPI driver.

Note
This function is asynchronous.
This function is an helper function calling spi_transceive_async.
This function is available only if
embed:rst:inline :kconfig:`CONFIG_SPI_ASYNC` 
is selected.
Parameters
devPointer to the device structure for the driver instance
configPointer to a valid spi_config structure instance. Pointer-comparison may be used to detect changes from previous operations.
tx_bufsBuffer array where data to be sent originates from.
asyncA pointer to a valid and ready to be signaled struct k_poll_signal. (Note: if NULL this function will not notify the end of the transaction, and whether it went successfully or not).
Return values
0If successful.
-errnoNegative errno code on failure.

◆ spi_write_dt()

static int spi_write_dt ( const struct spi_dt_spec spec,
const struct spi_buf_set tx_bufs 
)
inlinestatic

#include <include/drivers/spi.h>

Write data to a SPI bus specified in spi_dt_spec.

This is equivalent to:

spi_write(spec->bus, &spec->config, tx_bufs);
Parameters
specSPI specification from devicetree
tx_bufsBuffer array where data to be sent originates from.
Returns
a value from spi_write().