nRF Connect SDK Bare Metal API 2.0.99
Loading...
Searching...
No Matches

◆ bm_spi_mngr_schedule()

int bm_spi_mngr_schedule ( struct bm_spi_mngr * mgr,
const struct bm_spi_mngr_transaction * transaction )

#include <bm_spi_mngr.h>

Schedule an SPI transaction.

The transaction is enqueued and started as soon as the SPI bus is available, thus when all previously scheduled transactions have been finished (possibly immediately).

If bm_spi_mngr_transaction::required_spim_cfg is set to a non-NULL value, the module compares it with the current configuration and reinitializes the SPIM instance with the new parameters if any differences are found. If bm_spi_mngr_transaction::required_spim_cfg is NULL, the default configuration passed to bm_spi_mngr_init is used instead.

The queue stores only a pointer to transaction, not a copy. The caller must keep transaction and its transfers array valid until the transaction completes (until end_callback runs).

Parameters
[in]mgrSPI transaction manager instance.
[in]transactionDescriptor of the transaction to be scheduled.
Return values
0On success.
-EFAULTIf mgr, transaction, or its transfers array is NULL.
-EINVALIf the transaction has zero transfers.
-ENOMEMIf the queue is full.