| MINI55_BSP V3.03.000 The Board Support Package for Mini55 Series MCU

Macros | Functions
spi.h File Reference

MINI55 series SPI driver header file. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Macros
#define | SPI_MODE_0 (SPI_CTL_TXNEG_Msk)
#define | SPI_MODE_1 (SPI_CTL_RXNEG_Msk)
#define | SPI_MODE_2 (SPI_CTL_CLKPOL_Msk | SPI_CTL_RXNEG_Msk)
#define | SPI_MODE_3 (SPI_CTL_CLKPOL_Msk | SPI_CTL_TXNEG_Msk)
#define | SPI_SLAVE (SPI_CTL_SLAVE_Msk)
#define | SPI_MASTER (0x0)
#define | SPI_SS (SPI_SSCTL_SS_Msk)
#define | SPI_SS_ACTIVE_HIGH (SPI_SSCTL_SSACTPOL_Msk)
#define | SPI_SS_ACTIVE_LOW (0x0)
#define | SPI_IE_MASK (0x01)
#define | SPI_SSTA_INTEN_MASK (0x04)
#define | SPI_FIFO_TX_INTEN_MASK (0x08)
#define | SPI_FIFO_RX_INTEN_MASK (0x10)
#define | SPI_FIFO_RXOV_INTEN_MASK (0x20)
#define | SPI_FIFO_TIMEOUT_INTEN_MASK (0x40)
#define | SPI_ABORT_3WIRE_TRANSFER(spi) ( (spi)->SLVCTL |= SPI_SLVCTL_SLVABT_Msk )
| Abort the current transfer in slave 3-wire mode. More...
#define | SPI_CLR_3WIRE_START_INT_FLAG(spi) ( (spi)->STATUS = SPI_STATUS_SLVSTIF_Msk )
| Clear the slave 3-wire mode start interrupt flag. More...
#define | SPI_CLR_UNIT_TRANS_INT_FLAG(spi) ( (spi)->STATUS = SPI_STATUS_UNITIF_Msk )
| Clear the unit transfer interrupt flag. More...
#define | SPI_DISABLE_3WIRE_MODE(spi) ( (spi)->SLVCTL &= ~SPI_SLVCTL_SLV3WIRE_Msk )
| Disable slave 3-wire mode. More...
#define | SPI_ENABLE_3WIRE_MODE(spi) ( (spi)->SLVCTL |= SPI_SLVCTL_SLV3WIRE_Msk )
| Enable slave 3-wire mode. More...
#define | SPI_GET_RX_FIFO_COUNT(spi) ( (((spi)->STATUS & SPI_STATUS_RXCNT_Msk) >> SPI_STATUS_RXCNT_Pos) & 0xf )
| Get the count of available data in RX FIFO. More...
#define | SPI_GET_RX_FIFO_EMPTY_FLAG(spi) ( ((spi)->STATUS & SPI_STATUS_RXEMPTY_Msk) == SPI_STATUS_RXEMPTY_Msk ? 1:0 )
| Get the Rx FIFO empty flag. More...
#define | SPI_GET_TX_FIFO_EMPTY_FLAG(spi) ( ((spi)->STATUS & SPI_STATUS_TXEMPTY_Msk) == SPI_STATUS_TXEMPTY_Msk ? 1:0 )
| Get the Tx FIFO empty flag. More...
#define | SPI_GET_TX_FIFO_FULL_FLAG(spi) ( ((spi)->STATUS & SPI_STATUS_TXFULL_Msk) == SPI_STATUS_TXFULL_Msk ? 1:0 )
| Get the Tx FIFO full flag. More...
#define | SPI_READ_RX(spi) ( (spi)->RX )
| Get the datum read from Rx FIFO. More...
#define | SPI_WRITE_TX(spi, u32TxData) ( (spi)->TX = u32TxData )
| Write datum to TX register. More...
#define | SPI_ENABLE_BYTE_REORDER(spi) ( (spi)->CTL |= SPI_CTL_REORDER_Msk )
| Enable byte reorder function. More...
#define | SPI_DISABLE_BYTE_REORDER(spi) ( (spi)->CTL &= ~SPI_CTL_REORDER_Msk )
| Disable byte reorder function. More...
#define | SPI_SET_SUSPEND_CYCLE(spi, u32SuspCycle) ( (spi)->CTL = ((spi)->CTL & ~SPI_CTL_SUSPITV_Msk) | (u32SuspCycle << SPI_CTL_SUSPITV_Pos) )
| Set the length of suspend interval. More...
#define | SPI_SET_LSB_FIRST(spi) ( (spi)->CTL |= SPI_CTL_LSB_Msk )
| Set the SPI transfer sequence with LSB first. More...
#define | SPI_SET_MSB_FIRST(spi) ( (spi)->CTL &= ~SPI_CTL_LSB_Msk )
| Set the SPI transfer sequence with MSB first. More...
#define | SPI_IS_BUSY(spi) ( ((spi)->CTL & SPI_CTL_SPIEN_Msk) == SPI_CTL_SPIEN_Msk ? 1:0 )
| Get the SPI busy state. More...
#define | SPI_TRIGGER(spi) ( (spi)->CTL |= SPI_CTL_SPIEN_Msk )
| Set the GO_BUSY bit to trigger SPI transfer. More...

