RTEMS 6.1-rc6
Loading...
Searching...
No Matches
Data Structures
Lpspi_driver

Data Structures

struct  _lpspi_master_config
 LPSPI master configuration structure. More...
 
struct  _lpspi_slave_config
 LPSPI slave configuration structure. More...
 
struct  _lpspi_transfer
 LPSPI master/slave transfer structure. More...
 
struct  _lpspi_master_handle
 LPSPI master transfer handle structure used for transactional API. More...
 
struct  _lpspi_slave_handle
 LPSPI slave transfer handle structure used for transactional API. More...
 

Driver version

enum  {
  kStatus_LPSPI_Busy = MAKE_STATUS(kStatusGroup_LPSPI, 0) , kStatus_LPSPI_Error = MAKE_STATUS(kStatusGroup_LPSPI, 1) , kStatus_LPSPI_Idle = MAKE_STATUS(kStatusGroup_LPSPI, 2) , kStatus_LPSPI_OutOfRange = MAKE_STATUS(kStatusGroup_LPSPI, 3) ,
  kStatus_LPSPI_Timeout = MAKE_STATUS(kStatusGroup_LPSPI, 4)
}
 Status for the LPSPI driver. More...
 
enum  _lpspi_flags {
  kLPSPI_TxDataRequestFlag = LPSPI_SR_TDF_MASK , kLPSPI_RxDataReadyFlag = LPSPI_SR_RDF_MASK , kLPSPI_WordCompleteFlag = LPSPI_SR_WCF_MASK , kLPSPI_FrameCompleteFlag = LPSPI_SR_FCF_MASK ,
  kLPSPI_TransferCompleteFlag = LPSPI_SR_TCF_MASK , kLPSPI_TransmitErrorFlag = LPSPI_SR_TEF_MASK , kLPSPI_ReceiveErrorFlag = LPSPI_SR_REF_MASK , kLPSPI_DataMatchFlag = LPSPI_SR_DMF_MASK ,
  kLPSPI_ModuleBusyFlag = LPSPI_SR_MBF_MASK , kLPSPI_AllStatusFlag
}
 LPSPI status flags in SPIx_SR register. More...
 
enum  _lpspi_interrupt_enable {
  kLPSPI_TxInterruptEnable = LPSPI_IER_TDIE_MASK , kLPSPI_RxInterruptEnable = LPSPI_IER_RDIE_MASK , kLPSPI_WordCompleteInterruptEnable = LPSPI_IER_WCIE_MASK , kLPSPI_FrameCompleteInterruptEnable = LPSPI_IER_FCIE_MASK ,
  kLPSPI_TransferCompleteInterruptEnable = LPSPI_IER_TCIE_MASK , kLPSPI_TransmitErrorInterruptEnable = LPSPI_IER_TEIE_MASK , kLPSPI_ReceiveErrorInterruptEnable = LPSPI_IER_REIE_MASK , kLPSPI_DataMatchInterruptEnable = LPSPI_IER_DMIE_MASK ,
  kLPSPI_AllInterruptEnable
}
 LPSPI interrupt source. More...
 
enum  _lpspi_dma_enable { kLPSPI_TxDmaEnable = LPSPI_DER_TDDE_MASK , kLPSPI_RxDmaEnable = LPSPI_DER_RDDE_MASK }
 LPSPI DMA source. More...
 
enum  _lpspi_master_slave_mode { kLPSPI_Master = 1U , kLPSPI_Slave = 0U }
 LPSPI master or slave mode configuration. More...
 
enum  _lpspi_which_pcs_config { kLPSPI_Pcs0 = 0U , kLPSPI_Pcs1 = 1U , kLPSPI_Pcs2 = 2U , kLPSPI_Pcs3 = 3U }
 LPSPI Peripheral Chip Select (PCS) configuration (which PCS to configure). More...
 
enum  _lpspi_pcs_polarity_config { kLPSPI_PcsActiveHigh = 1U , kLPSPI_PcsActiveLow = 0U }
 LPSPI Peripheral Chip Select (PCS) Polarity configuration. More...
 
enum  _lpspi_pcs_polarity {
  kLPSPI_Pcs0ActiveLow = 1U << 0 , kLPSPI_Pcs1ActiveLow = 1U << 1 , kLPSPI_Pcs2ActiveLow = 1U << 2 , kLPSPI_Pcs3ActiveLow = 1U << 3 ,
  kLPSPI_PcsAllActiveLow = 0xFU
}
 LPSPI Peripheral Chip Select (PCS) Polarity. More...
 
enum  _lpspi_clock_polarity { kLPSPI_ClockPolarityActiveHigh = 0U , kLPSPI_ClockPolarityActiveLow = 1U }
 LPSPI clock polarity configuration. More...
 
enum  _lpspi_clock_phase { kLPSPI_ClockPhaseFirstEdge = 0U , kLPSPI_ClockPhaseSecondEdge = 1U }
 LPSPI clock phase configuration. More...
 
enum  _lpspi_shift_direction { kLPSPI_MsbFirst = 0U , kLPSPI_LsbFirst = 1U }
 LPSPI data shifter direction options. More...
 
enum  _lpspi_host_request_select { kLPSPI_HostReqExtPin = 0U , kLPSPI_HostReqInternalTrigger = 1U }
 LPSPI Host Request select configuration. More...
 
enum  _lpspi_match_config {
  kLPSI_MatchDisabled = 0x0U , kLPSI_1stWordEqualsM0orM1 = 0x2U , kLPSI_AnyWordEqualsM0orM1 = 0x3U , kLPSI_1stWordEqualsM0and2ndWordEqualsM1 = 0x4U ,
  kLPSI_AnyWordEqualsM0andNxtWordEqualsM1 = 0x5U , kLPSI_1stWordAndM1EqualsM0andM1 = 0x6U , kLPSI_AnyWordAndM1EqualsM0andM1 = 0x7U
}
 LPSPI Match configuration options. More...
 
enum  _lpspi_pin_config { kLPSPI_SdiInSdoOut = 0U , kLPSPI_SdiInSdiOut = 1U , kLPSPI_SdoInSdoOut = 2U , kLPSPI_SdoInSdiOut = 3U }
 LPSPI pin (SDO and SDI) configuration. More...
 
enum  _lpspi_data_out_config { kLpspiDataOutRetained = 0U , kLpspiDataOutTristate = 1U }
 LPSPI data output configuration. More...
 
