Low Power Serial Peripheral Interface Peripheral Driver.
Data Structures | |
struct | lpspi_master_config_t |
Data structure containing information about a device on the SPI bus. More... | |
struct | lpspi_state_t |
Runtime state structure for the LPSPI master driver. More... | |
struct | lpspi_slave_config_t |
User configuration structure for the SPI slave driver. Implements : lpspi_slave_config_t_Class. More... | |
Enumerations | |
enum | lpspi_which_pcs_t { LPSPI_PCS0 = 0U, LPSPI_PCS1 = 1U, LPSPI_PCS2 = 2U, LPSPI_PCS3 = 3U } |
LPSPI Peripheral Chip Select (PCS) configuration (which PCS to configure). Implements : lpspi_which_pcs_t_Class. More... | |
enum | lpspi_signal_polarity_t { LPSPI_ACTIVE_HIGH = 1U, LPSPI_ACTIVE_LOW = 0U } |
LPSPI Signal (PCS and Host Request) Polarity configuration. Implements : lpspi_signal_polarity_t_Class. More... | |
enum | lpspi_clock_phase_t { LPSPI_CLOCK_PHASE_1ST_EDGE = 0U, LPSPI_CLOCK_PHASE_2ND_EDGE = 1U } |
LPSPI clock phase configuration. Implements : lpspi_clock_phase_t_Class. More... | |
enum | lpspi_sck_polarity_t { LPSPI_SCK_ACTIVE_HIGH = 0U, LPSPI_SCK_ACTIVE_LOW = 1U } |
LPSPI Clock Signal (SCK) Polarity configuration. Implements : lpspi_sck_polarity_t_Class. More... | |
enum | lpspi_transfer_type { LPSPI_USING_DMA = 0, LPSPI_USING_INTERRUPTS } |
Type of LPSPI transfer (based on interrupts or DMA). Implements : lpspi_transfer_type_Class. More... | |
enum | transfer_status_t { LPSPI_TRANSFER_OK = 0U, LPSPI_TRANSMIT_FAIL, LPSPI_RECEIVE_FAIL } |
Type of error reported by LPSPI. More... | |
Functions | |
void | LPSPI_DRV_SlaveIRQHandler (uint32_t instance) |
Interrupt handler for LPSPI slave mode. This handler uses the buffers stored in the lpspi_master_state_t structs to transfer data. More... | |
void | LPSPI_DRV_IRQHandler (uint32_t instance) |
The function LPSPI_DRV_IRQHandler passes IRQ control to either the master or slave driver. More... | |
void | LPSPI_DRV_FillupTxBuffer (uint32_t instance) |
The function LPSPI_DRV_FillupTxBuffer writes data in TX hardware buffer depending on driver state and number of bytes remained to send. More... | |
void | LPSPI_DRV_ReadRXBuffer (uint32_t instance) |
The function LPSPI_DRV_ReadRXBuffer reads data from RX hardware buffer and writes this data in RX software buffer. More... | |
void | LPSPI_DRV_DisableTEIEInterrupts (uint32_t instance) |
Disable the TEIE interrupts at the end of a transfer. Disable the interrupts and clear the status for transmit/receive errors. More... | |
status_t | LPSPI_DRV_SlaveInit (uint32_t instance, lpspi_state_t *lpspiState, const lpspi_slave_config_t *slaveConfig) |
Initializes a LPSPI instance for a slave mode operation, using interrupt mechanism. More... | |
status_t | LPSPI_DRV_SlaveDeinit (uint32_t instance) |
Shuts down an LPSPI instance interrupt mechanism. More... | |
status_t | LPSPI_DRV_SlaveTransferBlocking (uint32_t instance, const uint8_t *sendBuffer, uint8_t *receiveBuffer, uint16_t transferByteCount, uint32_t timeout) |
Transfers data on LPSPI bus using a blocking call. More... | |
status_t | LPSPI_DRV_SlaveTransfer (uint32_t instance, const uint8_t *sendBuffer, uint8_t *receiveBuffer, uint16_t transferByteCount) |
Starts the transfer data on LPSPI bus using a non-blocking call. More... | |
status_t | LPSPI_DRV_SlaveAbortTransfer (uint32_t instance) |
Aborts the transfer that started by a non-blocking call transfer function. More... | |
status_t | LPSPI_DRV_SlaveGetTransferStatus (uint32_t instance, uint32_t *bytesRemained) |
Returns whether the previous transfer is finished. More... | |
void | LPSPI0_IRQHandler (void) |
This function is the implementation of LPSPI0 handler named in startup code. More... | |
void | LPSPI1_IRQHandler (void) |
This function is the implementation of LPSPI1 handler named in startup code. More... | |
Variables | |
LPSPI_Type * | g_lpspiBase [(2u)] |
Table of base pointers for SPI instances. More... | |
IRQn_Type | g_lpspiIrqId [(2u)] |
Table to save LPSPI IRQ enumeration numbers defined in the CMSIS header file. More... | |
lpspi_state_t * | g_lpspiStatePtr [(2u)] |
Initialization and shutdown | |
status_t | LPSPI_DRV_MasterInit (uint32_t instance, lpspi_state_t *lpspiState, const lpspi_master_config_t *spiConfig) |
Initializes a LPSPI instance for interrupt driven master mode operation. More... | |
status_t | LPSPI_DRV_MasterDeinit (uint32_t instance) |
Shuts down a LPSPI instance. More... | |
status_t | LPSPI_DRV_MasterSetDelay (uint32_t instance, uint32_t delayBetwenTransfers, uint32_t delaySCKtoPCS, uint32_t delayPCStoSCK) |
Configures the LPSPI master mode bus timing delay options. More... | |
Bus configuration | |
status_t | LPSPI_DRV_MasterConfigureBus (uint32_t instance, const lpspi_master_config_t *spiConfig, uint32_t *calculatedBaudRate) |
Configures the LPSPI port physical parameters to access a device on the bus when the LSPI instance is configured for interrupt operation. More... | |
status_t | LPSPI_DRV_SetPcs (uint32_t instance, lpspi_which_pcs_t whichPcs, lpspi_signal_polarity_t polarity) |
Select the chip to communicate with. More... | |
Blocking transfers | |
status_t | LPSPI_DRV_MasterTransferBlocking (uint32_t instance, const uint8_t *sendBuffer, uint8_t *receiveBuffer, uint16_t transferByteCount, uint32_t timeout) |
Performs an interrupt driven blocking SPI master mode transfer. More... | |
Non-blocking transfers | |
status_t | LPSPI_DRV_MasterTransfer (uint32_t instance, const uint8_t *sendBuffer, uint8_t *receiveBuffer, uint16_t transferByteCount) |
Performs an interrupt driven non-blocking SPI master mode transfer. More... | |
status_t | LPSPI_DRV_MasterGetTransferStatus (uint32_t instance, uint32_t *bytesRemained) |
Returns whether the previous interrupt driven transfer is completed. More... | |
status_t | LPSPI_DRV_MasterAbortTransfer (uint32_t instance) |
Terminates an interrupt driven asynchronous transfer early. More... | |
void | LPSPI_DRV_MasterIRQHandler (uint32_t instance) |
Interrupt handler for LPSPI master mode. This handler uses the buffers stored in the lpspi_master_state_t structs to transfer data. More... | |
enum lpspi_clock_phase_t |
LPSPI clock phase configuration. Implements : lpspi_clock_phase_t_Class.
Enumerator | |
---|---|
LPSPI_CLOCK_PHASE_1ST_EDGE |
Data captured on SCK 1st edge, changed on 2nd. |
LPSPI_CLOCK_PHASE_2ND_EDGE |
Data changed on SCK 1st edge, captured on 2nd. |
Definition at line 83 of file lpspi_shared_function.h.
enum lpspi_sck_polarity_t |
LPSPI Clock Signal (SCK) Polarity configuration. Implements : lpspi_sck_polarity_t_Class.
Enumerator | |
---|---|
LPSPI_SCK_ACTIVE_HIGH |
Signal is Active High (idles low). |
LPSPI_SCK_ACTIVE_LOW |
Signal is Active Low (idles high). |
Definition at line 92 of file lpspi_shared_function.h.
LPSPI Signal (PCS and Host Request) Polarity configuration. Implements : lpspi_signal_polarity_t_Class.
Enumerator | |
---|---|
LPSPI_ACTIVE_HIGH |
Signal is Active High (idles low). |
LPSPI_ACTIVE_LOW |
Signal is Active Low (idles high). |
Definition at line 74 of file lpspi_shared_function.h.
enum lpspi_transfer_type |
Type of LPSPI transfer (based on interrupts or DMA). Implements : lpspi_transfer_type_Class.
Enumerator | |
---|---|
LPSPI_USING_DMA |
The driver will use DMA to perform SPI transfer |
LPSPI_USING_INTERRUPTS |
The driver will use interrupts to perform SPI transfer |
Definition at line 102 of file lpspi_shared_function.h.
enum lpspi_which_pcs_t |
LPSPI Peripheral Chip Select (PCS) configuration (which PCS to configure). Implements : lpspi_which_pcs_t_Class.
Enumerator | |
---|---|
LPSPI_PCS0 |
PCS[0] |
LPSPI_PCS1 |
PCS[1] |
LPSPI_PCS2 |
PCS[2] |
LPSPI_PCS3 |
PCS[3] |
Definition at line 63 of file lpspi_shared_function.h.
enum transfer_status_t |
Type of error reported by LPSPI.
Enumerator | |
---|---|
LPSPI_TRANSFER_OK |
Transfer OK |
LPSPI_TRANSMIT_FAIL |
Error during transmission |
LPSPI_RECEIVE_FAIL |
Error during reception |
Definition at line 110 of file lpspi_shared_function.h.
void LPSPI0_IRQHandler | ( | void | ) |
This function is the implementation of LPSPI0 handler named in startup code.
It passes the instance to the shared LPSPI IRQ handler.
Definition at line 88 of file lpspi_irq.c.
void LPSPI1_IRQHandler | ( | void | ) |
This function is the implementation of LPSPI1 handler named in startup code.
It passes the instance to the shared LPSPI IRQ handler.
Definition at line 98 of file lpspi_irq.c.
void LPSPI_DRV_DisableTEIEInterrupts | ( | uint32_t | instance | ) |
Disable the TEIE interrupts at the end of a transfer. Disable the interrupts and clear the status for transmit/receive errors.
Definition at line 256 of file lpspi_shared_function.c.
void LPSPI_DRV_FillupTxBuffer | ( | uint32_t | instance | ) |
The function LPSPI_DRV_FillupTxBuffer writes data in TX hardware buffer depending on driver state and number of bytes remained to send.
The function LPSPI_DRV_FillupTxBuffer writes data in TX hardware buffer depending on driver state and number of bytes remained to send.
Definition at line 126 of file lpspi_shared_function.c.
void LPSPI_DRV_IRQHandler | ( | uint32_t | instance | ) |
The function LPSPI_DRV_IRQHandler passes IRQ control to either the master or slave driver.
The address of the IRQ handlers are checked to make sure they are non-zero before they are called. If the IRQ handler's address is zero, it means that driver was not present in the link (because the IRQ handlers are marked as weak). This would actually be a program error, because it means the master/slave config for the IRQ was set incorrectly.
Definition at line 103 of file lpspi_shared_function.c.
status_t LPSPI_DRV_MasterAbortTransfer | ( | uint32_t | instance | ) |
Terminates an interrupt driven asynchronous transfer early.
During an a-sync (non-blocking) transfer, the user has the option to terminate the transfer early if the transfer is still in progress.
instance | The instance number of the LPSPI peripheral. |
Definition at line 577 of file lpspi_master_driver.c.
status_t LPSPI_DRV_MasterConfigureBus | ( | uint32_t | instance, |
const lpspi_master_config_t * | spiConfig, | ||
uint32_t * | calculatedBaudRate | ||
) |
Configures the LPSPI port physical parameters to access a device on the bus when the LSPI instance is configured for interrupt operation.
In this function, the term "spiConfig" is used to indicate the SPI device for which the LPSPI master is communicating. This is an optional function as the spiConfig parameters are normally configured in the initialization function or the transfer functions, where these various functions would call the configure bus function. This is an example to set up the lpspi_master_config_t structure to call the LPSPI_DRV_MasterConfigureBus function by passing in these parameters:
instance | The instance number of the LPSPI peripheral. |
spiConfig | Pointer to the spiConfig structure. This structure contains the settings for the SPI bus configuration. The SPI device parameters are the desired baud rate (in bits-per-sec), bits-per-frame, chip select attributes, clock attributes, and data shift direction. |
calculatedBaudRate | The calculated baud rate passed back to the user to determine if the calculated baud rate is close enough to meet the needs. The baud rate never exceeds the desired baud rate. |
Definition at line 316 of file lpspi_master_driver.c.
status_t LPSPI_DRV_MasterDeinit | ( | uint32_t | instance | ) |
Shuts down a LPSPI instance.
This function resets the LPSPI peripheral, gates its clock, and disables the interrupt to the core. It first checks to see if a transfer is in progress and if so returns an error status.
instance | The instance number of the LPSPI peripheral. |
Definition at line 194 of file lpspi_master_driver.c.
status_t LPSPI_DRV_MasterGetTransferStatus | ( | uint32_t | instance, |
uint32_t * | bytesRemained | ||
) |
Returns whether the previous interrupt driven transfer is completed.
When performing an a-sync (non-blocking) transfer, the user can call this function to ascertain the state of the current transfer: in progress (or busy) or complete (success). In addition, if the transfer is still in progress, the user can get the number of words that have been transferred up to now.
instance | The instance number of the LPSPI peripheral. |
bytesRemained | Pointer to a value that is filled in with the number of bytes that must be received. |
Definition at line 548 of file lpspi_master_driver.c.
status_t LPSPI_DRV_MasterInit | ( | uint32_t | instance, |
lpspi_state_t * | lpspiState, | ||
const lpspi_master_config_t * | spiConfig | ||
) |
Initializes a LPSPI instance for interrupt driven master mode operation.
This function uses an interrupt-driven method for transferring data. In this function, the term "spiConfig" is used to indicate the SPI device for which the LPSPI master is communicating. This function initializes the run-time state structure to track the ongoing transfers, un-gates the clock to the LPSPI module, resets the LPSPI module, configures the IRQ state structure, enables the module-level interrupt to the core, and enables the LPSPI module. This is an example to set up the lpspi_master_state_t and call the LPSPI_DRV_MasterInit function by passing in these parameters:
instance | The instance number of the LPSPI peripheral. |
lpspiState | The pointer to the LPSPI master driver state structure. The user passes the memory for this run-time state structure. The LPSPI master driver populates the members. This run-time state structure keeps track of the transfer in progress. |
spiConfig | The data structure containing information about a device on the SPI bus |
Definition at line 140 of file lpspi_master_driver.c.
void LPSPI_DRV_MasterIRQHandler | ( | uint32_t | instance | ) |
Interrupt handler for LPSPI master mode. This handler uses the buffers stored in the lpspi_master_state_t structs to transfer data.
instance | The instance number of the LPSPI peripheral. |
Interrupt handler for LPSPI master mode. This handler uses the buffers stored in the lpspi_master_state_t structs to transfer data.
Definition at line 854 of file lpspi_master_driver.c.
status_t LPSPI_DRV_MasterSetDelay | ( | uint32_t | instance, |
uint32_t | delayBetwenTransfers, | ||
uint32_t | delaySCKtoPCS, | ||
uint32_t | delayPCStoSCK | ||
) |
Configures the LPSPI master mode bus timing delay options.
This function involves the LPSPI module's delay options to "fine tune" some of the signal timings and match the timing needs of a slower peripheral device. This is an optional function that can be called after the LPSPI module has been initialized for master mode. The timings are adjusted in terms of cycles of the baud rate clock. The bus timing delays that can be adjusted are listed below:
SCK to PCS Delay: Adjustable delay option between the last edge of SCK to the de-assertion of the PCS signal.
PCS to SCK Delay: Adjustable delay option between the assertion of the PCS signal to the first SCK edge.
Delay between Transfers: Adjustable delay option between the de-assertion of the PCS signal for a frame to the assertion of the PCS signal for the next frame.
instance | The instance number of the LPSPI peripheral. |
delayBetwenTransfers | Minimum delay between 2 transfers in microseconds |
delaySCKtoPCS | Minimum delay between SCK and PCS |
delayPCStoSCK | Minimum delay between PCS and SCK |
Definition at line 241 of file lpspi_master_driver.c.
status_t LPSPI_DRV_MasterTransfer | ( | uint32_t | instance, |
const uint8_t * | sendBuffer, | ||
uint8_t * | receiveBuffer, | ||
uint16_t | transferByteCount | ||
) |
Performs an interrupt driven non-blocking SPI master mode transfer.
This function simultaneously sends and receives data on the SPI bus, as SPI is naturally a full-duplex bus. The function returns immediately after initiating the transfer. The user needs to check whether the transfer is complete using the LPSPI_DRV_MasterGetTransferStatus function. This function allows the user to optionally pass in a SPI configuration structure which allows the user to change the SPI bus attributes in conjunction with initiating a SPI transfer. The difference between passing in the SPI configuration structure here as opposed to the configure bus function is that the configure bus function returns the calculated baud rate where this function does not. The user can also call the configure bus function prior to the transfer in which case the user would simply pass in a NULL to the transfer function's device structure parameter. Depending on frame size sendBuffer and receiveBuffer must be aligned like this: -1 byte if frame size <= 8 bits -2 bytes if 8 bits < frame size <= 16 bits -4 bytes if 16 bits < frame size
instance | The instance number of the LPSPI peripheral. |
spiConfig | Pointer to the SPI configuration structure. This structure contains the settings for the SPI bus configuration in this transfer. You may pass NULL for this parameter, in which case the current bus configuration is used unmodified. The device can be configured separately by calling the LPSPI_DRV_MasterConfigureBus function. |
sendBuffer | The pointer to the data buffer of the data to send. You may pass NULL for this parameter and bytes with a value of 0 (zero) is sent. |
receiveBuffer | Pointer to the buffer where the received bytes are stored. If you pass NULL for this parameter, the received bytes are ignored. |
transferByteCount | The number of bytes to send and receive which is equal to size of send or receive buffers |
Definition at line 510 of file lpspi_master_driver.c.
status_t LPSPI_DRV_MasterTransferBlocking | ( | uint32_t | instance, |
const uint8_t * | sendBuffer, | ||
uint8_t * | receiveBuffer, | ||
uint16_t | transferByteCount, | ||
uint32_t | timeout | ||
) |
Performs an interrupt driven blocking SPI master mode transfer.
This function simultaneously sends and receives data on the SPI bus, as SPI is naturally a full-duplex bus. The function does not return until the transfer is complete. This function allows the user to optionally pass in a SPI configuration structure which allows the user to change the SPI bus attributes in conjunction with initiating a SPI transfer. The difference between passing in the SPI configuration structure here as opposed to the configure bus function is that the configure bus function returns the calculated baud rate where this function does not. The user can also call the configure bus function prior to the transfer in which case the user would simply pass in a NULL to the transfer function's device structure parameter. Depending on frame size sendBuffer and receiveBuffer must be aligned like this: -1 byte if frame size <= 8 bits -2 bytes if 8 bits < frame size <= 16 bits -4 bytes if 16 bits < frame size
instance | The instance number of the LPSPI peripheral. |
sendBuffer | The pointer to the data buffer of the data to send. You may pass NULL for this parameter and bytes with a value of 0 (zero) is sent. |
receiveBuffer | Pointer to the buffer where the received bytes are stored. If you pass NULL for this parameter, the received bytes are ignored. |
transferByteCount | The number of bytes to send and receive which is equal to size of send or receive buffers |
timeout | A timeout for the transfer in milliseconds. If the transfer takes longer than this amount of time, the transfer is aborted and a STATUS_TIMEOUT error returned. |
Definition at line 431 of file lpspi_master_driver.c.
void LPSPI_DRV_ReadRXBuffer | ( | uint32_t | instance | ) |
The function LPSPI_DRV_ReadRXBuffer reads data from RX hardware buffer and writes this data in RX software buffer.
The function LPSPI_DRV_ReadRXBuffer reads data from RX hardware buffer and writes this data in RX software buffer.
Definition at line 195 of file lpspi_shared_function.c.
status_t LPSPI_DRV_SetPcs | ( | uint32_t | instance, |
lpspi_which_pcs_t | whichPcs, | ||
lpspi_signal_polarity_t | polarity | ||
) |
Select the chip to communicate with.
The main purpose of this function is to set the PCS and the appropriate polarity.
instance | LPSPI instance |
whichPcs | selected chip |
polarity | chip select line polarity |
Definition at line 599 of file lpspi_master_driver.c.
status_t LPSPI_DRV_SlaveAbortTransfer | ( | uint32_t | instance | ) |
Aborts the transfer that started by a non-blocking call transfer function.
This function stops the transfer which was started by the calling the SPI_DRV_SlaveTransfer() function.
instance | The instance number of SPI peripheral |
Definition at line 450 of file lpspi_slave_driver.c.
status_t LPSPI_DRV_SlaveDeinit | ( | uint32_t | instance | ) |
Shuts down an LPSPI instance interrupt mechanism.
Disables the LPSPI module, gates its clock, and changes the LPSPI slave driver state to NonInit for the LPSPI slave module which is initialized with interrupt mechanism. After de-initialization, the user can re-initialize the LPSPI slave module with other mechanisms.
instance | The instance number of the LPSPI peripheral. |
Definition at line 180 of file lpspi_slave_driver.c.
status_t LPSPI_DRV_SlaveGetTransferStatus | ( | uint32_t | instance, |
uint32_t * | bytesRemained | ||
) |
Returns whether the previous transfer is finished.
When performing an a-sync transfer, the user can call this function to ascertain the state of the current transfer: in progress (or busy) or complete (success). In addition, if the transfer is still in progress, the user can get the number of bytes that have been transferred up to now.
instance | The instance number of the LPSPI peripheral. |
bytesRemained | Pointer to value that is filled in with the number of frames that have been sent in the active transfer. A frame is defined as the number of bits per frame. |
Definition at line 488 of file lpspi_slave_driver.c.
status_t LPSPI_DRV_SlaveInit | ( | uint32_t | instance, |
lpspi_state_t * | lpspiState, | ||
const lpspi_slave_config_t * | slaveConfig | ||
) |
Initializes a LPSPI instance for a slave mode operation, using interrupt mechanism.
This function un-gates the clock to the LPSPI module, initializes the LPSPI for slave mode. After it is initialized, the LPSPI module is configured in slave mode and the user can start transmitting and receiving data by calling send, receive, and transfer functions. This function indicates LPSPI slave uses an interrupt mechanism.
instance | The instance number of the LPSPI peripheral. |
lpspiState | The pointer to the LPSPI slave driver state structure. |
slaveConfig | The configuration structure lpspi_slave_user_config_t which configures the data bus format. |
Definition at line 103 of file lpspi_slave_driver.c.
void LPSPI_DRV_SlaveIRQHandler | ( | uint32_t | instance | ) |
Interrupt handler for LPSPI slave mode. This handler uses the buffers stored in the lpspi_master_state_t structs to transfer data.
instance | The instance number of the LPSPI peripheral. |
Definition at line 380 of file lpspi_slave_driver.c.
status_t LPSPI_DRV_SlaveTransfer | ( | uint32_t | instance, |
const uint8_t * | sendBuffer, | ||
uint8_t * | receiveBuffer, | ||
uint16_t | transferByteCount | ||
) |
Starts the transfer data on LPSPI bus using a non-blocking call.
This function checks the driver status and mechanism and transmits/receives data through the LPSPI bus. If the sendBuffer is NULL, the transmit process is ignored. If the receiveBuffer is NULL, the receive process is ignored. If both the receiveBuffer and the sendBuffer are available, the transmit and the receive progress is processed. If only the receiveBuffer is available, the receive is processed. Otherwise, the transmit is processed. This function only returns when the processes are completed. This function uses an interrupt mechanism. Depending on frame size sendBuffer and receiveBuffer must be aligned like this: -1 byte if frame size <= 8 bits -2 bytes if 8 bits < frame size <= 16 bits -4 bytes if 16 bits < frame size
instance | The instance number of LPSPI peripheral |
sendBuffer | The pointer to data that user wants to transmit. |
receiveBuffer | The pointer to data that user wants to store received data. |
transferByteCount | The number of bytes to send and receive which is equal to size of send or receive buffers |
Definition at line 248 of file lpspi_slave_driver.c.
status_t LPSPI_DRV_SlaveTransferBlocking | ( | uint32_t | instance, |
const uint8_t * | sendBuffer, | ||
uint8_t * | receiveBuffer, | ||
uint16_t | transferByteCount, | ||
uint32_t | timeout | ||
) |
Transfers data on LPSPI bus using a blocking call.
This function checks the driver status and mechanism and transmits/receives data through the LPSPI bus. If the sendBuffer is NULL, the transmit process is ignored. If the receiveBuffer is NULL, the receive process is ignored. If both the receiveBuffer and the sendBuffer are available, the transmit and the receive progress is processed. If only the receiveBuffer is available, the receive is processed. Otherwise, the transmit is processed. This function only returns when the processes are completed. This function uses an interrupt mechanism. Depending on frame size sendBuffer and receiveBuffer must be aligned like this: -1 byte if frame size <= 8 bits -2 bytes if 8 bits < frame size <= 16 bits -4 bytes if 16 bits < frame size
instance | The instance number of LPSPI peripheral |
sendBuffer | The pointer to data that user wants to transmit. |
receiveBuffer | The pointer to data that user wants to store received data. |
transferByteCount | The number of bytes to send and receive which is equal to size of send or receive buffers |
timeout | The maximum number of milliseconds that function waits before timed out reached. |
Definition at line 209 of file lpspi_slave_driver.c.
LPSPI_Type* g_lpspiBase[(2u)] |
Table of base pointers for SPI instances.
Definition at line 81 of file lpspi_shared_function.c.
IRQn_Type g_lpspiIrqId[(2u)] |
Table to save LPSPI IRQ enumeration numbers defined in the CMSIS header file.
Definition at line 84 of file lpspi_shared_function.c.
lpspi_state_t* g_lpspiStatePtr[(2u)] |
Definition at line 87 of file lpspi_shared_function.c.