MKM34Z256VLx7 Bare Metal Software Drivers  R4.1.6
Reference Manual
SPI API Specification

Overview

This section describes functions and macros of the driver's API.

Macros

#define SPI_Enable(module)
 Enables SPI module. This macro enables the SPI module and dedicates the SPI port pins to SPI system functions. More...
 
#define SPI_Disable(module)
 Disables SPI module. This macro disables the SPI module. After calling this macro, the selected SPI module is disabled and forced into an idle state, and all status bits in the status register are reset. More...
 
#define SPI_TxIsrDisable(module)
 Disables transmit interrupt request. More...
 
#define SPI_TxIsrEnable(module)
 Enables transmit interrupt request. More...
 
#define SPI_GetByte(module)
 Returns 8-bit data from the SPI receive buffer. More...
 
#define SPI_GetWord(module)
 Returns 16-bit data from the SPI receive buffer. More...
 
#define SPI_PutByte(module, c)
 Writes 8-bit data to the SPI transmit buffer. More...
 
#define SPI_PutWord(module, c)
 Writes 16-bit data to the SPI transmit buffer. More...
 
#define SPI_RxFull(module)
 Returns SPI receiver state. More...
 
#define SPI_TxCmpl(module)
 Returns SPI transmitter state. More...
 
#define SPI_TxFifoFull(module)
 Returns SPI transmit FIFO state. More...
 
#define SPI_RxFifoEmpty(module)
 Returns SPI receive FIFO state. More...
 
#define SPI_TxRxWord(module, data)
 Transmit and receives one word. More...
 
#define SPI_TxRxByte(module, data)
 Transmit and receives one byte. More...
 
#define SPI_CommWord(module, txd, txcnt, rxd, rxcnt)
 Transmits and receives whole data packet (16-bit length). More...
 
#define SPI_CommByte(module, txd, txcnt, rxd, rxcnt)
 Transmits and receives whole data packet (8-bit length). More...
 
#define SPI_PutWordToFifo(module, txd, txcnt)
 Writes data packet to the SPI transmit FIFO (16-bit length) More...
 
#define SPI_PutByteToFifo(module, txd, txcnt)
 Writes data packet to the SPI transmit FIFO (8-bit length) More...
 
#define SPI_GetWordFromFifo(module, rxd, rxcnt)
 Saves 16-bit data packet from the SPI receive FIFO. More...
 
#define SPI_GetByteFromFifo(module, rxd, rxcnt)
 Saves 8-bit data packet from the SPI receive FIFO. More...
 
#define SPI_InstallCallback(ip, callback)
 Installs callback function for SPI interrupt vector 20. More...
 
#define SPI_Init(module, cfg, call2)
 SPI initialization. More...
 

Macro Definition Documentation

#define SPI_Enable (   module)
Parameters
moduleSPI0,SPI1.
Note
Implemented as an inline macro.
See also
SPI_Disable
#define SPI_Disable (   module)
Parameters
moduleSPI0,SPI1.
Note
Implemented as an inline macro.
See also
SPI_Enable
#define SPI_TxIsrDisable (   module)

This macro disables transmit interrupt request for specified module.

Parameters
moduleSPI0,SPI1.
Note
Implemented as an inline macro.
See also
SPI_TxIsrEnable
#define SPI_TxIsrEnable (   module)

This macro enables transmit interrupt request for specified module.

Parameters
moduleSPI0,SPI1.
Note
Implemented as an inline macro.
See also
SPI_TxIsrDisable
#define SPI_GetByte (   module)

This macro returns 8-bit data from the specified module.

Parameters
moduleSPI0,SPI1.
Returns
received data (8-bit).
Note
Implemented as an inline macro.
See also
SPI_RxFull, SPI_GetWord
#define SPI_GetWord (   module)

This macro returns 16-bit data from the specified module.

Parameters
moduleSPI0,SPI1.
Returns
received data (16-bit).
Note
Implemented as an inline macro.
See also
SPI_RxFull, SPI_GetWord
#define SPI_PutByte (   module,
 
)

This macro writes 8-bit data to the specified module.

Parameters
moduleSPI0,SPI1.
cData to be sent (8-bit).
Note
Implemented as an inline macro.
See also
SPI_TxCmpl, SPI_PutWord
#define SPI_PutWord (   module,
 
)

This macro writes 16-bit data to the specified module.

Parameters
moduleSPI0,SPI1.
cData to be sent (16-bit).
Note
Implemented as an inline macro.
See also
SPI_TxCmpl, SPI_PutByte
#define SPI_RxFull (   module)

This macro returns receiver state for the specified module.

Parameters
moduleSPI0,SPI1.
Returns
true (non-zero) SPI Rx buffer is empty,
false SPI Rx buffer is full (contains some data for reading).
Note
Implemented as an inline macro.
See also
SPI_GetByte, SPI_GetWord
#define SPI_TxCmpl (   module)