enum  _lpspi_transfer_width { kLPSPI_SingleBitXfer = 0U , kLPSPI_TwoBitXfer = 1U , kLPSPI_FourBitXfer = 2U }
 LPSPI transfer width configuration. More...
 
enum  _lpspi_delay_type { kLPSPI_PcsToSck = 1U , kLPSPI_LastSckToPcs , kLPSPI_BetweenTransfer }
 LPSPI delay type selection. More...
 
enum  _lpspi_transfer_config_flag_for_master {
  kLPSPI_MasterPcs0 = 0U << LPSPI_MASTER_PCS_SHIFT , kLPSPI_MasterPcs1 = 1U << LPSPI_MASTER_PCS_SHIFT , kLPSPI_MasterPcs2 = 2U << LPSPI_MASTER_PCS_SHIFT , kLPSPI_MasterPcs3 = 3U << LPSPI_MASTER_PCS_SHIFT ,
  kLPSPI_MasterPcsContinuous = 1U << 20 , kLPSPI_MasterByteSwap
}
 Use this enumeration for LPSPI master transfer configFlags. More...
 
enum  _lpspi_transfer_config_flag_for_slave {
  kLPSPI_SlavePcs0 = 0U << LPSPI_SLAVE_PCS_SHIFT , kLPSPI_SlavePcs1 = 1U << LPSPI_SLAVE_PCS_SHIFT , kLPSPI_SlavePcs2 = 2U << LPSPI_SLAVE_PCS_SHIFT , kLPSPI_SlavePcs3 = 3U << LPSPI_SLAVE_PCS_SHIFT ,
  kLPSPI_SlaveByteSwap
}
 Use this enumeration for LPSPI slave transfer configFlags. More...
 
enum  _lpspi_transfer_state { kLPSPI_Idle = 0x0U , kLPSPI_Busy , kLPSPI_Error }
 LPSPI transfer state, which is used for LPSPI transactional API state machine. More...
 
typedef enum _lpspi_master_slave_mode lpspi_master_slave_mode_t
 LPSPI master or slave mode configuration.
 
typedef enum _lpspi_which_pcs_config lpspi_which_pcs_t
 LPSPI Peripheral Chip Select (PCS) configuration (which PCS to configure).
 
typedef enum _lpspi_pcs_polarity_config lpspi_pcs_polarity_config_t
 LPSPI Peripheral Chip Select (PCS) Polarity configuration.
 
typedef enum _lpspi_clock_polarity lpspi_clock_polarity_t
 LPSPI clock polarity configuration.
 
typedef enum _lpspi_clock_phase lpspi_clock_phase_t
 LPSPI clock phase configuration.
 
typedef enum _lpspi_shift_direction lpspi_shift_direction_t
 LPSPI data shifter direction options.
 
typedef enum _lpspi_host_request_select lpspi_host_request_select_t
 LPSPI Host Request select configuration.
 
typedef enum _lpspi_match_config lpspi_match_config_t
 LPSPI Match configuration options.
 
typedef enum _lpspi_pin_config lpspi_pin_config_t
 LPSPI pin (SDO and SDI) configuration.
 
typedef enum _lpspi_data_out_config lpspi_data_out_config_t
 LPSPI data output configuration.
 
typedef enum _lpspi_transfer_width lpspi_transfer_width_t
 LPSPI transfer width configuration.
 
typedef enum _lpspi_delay_type lpspi_delay_type_t
 LPSPI delay type selection.
 
typedef struct _lpspi_master_config lpspi_master_config_t
 LPSPI master configuration structure.
 
typedef struct _lpspi_slave_config lpspi_slave_config_t
 LPSPI slave configuration structure.
 
typedef struct _lpspi_master_handle lpspi_master_handle_t
 Forward declaration of the _lpspi_master_handle typedefs.
 
typedef struct _lpspi_slave_handle lpspi_slave_handle_t
 Forward declaration of the _lpspi_slave_handle typedefs.
 
typedef void(* lpspi_master_transfer_callback_t) (LPSPI_Type *base, lpspi_master_handle_t *handle, status_t status, void *userData)
 Master completion callback function pointer type.
 
typedef void(* lpspi_slave_transfer_callback_t) (LPSPI_Type *base, lpspi_slave_handle_t *handle, status_t status, void *userData)
 Slave completion callback function pointer type.
 
typedef struct _lpspi_transfer lpspi_transfer_t
 LPSPI master/slave transfer structure.
 
volatile uint8_t g_lpspiDummyData []
 Global variable for dummy data value setting.
 
#define FSL_LPSPI_DRIVER_VERSION   (MAKE_VERSION(2, 4, 0))
 LPSPI driver version.
 
#define LPSPI_DUMMY_DATA   (0x00U)
 LPSPI dummy data if no Tx data.
 
#define SPI_RETRY_TIMES   0U /* Define to zero means keep waiting until the flag is assert/deassert. */
 Retry times for waiting flag.
 
#define LPSPI_MASTER_PCS_SHIFT   (4U)
 
#define LPSPI_MASTER_PCS_MASK   (0xF0U)
 
#define LPSPI_SLAVE_PCS_SHIFT   (4U)
 
#define LPSPI_SLAVE_PCS_MASK   (0xF0U)
 

Initialization and deinitialization

void LPSPI_MasterInit (LPSPI_Type *base, const lpspi_master_config_t *masterConfig, uint32_t srcClock_Hz)
 Initializes the LPSPI master.
 
void LPSPI_MasterGetDefaultConfig (lpspi_master_config_t *masterConfig)
 Sets the lpspi_master_config_t structure to default values.
 
void LPSPI_SlaveInit (LPSPI_Type *base, const lpspi_slave_config_t *slaveConfig)
 LPSPI slave configuration.
 
void LPSPI_SlaveGetDefaultConfig (lpspi_slave_config_t *slaveConfig)
 Sets the lpspi_slave_config_t structure to default values.
 
void LPSPI_Deinit (LPSPI_Type *base)
 De-initializes the LPSPI peripheral. Call this API to disable the LPSPI clock.
 
void LPSPI_Reset (LPSPI_Type *base)
 Restores the LPSPI peripheral to reset state. Note that this function sets all registers to reset state. As a result, the LPSPI module can't work after calling this API.
 
uint32_t LPSPI_GetInstance (LPSPI_Type *base)
 Get the LPSPI instance from peripheral base address.
 

Bus Operations

