43 uint32_t
USPI_Open(
USPI_T *uspi, uint32_t u32MasterSlave, uint32_t u32SPIMode, uint32_t u32DataWidth, uint32_t u32BusClock)
45 uint32_t u32ClkDiv = 0ul;
47 uint32_t u32UspiClk = 0ul;
58 if(u32BusClock != 0ul)
60 u32ClkDiv = (uint32_t) ((((((u32Pclk/2ul)*10ul)/(u32BusClock))+5ul)/10ul)-1ul);
69 if(u32DataWidth == 16ul)
92 uspi->
PROTCTL |= (u32MasterSlave | u32SPIMode);
99 if(u32BusClock != 0ul)
101 u32UspiClk = (uint32_t)( u32Pclk / ((u32ClkDiv+1ul)<<1) );
183 u32ClkDiv = (uint32_t) ((((((u32Pclk/2ul)*10ul)/(u32BusClock))+5ul)/10ul)-1ul);
189 return ( u32Pclk / ((u32ClkDiv+1ul)<<1) );
402 uint32_t u32IntFlag = 0ul;
585 uint32_t u32Flag = 0ul;
#define USPI_BRGEN_CLKDIV_Pos
#define USPI_PROTCTL_AUTOSS_Msk
#define USPI_WKCTL_WKEN_Msk
#define USPI_SSACT_INT_MASK
#define USPI_CTLIN0_ININV_Msk
void USPI_ClearTxBuf(USPI_T *uspi)
Clear Tx buffer.
void USPI_Close(USPI_T *uspi)
Disable USCI_SPI function mode.
#define USPI_TX_FULL_MASK
#define USPI_TX_EMPTY_MASK
#define USPI_RX_EMPTY_MASK
#define USPI_RX_FULL_MASK
#define USPI_BUFCTL_RXCLR_Msk
uint32_t USPI_GetIntFlag(USPI_T *uspi, uint32_t u32Mask)
Get interrupt flag.
uint32_t USPI_GetBusClock(USPI_T *uspi)
Get the actual frequency of USCI_SPI bus clock. Only available in Master mode.
#define USPI_INTEN_TXENDIEN_Msk
#define USPI_PROTIEN_SSINAIEN_Msk
#define USPI_INTEN_TXSTIEN_Msk
#define USPI_SSINACT_INT_MASK
NuMicro peripheral access layer header file.
#define USPI_RXEND_INT_MASK
#define USPI_BUFSTS_TXEMPTY_Msk
#define USPI_PROTSTS_SLVTOIF_Msk
#define USPI_PROTCTL_SLAVE_Msk
#define USPI_BUFSTS_RXFULL_Msk
#define USPI_CTL_FUNMODE_Msk
uint32_t USPI_GetStatus(USPI_T *uspi, uint32_t u32Mask)
Get USCI_SPI status.
#define USPI_PROTSTS_RXENDIF_Msk
void USPI_EnableAutoSS(USPI_T *uspi, uint32_t u32SSPinMask, uint32_t u32ActiveLevel)
Enable the automatic slave select function. Only available in Master mode.
#define USPI_PROTCTL_SS_Msk
#define USPI_PROTSTS_SSLINE_Msk
uint32_t CLK_GetPCLK1Freq(void)
Get PCLK1 frequency.
#define USPI_TXUDR_INT_MASK
uint32_t USPI_Open(USPI_T *uspi, uint32_t u32MasterSlave, uint32_t u32SPIMode, uint32_t u32DataWidth, uint32_t u32BusClock)
This function make USCI_SPI module be ready to transfer. By default, the USCI_SPI transfer sequence i...
#define USPI_BUFCTL_TXCLR_Msk
uint32_t CLK_GetPCLK0Freq(void)
Get PCLK0 frequency.
#define USPI_PROTSTS_TXENDIF_Msk
#define USPI_PROTSTS_SSINAIF_Msk
#define USPI_PROTIEN_SLVBEIEN_Msk
#define USPI_INTEN_RXSTIEN_Msk
void USPI_ClearRxBuf(USPI_T *uspi)
Clear Rx buffer.
#define USPI_LINECTL_DWIDTH_Pos
void USPI_ClearIntFlag(USPI_T *uspi, uint32_t u32Mask)
Clear interrupt flag.
#define USPI_TXST_INT_MASK
#define USPI_BUFSTS_RXEMPTY_Msk
#define USPI_SLVBE_INT_MASK
#define USPI_PROTCTL_SCLKMODE_Msk
uint32_t USPI_SetBusClock(USPI_T *uspi, uint32_t u32BusClock)
Set the USCI_SPI bus clock. Only available in Master mode.
#define USPI_BUFCTL_RXOVIEN_Msk
#define USPI_PROTSTS_SSACTIF_Msk
#define USPI_PROTSTS_BUSY_Msk
#define USPI_BUFSTS_RXOVIF_Msk
void USPI_DisableWakeup(USPI_T *uspi)
Disable USCI_SPI Wake-up Function.
#define USPI_LINECTL_CTLOINV_Msk
#define USPI_BRGEN_CLKDIV_Msk
#define USPI_PROTIEN_SSACTIEN_Msk
#define USPI_BUFSTS_TXFULL_Msk
#define USPI_INTEN_RXENDIEN_Msk
#define USPI_SSLINE_STS_MASK
#define USPI_RXST_INT_MASK
void USPI_EnableInt(USPI_T *uspi, uint32_t u32Mask)
Enable related interrupts specified by u32Mask parameter.
void USPI_DisableInt(USPI_T *uspi, uint32_t u32Mask)
Disable related interrupts specified by u32Mask parameter.
#define USPI_TXEND_INT_MASK
void USPI_EnableWakeup(USPI_T *uspi)
Enable USCI_SPI Wake-up Function.
#define USPI_PROTIEN_SLVTOIEN_Msk
#define USPI_PROTSTS_SLVBEIF_Msk
#define USPI_LINECTL_LSB_Msk
#define USPI_CTL_FUNMODE_Pos
#define USPI_LINECTL_DWIDTH_Msk
#define USPI_PROTCTL_PROTEN_Msk
#define USPI_BUFCTL_TXUDRIEN_Msk
#define USPI_SLVTO_INT_MASK
#define USPI_PROTSTS_RXSTIF_Msk
void USPI_DisableAutoSS(USPI_T *uspi)
Disable the automatic slave select function.
#define USPI_RXOV_INT_MASK
#define USPI_BUFSTS_TXUDRIF_Msk
#define USPI_PROTSTS_TXSTIF_Msk