ISF  2.1
Intelligent Sensing Framework for Kinetis with Processor Expert
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Spi_hal

Files

file  fsl_spi_hal.h
 fsl_spi_hal.h defines structures and types for the spi master HAL layer.
 

Data Structures

struct  SpiConfig
 SPI hardware configuration settings. More...
 

Typedefs

typedef enum _spi_errors spi_status_t
 Error codes for the SPI driver. More...
 
typedef enum _spi_master_slave_mode spi_master_slave_mode_t
 SPI master or slave configuration. More...
 
typedef enum _spi_clock_polarity spi_clock_polarity_t
 SPI clock polarity configuration. More...
 
typedef enum _spi_clock_phase spi_clock_phase_t
 SPI clock phase configuration. More...
 
typedef enum _spi_shift_direction spi_shift_direction_t
 SPI data shifter direction options. More...
 
typedef enum _spi_ss_output_mode spi_ss_output_mode_t
 SPI slave select output mode options. More...
 
typedef enum _spi_pin_mode spi_pin_mode_t
 SPI pin mode options. More...
 
typedef struct SpiConfig spi_config_t
 SPI hardware configuration settings. More...
 

Enumerations

enum  _spi_errors {
  kStatus_SPI_Success = 0, kStatus_SPI_SlaveTxUnderrun, kStatus_SPI_SlaveRxOverrun, kStatus_SPI_Timeout,
  kStatus_SPI_Busy, kStatus_SPI_NoTransferInProgress, kStatus_SPI_Error
}
 Error codes for the SPI driver. More...
 
enum  _spi_master_slave_mode { kSpiMaster = 1, kSpiSlave = 0 }
 SPI master or slave configuration. More...
 
enum  _spi_clock_polarity { kSpiClockPolarity_ActiveHigh = 0, kSpiClockPolarity_ActiveLow = 1 }
 SPI clock polarity configuration. More...
 
enum  _spi_clock_phase { kSpiClockPhase_FirstEdge = 0, kSpiClockPhase_SecondEdge = 1 }
 SPI clock phase configuration. More...
 
enum  _spi_shift_direction { kSpiMsbFirst = 0, kSpiLsbFirst = 1 }
 SPI data shifter direction options. More...
 
enum  _spi_ss_output_mode { kSpiSlaveSelect_AsGpio = 0, kSpiSlaveSelect_FaultInput = 2, kSpiSlaveSelect_AutomaticOutput = 3 }
 SPI slave select output mode options. More...
 
enum  _spi_pin_mode { kSpiPinMode_Normal = 0, kSpiPinMode_Input = 1, kSpiPinMode_Output = 3 }
 SPI pin mode options. More...
 

Detailed Description

Typedef Documentation

SPI clock phase configuration.

SPI clock polarity configuration.

typedef struct SpiConfig spi_config_t

SPI hardware configuration settings.

Use an instance of this struct with spi_hal_init(). This allows you to configure the

most common settings of the SPI peripheral with a single function call.

The kbitsPerSec member is handled specially. If this value is set to 0, then the baud is

not set by spi_hal_init(), and must be set with a separate call to either spi_hal_set_baud()

or spi_hal_set_baud_divisors(). This can be useful if you know the divisors in advance and

don't want to spend the time to compute them for the provided rate in kilobits/sec.

SPI master or slave configuration.

SPI pin mode options.

SPI data shifter direction options.

SPI slave select output mode options.

typedef enum _spi_errors spi_status_t

Error codes for the SPI driver.

Enumeration Type Documentation

SPI clock phase configuration.

Enumerator
kSpiClockPhase_FirstEdge 

First edge on SPSCK occurs at the middle of the first cycle of a data transfer.

kSpiClockPhase_SecondEdge 

First edge on SPSCK occurs at the start of the first cycle of a data transfer.

Definition at line 56 of file fsl_spi_hal.h.

SPI clock polarity configuration.

Enumerator
kSpiClockPolarity_ActiveHigh 

Active-high SPI clock (idles low).

kSpiClockPolarity_ActiveLow 

Active-low SPI clock (idles high).

Definition at line 50 of file fsl_spi_hal.h.

Error codes for the SPI driver.

Enumerator
kStatus_SPI_Success 
kStatus_SPI_SlaveTxUnderrun 

SPI Slave TX Underrun error.

kStatus_SPI_SlaveRxOverrun 

SPI Slave RX Overrun error.

kStatus_SPI_Timeout 

SPI tranfser timed out.

kStatus_SPI_Busy 

SPI instance is already busy performing a transfer.

kStatus_SPI_NoTransferInProgress 

Attempt to abort a transfer when no transfer was in progress.

kStatus_SPI_Error 

SPI Error.

Definition at line 32 of file fsl_spi_hal.h.

SPI master or slave configuration.

Enumerator
kSpiMaster 

SPI peripheral operates in master mode.

kSpiSlave 

SPI peripheral operates in slave mode.

Definition at line 44 of file fsl_spi_hal.h.

SPI pin mode options.

Enumerator
kSpiPinMode_Normal 

Pins operate in normal, single-direction mode.

kSpiPinMode_Input 

Bidirectional mode. Master: MOSI pin is input; Slave: MISO pin is input

kSpiPinMode_Output 

Bidirectional mode. Master: MOSI pin is output; Slave: MISO pin is output

Definition at line 75 of file fsl_spi_hal.h.

SPI data shifter direction options.

Enumerator
kSpiMsbFirst 

Data transfers start with most significant bit.

kSpiLsbFirst 

Data transfers start with least significant bit.

Definition at line 62 of file fsl_spi_hal.h.

SPI slave select output mode options.

Enumerator
kSpiSlaveSelect_AsGpio 

Slave select pin configured as GPIO.

kSpiSlaveSelect_FaultInput 

Slave select pin configured for fault detection.

kSpiSlaveSelect_AutomaticOutput 

Slave select pin configured for automatic SPI output.

Definition at line 68 of file fsl_spi_hal.h.