bool LPSPI_CheckTransferArgument (LPSPI_Type *base, lpspi_transfer_t *transfer, bool isEdma)
 Check the argument for transfer .
 
uint32_t LPSPI_MasterSetBaudRate (LPSPI_Type *base, uint32_t baudRate_Bps, uint32_t srcClock_Hz, uint32_t *tcrPrescaleValue)
 Sets the LPSPI baud rate in bits per second.
 
void LPSPI_MasterSetDelayScaler (LPSPI_Type *base, uint32_t scaler, lpspi_delay_type_t whichDelay)
 Manually configures a specific LPSPI delay parameter (module must be disabled to change the delay values).
 
uint32_t LPSPI_MasterSetDelayTimes (LPSPI_Type *base, uint32_t delayTimeInNanoSec, lpspi_delay_type_t whichDelay, uint32_t srcClock_Hz)
 Calculates the delay based on the desired delay input in nanoseconds (module must be disabled to change the delay values).
 
void LPSPI_SetDummyData (LPSPI_Type *base, uint8_t dummyData)
 Set up the dummy data.
 

Transactional

void LPSPI_MasterTransferCreateHandle (LPSPI_Type *base, lpspi_master_handle_t *handle, lpspi_master_transfer_callback_t callback, void *userData)
 Initializes the LPSPI master handle.
 
status_t LPSPI_MasterTransferBlocking (LPSPI_Type *base, lpspi_transfer_t *transfer)
 LPSPI master transfer data using a polling method.
 
status_t LPSPI_MasterTransferNonBlocking (LPSPI_Type *base, lpspi_master_handle_t *handle, lpspi_transfer_t *transfer)
 LPSPI master transfer data using an interrupt method.
 
status_t LPSPI_MasterTransferGetCount (LPSPI_Type *base, lpspi_master_handle_t *handle, size_t *count)
 Gets the master transfer remaining bytes.
 
void LPSPI_MasterTransferAbort (LPSPI_Type *base, lpspi_master_handle_t *handle)
 LPSPI master abort transfer which uses an interrupt method.
 
void LPSPI_MasterTransferHandleIRQ (LPSPI_Type *base, lpspi_master_handle_t *handle)
 LPSPI Master IRQ handler function.
 
void LPSPI_SlaveTransferCreateHandle (LPSPI_Type *base, lpspi_slave_handle_t *handle, lpspi_slave_transfer_callback_t callback, void *userData)
 Initializes the LPSPI slave handle.
 
status_t LPSPI_SlaveTransferNonBlocking (LPSPI_Type *base, lpspi_slave_handle_t *handle, lpspi_transfer_t *transfer)
 LPSPI slave transfer data using an interrupt method.
 
status_t LPSPI_SlaveTransferGetCount (LPSPI_Type *base, lpspi_slave_handle_t *handle, size_t *count)
 Gets the slave transfer remaining bytes.
 
void LPSPI_SlaveTransferAbort (LPSPI_Type *base, lpspi_slave_handle_t *handle)
 LPSPI slave aborts a transfer which uses an interrupt method.
 
void LPSPI_SlaveTransferHandleIRQ (LPSPI_Type *base, lpspi_slave_handle_t *handle)
 LPSPI Slave IRQ handler function.
 

Detailed Description

Macro Definition Documentation

◆ LPSPI_DUMMY_DATA

#define LPSPI_DUMMY_DATA   (0x00U)

LPSPI dummy data if no Tx data.

Dummy data used for tx if there is not txData.

◆ LPSPI_MASTER_PCS_MASK

#define LPSPI_MASTER_PCS_MASK   (0xF0U)

LPSPI master PCS shift macro , internal used.

◆ LPSPI_MASTER_PCS_SHIFT

#define LPSPI_MASTER_PCS_SHIFT   (4U)

LPSPI master PCS shift macro , internal used.

◆ LPSPI_SLAVE_PCS_MASK

#define LPSPI_SLAVE_PCS_MASK   (0xF0U)

LPSPI slave PCS shift macro , internal used.

◆ LPSPI_SLAVE_PCS_SHIFT

#define LPSPI_SLAVE_PCS_SHIFT   (4U)

LPSPI slave PCS shift macro , internal used.

Typedef Documentation

◆ lpspi_master_transfer_callback_t

typedef void(* lpspi_master_transfer_callback_t) (LPSPI_Type *base, lpspi_master_handle_t *handle, status_t status, void *userData)

Master completion callback function pointer type.

Parameters
baseLPSPI peripheral address.
handlePointer to the handle for the LPSPI master.
statusSuccess or error code describing whether the transfer is completed.
userDataArbitrary pointer-dataSized value passed from the application.

◆ lpspi_slave_transfer_callback_t

typedef void(* lpspi_slave_transfer_callback_t) (LPSPI_Type *base, lpspi_slave_handle_t *handle, status_t status, void *userData)

Slave completion callback function pointer type.

Parameters
baseLPSPI peripheral address.
handlePointer to the handle for the LPSPI slave.
statusSuccess or error code describing whether the transfer is completed.
userDataArbitrary pointer-dataSized value passed from the application.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Status for the LPSPI driver.

Enumerator
kStatus_LPSPI_Busy 

LPSPI transfer is busy.

kStatus_LPSPI_Error 

LPSPI driver error.

kStatus_LPSPI_Idle 

LPSPI is idle.

kStatus_LPSPI_OutOfRange 

LPSPI transfer out Of range.

kStatus_LPSPI_Timeout 

LPSPI timeout polling status flags.

◆ _lpspi_clock_phase

LPSPI clock phase configuration.

Enumerator
kLPSPI_ClockPhaseFirstEdge 

CPHA=0. Data is captured on the leading edge of the SCK and changed on the following edge.

kLPSPI_ClockPhaseSecondEdge 

CPHA=1. Data is changed on the leading edge of the SCK and captured on the following edge.

◆ _lpspi_clock_polarity

LPSPI clock polarity configuration.

Enumerator
kLPSPI_ClockPolarityActiveHigh 

CPOL=0. Active-high LPSPI clock (idles low)

kLPSPI_ClockPolarityActiveLow 

CPOL=1. Active-low LPSPI clock (idles high)

◆ _lpspi_data_out_config

LPSPI data output configuration.

Enumerator
kLpspiDataOutRetained 

Data out retains last value when chip select is de-asserted

kLpspiDataOutTristate 

Data out is tristated when chip select is de-asserted