This macro returns transmitter state for the specified module.

Parameters
moduleSPI0,SPI1.
Returns
true (non-zero) SPI Transfer is not complete,
false SPI Transfer is complete.
Note
Implemented as an inline macro.
See also
SPI_PutByte, SPI_PutWord
#define SPI_TxFifoFull (   module)

This macro returns transmit FIFO state for the specified module.

Parameters
moduleSPI1.
Returns
true (non-zero) SPI Tx FIFO buffer is full,
false SPI Tx FIFO buffer is not full.
Note
Implemented as an inline macro.
See also
SPI_PutByte, SPI_PutWord
#define SPI_RxFifoEmpty (   module)

This macro returns receive FIFO state for the specified module.

Parameters
moduleSPI1.
Returns
true (non-zero) SPI Rx FIFO buffer is empty,
false SPI Rx FIFO buffer is not empty.
Note
Implemented as an inline macro.
See also
SPI_PutByte, SPI_PutWord
#define SPI_TxRxWord (   module,
  data 
)

This macro transmits and receives one word.

Parameters
moduleSPI0,SPI1.
dataData for transferring.
Returns
received data (16-bit).
Note
Implemented as a function call.
See also
SPI_TxRxByte, SPI_CommWord, SPI_CommByte
#define SPI_TxRxByte (   module,
  data 
)

This macro transmits and receives one byte.

Parameters
moduleSPI0,SPI1.
dataData for transferring.
Returns
received data (8-bit).
Note
Implemented as a function call.
See also
SPI_TxRxWord, SPI_CommWord, SPI_CommByte
#define SPI_CommWord (   module,
  txd,
  txcnt,
  rxd,
  rxcnt 
)

This macro transmits and receives whole data packet.

Parameters
moduleSPI0,SPI1.
txdPointer to buffer where writing data is stored.
txcntNumber of words for writing.
rxdPointer to buffer where reading data will be saved.
rxcntNumber of words for reading.
Note
Implemented as a function call.
SS pin is driven manually (as a basic GPIO pin).
See also
SPI_TxRxWord, SPI_TxRxByte, SPI_CommByte
#define SPI_CommByte (   module,
  txd,
  txcnt,
  rxd,
  rxcnt 
)

This macro transmits and receives whole data packet.

Parameters
moduleSPI0,SPI1.
txdPointer to buffer where writing data is stored.
txcntNumber of bytes for writing.
rxdPointer to buffer where reading data will be saved.
rxcntNumber of bytes for reading.
Note
Implemented as a function call.
SS pin is driven manually (as a basic GPIO pin).
See also
SPI_TxRxWord, SPI_TxRxByte, SPI_CommWord
#define SPI_PutWordToFifo (   module,
  txd,
  txcnt 
)

This macro writes whole data packet to the SPI transmit FIFO.

Parameters
moduleSPI1.
txdPointer to buffer where writing data is stored.
txcntNumber of words for writing.
Note
Implemented as a function call.
See also
SPI_PutWord, SPI_PutByte, SPI_PutByteToFifo
#define SPI_PutByteToFifo (   module,
  txd,
  txcnt 
)

This macro writes whole data packet to the SPI transmit FIFO.

Parameters
moduleSPI1.
txdPointer to buffer where writing data is stored.
txcntNumber of bytes for writing.
Note
Implemented as a function call.
See also
SPI_PutWord, SPI_PutByte, SPI_PutWordToFifo
#define SPI_GetWordFromFifo (   module,
  rxd,
  rxcnt 
)

This macro saves 16-bit data from the SPI receive FIFO.

Parameters
moduleSPI1.
rxdPointer to buffer where reading data will be saved.
rxcntNumber of words for reading.
Note
Implemented as a function call.
See also
SPI_GetWord, SPI_GetByte, SPI_GetByteFromFifo
#define SPI_GetByteFromFifo (   module,
  rxd,
  rxcnt 
)

This macro saves 8-bit data packet from the SPI receive FIFO.

Parameters
moduleSPI1.
rxdPointer to buffer where reading data will be saved.
rxcntNumber of bytes for reading.
Note
Implemented as a function call.
See also
SPI_GetWord, SPI_GetByte, SPI_GetWordFromFifo
#define SPI_InstallCallback (   ip,
  callback 
)

This function installs callback function for SPI interrupt vector 20.

Parameters
ipSelect one of the ARM Cortex-M0+ Interrupt Priority Levels.
callbackPointer to the SPI Callback Function.
Note
Implemented as a function call.
See also
SPI_Init
#define SPI_Init (   module,
  cfg,
  call2 
)

This macro initializes selected SPI module.

Parameters
moduleSPI0,SPI1
cfgSelect one of SPI Configuration Structures.
call2Pointer to SPI Slave Select Control Callback Function where SS pin is manually driven.
Note
Implemented as a function call.
See also
SPI_InstallCallback