## Functions
static __INLINE void | SPI_SET_SS_HIGH (SPI_T *spi)
| Disable automatic slave select function and set SPI_SS pin to high state. More...
static __INLINE void | SPI_SET_SS_LOW (SPI_T *spi)
| Disable automatic slave select function and set SPI_SS pin to low state. More...
static __INLINE void | SPI_SET_DATA_WIDTH (SPI_T *spi, uint32_t u32Width)
| Set the data width of a SPI transaction. More...
uint32_t | SPI_Open (SPI_T *spi, uint32_t u32MasterSlave, uint32_t u32SPIMode, uint32_t u32DataWidth, uint32_t u32BusClock)
| This function make SPI module be ready to transfer. By default, the SPI transfer sequence is MSB first and the automatic slave select function is disabled. In Slave mode, the u32BusClock must be NULL and the SPI clock divider setting will be 0. More...
void | SPI_Close (SPI_T *spi)
| Reset SPI module and disable SPI peripheral clock. More...
void | SPI_ClearRxFIFO (SPI_T *spi)
| Clear Rx FIFO buffer. More...
void | SPI_ClearTxFIFO (SPI_T *spi)
| Clear Tx FIFO buffer. More...
void | SPI_DisableAutoSS (SPI_T *spi)
| Disable the automatic slave select function. More...
void | SPI_EnableAutoSS (SPI_T *spi, uint32_t u32SSPinMask, uint32_t u32ActiveLevel)
| Enable the automatic slave select function. Only available in Master mode. More...
uint32_t | SPI_SetBusClock (SPI_T *spi, uint32_t u32BusClock)
| Set the SPI bus clock. Only available in Master mode. More...
void | SPI_EnableFIFO (SPI_T *spi, uint32_t u32TxThreshold, uint32_t u32RxThreshold)
| Enable FIFO mode with user-specified Tx FIFO threshold and Rx FIFO threshold configurations. More...
void | SPI_DisableFIFO (SPI_T *spi)
| Disable FIFO mode. More...
uint32_t | SPI_GetBusClock (SPI_T *spi)
| Get the actual frequency of SPI bus clock. Only available in Master mode. More...
void | SPI_EnableInt (SPI_T *spi, uint32_t u32Mask)
| Enable FIFO related interrupts specified by u32Mask parameter. More...
void | SPI_DisableInt (SPI_T *spi, uint32_t u32Mask)
| Disable FIFO related interrupts specified by u32Mask parameter. More...

## Detailed Description

MINI55 series SPI driver header file.

Version
  V1.00

Revision
  7

Date
  15/06/29 11:16a

Note
  SPDX-License-Identifier: Apache-2.0 Copyright (C) 2014 Nuvoton Technology Corp. All rights reserved.

Definition in file spi.h.