◆ _lpspi_delay_type

LPSPI delay type selection.

Enumerator
kLPSPI_PcsToSck 

PCS-to-SCK delay.

kLPSPI_LastSckToPcs 

Last SCK edge to PCS delay.

kLPSPI_BetweenTransfer 

Delay between transfers.

◆ _lpspi_dma_enable

LPSPI DMA source.

Enumerator
kLPSPI_TxDmaEnable 

Transmit data DMA enable

kLPSPI_RxDmaEnable 

Receive data DMA enable

◆ _lpspi_flags

LPSPI status flags in SPIx_SR register.

Enumerator
kLPSPI_TxDataRequestFlag 

Transmit data flag

kLPSPI_RxDataReadyFlag 

Receive data flag

kLPSPI_WordCompleteFlag 

Word Complete flag

kLPSPI_FrameCompleteFlag 

Frame Complete flag

kLPSPI_TransferCompleteFlag 

Transfer Complete flag

kLPSPI_TransmitErrorFlag 

Transmit Error flag (FIFO underrun)

kLPSPI_ReceiveErrorFlag 

Receive Error flag (FIFO overrun)

kLPSPI_DataMatchFlag 

Data Match flag

kLPSPI_ModuleBusyFlag 

Module Busy flag

kLPSPI_AllStatusFlag 

Used for clearing all w1c status flags

◆ _lpspi_host_request_select

LPSPI Host Request select configuration.

Enumerator
kLPSPI_HostReqExtPin 

Host Request is an ext pin.

kLPSPI_HostReqInternalTrigger 

Host Request is an internal trigger.

◆ _lpspi_interrupt_enable

LPSPI interrupt source.

Enumerator
kLPSPI_TxInterruptEnable 

Transmit data interrupt enable

kLPSPI_RxInterruptEnable 

Receive data interrupt enable

kLPSPI_WordCompleteInterruptEnable 

Word complete interrupt enable

kLPSPI_FrameCompleteInterruptEnable 

Frame complete interrupt enable

kLPSPI_TransferCompleteInterruptEnable 

Transfer complete interrupt enable

kLPSPI_TransmitErrorInterruptEnable 

Transmit error interrupt enable(FIFO underrun)

kLPSPI_ReceiveErrorInterruptEnable 

Receive Error interrupt enable (FIFO overrun)

kLPSPI_DataMatchInterruptEnable 

Data Match interrupt enable

kLPSPI_AllInterruptEnable 

All above interrupts enable.

◆ _lpspi_master_slave_mode

LPSPI master or slave mode configuration.

Enumerator
kLPSPI_Master 

LPSPI peripheral operates in master mode.

kLPSPI_Slave 

LPSPI peripheral operates in slave mode.

◆ _lpspi_match_config

LPSPI Match configuration options.

Enumerator
kLPSI_MatchDisabled 

LPSPI Match Disabled.

kLPSI_1stWordEqualsM0orM1 

LPSPI Match Enabled.

kLPSI_AnyWordEqualsM0orM1 

LPSPI Match Enabled.

kLPSI_1stWordEqualsM0and2ndWordEqualsM1 

LPSPI Match Enabled.

kLPSI_AnyWordEqualsM0andNxtWordEqualsM1 

LPSPI Match Enabled.

kLPSI_1stWordAndM1EqualsM0andM1 

LPSPI Match Enabled.

kLPSI_AnyWordAndM1EqualsM0andM1 

LPSPI Match Enabled.

◆ _lpspi_pcs_polarity

LPSPI Peripheral Chip Select (PCS) Polarity.

Enumerator
kLPSPI_Pcs0ActiveLow 

Pcs0 Active Low (idles high).

kLPSPI_Pcs1ActiveLow 

Pcs1 Active Low (idles high).

kLPSPI_Pcs2ActiveLow 

Pcs2 Active Low (idles high).

kLPSPI_Pcs3ActiveLow 

Pcs3 Active Low (idles high).

kLPSPI_PcsAllActiveLow 

Pcs0 to Pcs5 Active Low (idles high).

◆ _lpspi_pcs_polarity_config

LPSPI Peripheral Chip Select (PCS) Polarity configuration.

Enumerator
kLPSPI_PcsActiveHigh 

PCS Active High (idles low)

kLPSPI_PcsActiveLow 

PCS Active Low (idles high)

◆ _lpspi_pin_config

LPSPI pin (SDO and SDI) configuration.

Enumerator
kLPSPI_SdiInSdoOut 

LPSPI SDI input, SDO output.

kLPSPI_SdiInSdiOut 

LPSPI SDI input, SDI output.

kLPSPI_SdoInSdoOut 

LPSPI SDO input, SDO output.

kLPSPI_SdoInSdiOut 

LPSPI SDO input, SDI output.

◆ _lpspi_shift_direction

LPSPI data shifter direction options.

Enumerator
kLPSPI_MsbFirst 

Data transfers start with most significant bit.

kLPSPI_LsbFirst 

Data transfers start with least significant bit.

◆ _lpspi_transfer_config_flag_for_master

Use this enumeration for LPSPI master transfer configFlags.

Enumerator
kLPSPI_MasterPcs0 

LPSPI master transfer use PCS0 signal

kLPSPI_MasterPcs1 

LPSPI master transfer use PCS1 signal

kLPSPI_MasterPcs2 

LPSPI master transfer use PCS2 signal

kLPSPI_MasterPcs3 

LPSPI master transfer use PCS3 signal

kLPSPI_MasterPcsContinuous 

Is PCS signal continuous

kLPSPI_MasterByteSwap 

Is master swap the byte. For example, when want to send data 1 2 3 4 5 6 7 8 (suppose you set lpspi_shift_direction_t to MSB).

  1. If you set bitPerFrame = 8 , no matter the kLPSPI_MasterByteSwapyou flag is used or not, the waveform is 1 2 3 4 5 6 7 8.
  2. If you set bitPerFrame = 16 : (1) the waveform is 2 1 4 3 6 5 8 7 if you do not use the kLPSPI_MasterByteSwap flag. (2) the waveform is 1 2 3 4 5 6 7 8 if you use the kLPSPI_MasterByteSwap flag.
  3. If you set bitPerFrame = 32 : (1) the waveform is 4 3 2 1 8 7 6 5 if you do not use the kLPSPI_MasterByteSwap flag. (2) the waveform is 1 2 3 4 5 6 7 8 if you use the kLPSPI_MasterByteSwap flag.

◆ _lpspi_transfer_config_flag_for_slave

Use this enumeration for LPSPI slave transfer configFlags.

Enumerator
kLPSPI_SlavePcs0 

LPSPI slave transfer use PCS0 signal

kLPSPI_SlavePcs1 

LPSPI slave transfer use PCS1 signal

kLPSPI_SlavePcs2 

LPSPI slave transfer use PCS2 signal

kLPSPI_SlavePcs3 

LPSPI slave transfer use PCS3 signal

kLPSPI_SlaveByteSwap 

Is slave swap the byte. For example, when want to send data 1 2 3 4 5 6 7 8 (suppose you set lpspi_shift_direction_t to MSB).

  1. If you set bitPerFrame = 8 , no matter the kLPSPI_SlaveByteSwap flag is used or not, the waveform is 1 2 3 4 5 6 7 8.
  2. If you set bitPerFrame = 16 : (1) the waveform is 2 1 4 3 6 5 8 7 if you do not use the kLPSPI_SlaveByteSwap flag. (2) the waveform is 1 2 3 4 5 6 7 8 if you use the kLPSPI_SlaveByteSwap flag.
  3. If you set bitPerFrame = 32 : (1) the waveform is 4 3 2 1 8 7 6 5 if you do not use the kLPSPI_SlaveByteSwap flag. (2) the waveform is 1 2 3 4 5 6 7 8 if you use the kLPSPI_SlaveByteSwap flag.

◆ _lpspi_transfer_state

LPSPI transfer state, which is used for LPSPI transactional API state machine.

Enumerator
kLPSPI_Idle 

Nothing in the transmitter/receiver.

kLPSPI_Busy 

Transfer queue is not finished.

kLPSPI_Error 

Transfer error.

◆ _lpspi_transfer_width

LPSPI transfer width configuration.

Enumerator
kLPSPI_SingleBitXfer 

1-bit shift at a time, data out on SDO, in on SDI (normal mode)

kLPSPI_TwoBitXfer 

2-bits shift out on SDO/SDI and in on SDO/SDI

kLPSPI_FourBitXfer 

4-bits shift out on SDO/SDI/PCS[3:2] and in on SDO/SDI/PCS[3:2]

◆ _lpspi_which_pcs_config

LPSPI Peripheral Chip Select (PCS) configuration (which PCS to configure).

Enumerator
kLPSPI_Pcs0 

PCS[0]

kLPSPI_Pcs1 

PCS[1]

kLPSPI_Pcs2 

PCS[2]

kLPSPI_Pcs3 

PCS[3]

Function Documentation

◆ LPSPI_CheckTransferArgument()

bool LPSPI_CheckTransferArgument ( LPSPI_Type base,
lpspi_transfer_t transfer,
bool  isEdma 
)

Check the argument for transfer .

Parameters
baseLPSPI peripheral address.
transferthe transfer struct to be used.
isEdmaTrue to check for EDMA transfer, false to check interrupt non-blocking transfer
Returns
Return true for right and false for wrong.

brief Check the argument for transfer .

param base LPSPI peripheral address. param transfer the transfer struct to be used. param isEdma True to check for EDMA transfer, false to check interrupt non-blocking transfer return Return true for right and false for wrong.

◆ LPSPI_Deinit()

void LPSPI_Deinit ( LPSPI_Type base)

De-initializes the LPSPI peripheral. Call this API to disable the LPSPI clock.

Parameters
baseLPSPI peripheral address.

brief De-initializes the LPSPI peripheral. Call this API to disable the LPSPI clock. param base LPSPI peripheral address.

◆ LPSPI_GetInstance()

uint32_t LPSPI_GetInstance ( LPSPI_Type base)

Get the LPSPI instance from peripheral base address.

Parameters
baseLPSPI peripheral base address.
Returns
LPSPI instance.

brief Get the LPSPI instance from peripheral base address.

param base LPSPI peripheral base address. return LPSPI instance.

◆ LPSPI_MasterGetDefaultConfig()

void LPSPI_MasterGetDefaultConfig ( lpspi_master_config_t masterConfig)

Sets the lpspi_master_config_t structure to default values.

This API initializes the configuration structure for LPSPI_MasterInit(). The initialized structure can remain unchanged in LPSPI_MasterInit(), or can be modified before calling the LPSPI_MasterInit(). Example:

lpspi_master_config_t masterConfig;
void LPSPI_MasterGetDefaultConfig(lpspi_master_config_t *masterConfig)
Sets the lpspi_master_config_t structure to default values.
Definition: fsl_lpspi.c:323
LPSPI master configuration structure.
Definition: fsl_lpspi.h:262
Parameters
masterConfigpointer to lpspi_master_config_t structure

brief Sets the lpspi_master_config_t structure to default values.

This API initializes the configuration structure for LPSPI_MasterInit(). The initialized structure can remain unchanged in LPSPI_MasterInit(), or can be modified before calling the LPSPI_MasterInit(). Example: code lpspi_master_config_t masterConfig; LPSPI_MasterGetDefaultConfig(&masterConfig); endcode param masterConfig pointer to lpspi_master_config_t structure

◆ LPSPI_MasterInit()

void LPSPI_MasterInit ( LPSPI_Type base,
const lpspi_master_config_t masterConfig,
uint32_t  srcClock_Hz 
)

Initializes the LPSPI master.

Parameters
baseLPSPI peripheral address.
masterConfigPointer to structure lpspi_master_config_t.
srcClock_HzModule source input clock in Hertz

brief Initializes the LPSPI master.

param base LPSPI peripheral address. param masterConfig Pointer to structure lpspi_master_config_t. param srcClock_Hz Module source input clock in Hertz

◆ LPSPI_MasterSetBaudRate()

uint32_t LPSPI_MasterSetBaudRate ( LPSPI_Type base,
uint32_t  baudRate_Bps,
uint32_t  srcClock_Hz,
uint32_t *  tcrPrescaleValue 
)

Sets the LPSPI baud rate in bits per second.

This function takes in the desired bitsPerSec (baud rate) and calculates the nearest possible baud rate without exceeding the desired baud rate and returns the calculated baud rate in bits-per-second. It requires the caller to provide the frequency of the module source clock (in Hertz). Note that the baud rate does not go into effect until the Transmit Control Register (TCR) is programmed with the prescale value. Hence, this function returns the prescale tcrPrescaleValue parameter for later programming in the TCR. The higher level peripheral driver should alert the user of an out of range baud rate input.

Note that the LPSPI module must first be disabled before configuring this. Note that the LPSPI module must be configured for master mode before configuring this.

Parameters
baseLPSPI peripheral address.
baudRate_BpsThe desired baud rate in bits per second.
srcClock_HzModule source input clock in Hertz.
tcrPrescaleValueThe TCR prescale value needed to program the TCR.
Returns
The actual calculated baud rate. This function may also return a "0" if the LPSPI is not configured for master mode or if the LPSPI module is not disabled.

brief Sets the LPSPI baud rate in bits per second.

This function takes in the desired bitsPerSec (baud rate) and calculates the nearest possible baud rate without exceeding the desired baud rate and returns the calculated baud rate in bits-per-second. It requires the caller to provide the frequency of the module source clock (in Hertz). Note that the baud rate does not go into effect until the Transmit Control Register (TCR) is programmed with the prescale value. Hence, this function returns the prescale tcrPrescaleValue parameter for later programming in the TCR. The higher level peripheral driver should alert the user of an out of range baud rate input.

Note that the LPSPI module must first be disabled before configuring this. Note that the LPSPI module must be configured for master mode before configuring this.

param base LPSPI peripheral address. param baudRate_Bps The desired baud rate in bits per second. param srcClock_Hz Module source input clock in Hertz. param tcrPrescaleValue The TCR prescale value needed to program the TCR. return The actual calculated baud rate. This function may also return a "0" if the LPSPI is not configured for master mode or if the LPSPI module is not disabled.

◆ LPSPI_MasterSetDelayScaler()

void LPSPI_MasterSetDelayScaler ( LPSPI_Type base,
uint32_t  scaler,
lpspi_delay_type_t  whichDelay 
)

Manually configures a specific LPSPI delay parameter (module must be disabled to change the delay values).

This function configures the following: SCK to PCS delay, or PCS to SCK delay, or The configurations must occur between the transfer delay.

The delay names are available in type lpspi_delay_type_t.

The user passes the desired delay along with the delay value. This allows the user to directly set the delay values if they have pre-calculated them or if they simply wish to manually increment the value.

Note that the LPSPI module must first be disabled before configuring this. Note that the LPSPI module must be configured for master mode before configuring this.

Parameters
baseLPSPI peripheral address.
scalerThe 8-bit delay value 0x00 to 0xFF (255).
whichDelayThe desired delay to configure, must be of type lpspi_delay_type_t.

brief Manually configures a specific LPSPI delay parameter (module must be disabled to change the delay values).

This function configures the following: SCK to PCS delay, or PCS to SCK delay, or The configurations must occur between the transfer delay.

The delay names are available in type lpspi_delay_type_t.

The user passes the desired delay along with the delay value. This allows the user to directly set the delay values if they have pre-calculated them or if they simply wish to manually increment the value.

Note that the LPSPI module must first be disabled before configuring this. Note that the LPSPI module must be configured for master mode before configuring this.

param base LPSPI peripheral address. param scaler The 8-bit delay value 0x00 to 0xFF (255). param whichDelay The desired delay to configure, must be of type lpspi_delay_type_t.

◆ LPSPI_MasterSetDelayTimes()

uint32_t LPSPI_MasterSetDelayTimes ( LPSPI_Type base,
uint32_t  delayTimeInNanoSec,
lpspi_delay_type_t  whichDelay,
uint32_t  srcClock_Hz 
)

Calculates the delay based on the desired delay input in nanoseconds (module must be disabled to change the delay values).

This function calculates the values for the following: SCK to PCS delay, or PCS to SCK delay, or The configurations must occur between the transfer delay.

The delay names are available in type lpspi_delay_type_t.

The user passes the desired delay and the desired delay value in nano-seconds. The function calculates the value needed for the desired delay parameter and returns the actual calculated delay because an exact delay match may not be possible. In this case, the closest match is calculated without going below the desired delay value input. It is possible to input a very large delay value that exceeds the capability of the part, in which case the maximum supported delay is returned. It is up to the higher level peripheral driver to alert the user of an out of range delay input.

Note that the LPSPI module must be configured for master mode before configuring this. And note that the delayTime = LPSPI_clockSource / (PRESCALE * Delay_scaler).

Parameters
baseLPSPI peripheral address.
delayTimeInNanoSecThe desired delay value in nano-seconds.
whichDelayThe desired delay to configuration, which must be of type lpspi_delay_type_t.
srcClock_HzModule source input clock in Hertz.
Returns
actual Calculated delay value in nano-seconds.

brief Calculates the delay based on the desired delay input in nanoseconds (module must be disabled to change the delay values).

This function calculates the values for the following: SCK to PCS delay, or PCS to SCK delay, or The configurations must occur between the transfer delay.

The delay names are available in type lpspi_delay_type_t.

The user passes the desired delay and the desired delay value in nano-seconds. The function calculates the value needed for the desired delay parameter and returns the actual calculated delay because an exact delay match may not be possible. In this case, the closest match is calculated without going below the desired delay value input. It is possible to input a very large delay value that exceeds the capability of the part, in which case the maximum supported delay is returned. It is up to the higher level peripheral driver to alert the user of an out of range delay input.

Note that the LPSPI module must be configured for master mode before configuring this. And note that the delayTime = LPSPI_clockSource / (PRESCALE * Delay_scaler).

param base LPSPI peripheral address. param delayTimeInNanoSec The desired delay value in nano-seconds. param whichDelay The desired delay to configuration, which must be of type lpspi_delay_type_t. param srcClock_Hz Module source input clock in Hertz. return actual Calculated delay value in nano-seconds.

◆ LPSPI_MasterTransferAbort()

void LPSPI_MasterTransferAbort ( LPSPI_Type base,
lpspi_master_handle_t handle 
)

LPSPI master abort transfer which uses an interrupt method.

This function aborts a transfer which uses an interrupt method.

Parameters
baseLPSPI peripheral address.
handlepointer to lpspi_master_handle_t structure which stores the transfer state.

brief LPSPI master abort transfer which uses an interrupt method.

This function aborts a transfer which uses an interrupt method.

param base LPSPI peripheral address. param handle pointer to lpspi_master_handle_t structure which stores the transfer state.

◆ LPSPI_MasterTransferBlocking()

status_t LPSPI_MasterTransferBlocking ( LPSPI_Type base,
lpspi_transfer_t transfer 
)

LPSPI master transfer data using a polling method.

This function transfers data using a polling method. This is a blocking function, which does not return until all transfers have been completed.

Note: The transfer data size should be integer multiples of bytesPerFrame if bytesPerFrame is less than or equal to 4. For bytesPerFrame greater than 4: The transfer data size should be equal to bytesPerFrame if the bytesPerFrame is not integer multiples of 4. Otherwise, the transfer data size can be an integer multiple of bytesPerFrame.

Parameters
baseLPSPI peripheral address.
transferpointer to lpspi_transfer_t structure.
Returns
status of status_t.

brief LPSPI master transfer data using a polling method.

This function transfers data using a polling method. This is a blocking function, which does not return until all transfers have been completed.

Note: The transfer data size should be integer multiples of bytesPerFrame if bytesPerFrame is less than or equal to 4. For bytesPerFrame greater than 4: The transfer data size should be equal to bytesPerFrame if the bytesPerFrame is not integer multiples of 4. Otherwise, the transfer data size can be an integer multiple of bytesPerFrame.

param base LPSPI peripheral address. param transfer pointer to lpspi_transfer_t structure. return status of status_t.

◆ LPSPI_MasterTransferCreateHandle()

void LPSPI_MasterTransferCreateHandle ( LPSPI_Type base,
lpspi_master_handle_t handle,
lpspi_master_transfer_callback_t  callback,
void *  userData 
)

Initializes the LPSPI master handle.

This function initializes the LPSPI handle, which can be used for other LPSPI transactional APIs. Usually, for a specified LPSPI instance, call this API once to get the initialized handle.

Parameters
baseLPSPI peripheral address.
handleLPSPI handle pointer to lpspi_master_handle_t.
callbackDSPI callback.
userDatacallback function parameter.

brief Initializes the LPSPI master handle.

This function initializes the LPSPI handle, which can be used for other LPSPI transactional APIs. Usually, for a specified LPSPI instance, call this API once to get the initialized handle.

param base LPSPI peripheral address. param handle LPSPI handle pointer to lpspi_master_handle_t. param callback DSPI callback. param userData callback function parameter.

◆ LPSPI_MasterTransferGetCount()

status_t LPSPI_MasterTransferGetCount ( LPSPI_Type base,
lpspi_master_handle_t handle,
size_t *  count 
)

Gets the master transfer remaining bytes.

This function gets the master transfer remaining bytes.

Parameters
baseLPSPI peripheral address.
handlepointer to lpspi_master_handle_t structure which stores the transfer state.
countNumber of bytes transferred so far by the non-blocking transaction.
Returns
status of status_t.

brief Gets the master transfer remaining bytes.

This function gets the master transfer remaining bytes.

param base LPSPI peripheral address. param handle pointer to lpspi_master_handle_t structure which stores the transfer state. param count Number of bytes transferred so far by the non-blocking transaction. return status of status_t.

◆ LPSPI_MasterTransferHandleIRQ()

void LPSPI_MasterTransferHandleIRQ ( LPSPI_Type base,
lpspi_master_handle_t handle 
)

LPSPI Master IRQ handler function.

This function processes the LPSPI transmit and receive IRQ.

Parameters
baseLPSPI peripheral address.
handlepointer to lpspi_master_handle_t structure which stores the transfer state.

brief LPSPI Master IRQ handler function.

This function processes the LPSPI transmit and receive IRQ.

param base LPSPI peripheral address. param handle pointer to lpspi_master_handle_t structure which stores the transfer state.

◆ LPSPI_MasterTransferNonBlocking()

status_t LPSPI_MasterTransferNonBlocking ( LPSPI_Type base,
lpspi_master_handle_t handle,
lpspi_transfer_t transfer 
)

LPSPI master transfer data using an interrupt method.

This function transfers data using an interrupt method. This is a non-blocking function, which returns right away. When all data is transferred, the callback function is called.

Note: The transfer data size should be integer multiples of bytesPerFrame if bytesPerFrame is less than or equal to 4. For bytesPerFrame greater than 4: The transfer data size should be equal to bytesPerFrame if the bytesPerFrame is not integer multiples of 4. Otherwise, the transfer data size can be an integer multiple of bytesPerFrame.

Parameters
baseLPSPI peripheral address.
handlepointer to lpspi_master_handle_t structure which stores the transfer state.
transferpointer to lpspi_transfer_t structure.
Returns
status of status_t.

brief LPSPI master transfer data using an interrupt method.

This function transfers data using an interrupt method. This is a non-blocking function, which returns right away. When all data is transferred, the callback function is called.

Note: The transfer data size should be integer multiples of bytesPerFrame if bytesPerFrame is less than or equal to 4. For bytesPerFrame greater than 4: The transfer data size should be equal to bytesPerFrame if the bytesPerFrame is not integer multiples of 4. Otherwise, the transfer data size can be an integer multiple of bytesPerFrame.

param base LPSPI peripheral address. param handle pointer to lpspi_master_handle_t structure which stores the transfer state. param transfer pointer to lpspi_transfer_t structure. return status of status_t.

◆ LPSPI_Reset()

void LPSPI_Reset ( LPSPI_Type base)

Restores the LPSPI peripheral to reset state. Note that this function sets all registers to reset state. As a result, the LPSPI module can't work after calling this API.

Parameters
baseLPSPI peripheral address.

brief Restores the LPSPI peripheral to reset state. Note that this function sets all registers to reset state. As a result, the LPSPI module can't work after calling this API. param base LPSPI peripheral address.

◆ LPSPI_SetDummyData()

void LPSPI_SetDummyData ( LPSPI_Type base,
uint8_t  dummyData 
)

Set up the dummy data.

Parameters
baseLPSPI peripheral address.
dummyDataData to be transferred when tx buffer is NULL. Note: This API has no effect when LPSPI in slave interrupt mode, because driver will set the TXMSK bit to 1 if txData is NULL, no data is loaded from transmit FIFO and output pin is tristated.

brief Set up the dummy data.

param base LPSPI peripheral address. param dummyData Data to be transferred when tx buffer is NULL. Note: This API has no effect when LPSPI in slave interrupt mode, because driver will set the TXMSK bit to 1 if txData is NULL, no data is loaded from transmit FIFO and output pin is tristated.

◆ LPSPI_SlaveGetDefaultConfig()

void LPSPI_SlaveGetDefaultConfig ( lpspi_slave_config_t slaveConfig)

Sets the lpspi_slave_config_t structure to default values.

This API initializes the configuration structure for LPSPI_SlaveInit(). The initialized structure can remain unchanged in LPSPI_SlaveInit() or can be modified before calling the LPSPI_SlaveInit(). Example:

void LPSPI_SlaveGetDefaultConfig(lpspi_slave_config_t *slaveConfig)
Sets the lpspi_slave_config_t structure to default values.
Definition: fsl_lpspi.c:402
LPSPI slave configuration structure.
Definition: fsl_lpspi.h:290
Parameters
slaveConfigpointer to lpspi_slave_config_t structure.

brief Sets the lpspi_slave_config_t structure to default values.

This API initializes the configuration structure for LPSPI_SlaveInit(). The initialized structure can remain unchanged in LPSPI_SlaveInit() or can be modified before calling the LPSPI_SlaveInit(). Example: code lpspi_slave_config_t slaveConfig; LPSPI_SlaveGetDefaultConfig(&slaveConfig); endcode param slaveConfig pointer to lpspi_slave_config_t structure.

< Bits per frame, minimum 8, maximum 4096.

< Clock polarity.

< Clock phase.

< MSB or LSB data shift direction.

< Desired Peripheral Chip Select (pcs)

< Desired PCS active high or low

◆ LPSPI_SlaveInit()

void LPSPI_SlaveInit ( LPSPI_Type base,
const lpspi_slave_config_t slaveConfig 
)

LPSPI slave configuration.

Parameters
baseLPSPI peripheral address.
slaveConfigPointer to a structure lpspi_slave_config_t.

brief LPSPI slave configuration.

param base LPSPI peripheral address. param slaveConfig Pointer to a structure lpspi_slave_config_t.

◆ LPSPI_SlaveTransferAbort()

void LPSPI_SlaveTransferAbort ( LPSPI_Type base,
lpspi_slave_handle_t handle 
)

LPSPI slave aborts a transfer which uses an interrupt method.

This function aborts a transfer which uses an interrupt method.

Parameters
baseLPSPI peripheral address.
handlepointer to lpspi_slave_handle_t structure which stores the transfer state.

brief LPSPI slave aborts a transfer which uses an interrupt method.

This function aborts a transfer which uses an interrupt method.

param base LPSPI peripheral address. param handle pointer to lpspi_slave_handle_t structure which stores the transfer state.

◆ LPSPI_SlaveTransferCreateHandle()

void LPSPI_SlaveTransferCreateHandle ( LPSPI_Type base,
lpspi_slave_handle_t handle,
lpspi_slave_transfer_callback_t  callback,
void *  userData 
)

Initializes the LPSPI slave handle.

This function initializes the LPSPI handle, which can be used for other LPSPI transactional APIs. Usually, for a specified LPSPI instance, call this API once to get the initialized handle.

Parameters
baseLPSPI peripheral address.
handleLPSPI handle pointer to lpspi_slave_handle_t.
callbackDSPI callback.
userDatacallback function parameter.

brief Initializes the LPSPI slave handle.

This function initializes the LPSPI handle, which can be used for other LPSPI transactional APIs. Usually, for a specified LPSPI instance, call this API once to get the initialized handle.

param base LPSPI peripheral address. param handle LPSPI handle pointer to lpspi_slave_handle_t. param callback DSPI callback. param userData callback function parameter.

◆ LPSPI_SlaveTransferGetCount()

status_t LPSPI_SlaveTransferGetCount ( LPSPI_Type base,
lpspi_slave_handle_t handle,
size_t *  count 
)

Gets the slave transfer remaining bytes.

This function gets the slave transfer remaining bytes.

Parameters
baseLPSPI peripheral address.
handlepointer to lpspi_slave_handle_t structure which stores the transfer state.
countNumber of bytes transferred so far by the non-blocking transaction.
Returns
status of status_t.

brief Gets the slave transfer remaining bytes.

This function gets the slave transfer remaining bytes.

param base LPSPI peripheral address. param handle pointer to lpspi_slave_handle_t structure which stores the transfer state. param count Number of bytes transferred so far by the non-blocking transaction. return status of status_t.

◆ LPSPI_SlaveTransferHandleIRQ()

void LPSPI_SlaveTransferHandleIRQ ( LPSPI_Type base,
lpspi_slave_handle_t handle 
)

LPSPI Slave IRQ handler function.

This function processes the LPSPI transmit and receives an IRQ.

Parameters
baseLPSPI peripheral address.
handlepointer to lpspi_slave_handle_t structure which stores the transfer state.

brief LPSPI Slave IRQ handler function.

This function processes the LPSPI transmit and receives an IRQ.

param base LPSPI peripheral address. param handle pointer to lpspi_slave_handle_t structure which stores the transfer state.

◆ LPSPI_SlaveTransferNonBlocking()

status_t LPSPI_SlaveTransferNonBlocking ( LPSPI_Type base,
lpspi_slave_handle_t handle,
lpspi_transfer_t transfer 
)

LPSPI slave transfer data using an interrupt method.

This function transfer data using an interrupt method. This is a non-blocking function, which returns right away. When all data is transferred, the callback function is called.

Note: The transfer data size should be integer multiples of bytesPerFrame if bytesPerFrame is less than or equal to 4. For bytesPerFrame greater than 4: The transfer data size should be equal to bytesPerFrame if the bytesPerFrame is not an integer multiple of 4. Otherwise, the transfer data size can be an integer multiple of bytesPerFrame.

Parameters
baseLPSPI peripheral address.
handlepointer to lpspi_slave_handle_t structure which stores the transfer state.
transferpointer to lpspi_transfer_t structure.
Returns
status of status_t.

brief LPSPI slave transfer data using an interrupt method.

This function transfer data using an interrupt method. This is a non-blocking function, which returns right away. When all data is transferred, the callback function is called.

Note: The transfer data size should be integer multiples of bytesPerFrame if bytesPerFrame is less than or equal to 4. For bytesPerFrame greater than 4: The transfer data size should be equal to bytesPerFrame if the bytesPerFrame is not an integer multiple of 4. Otherwise, the transfer data size can be an integer multiple of bytesPerFrame.

param base LPSPI peripheral address. param handle pointer to lpspi_slave_handle_t structure which stores the transfer state. param transfer pointer to lpspi_transfer_t structure. return status of status_t.