stm32f10x_spi.c File Reference

This file provides all the SPI firmware functions. More...

#include "stm32f10x_spi.h"
#include "stm32f10x_rcc.h"

Go to the source code of this file.

Defines

#define CR1_CLEAR_Mask   ((uint16_t)0x3040)
#define CR1_CRCEN_Reset   ((uint16_t)0xDFFF)
#define CR1_CRCEN_Set   ((uint16_t)0x2000)
#define CR1_CRCNext_Set   ((uint16_t)0x1000)
#define CR1_SPE_Reset   ((uint16_t)0xFFBF)
#define CR1_SPE_Set   ((uint16_t)0x0040)
#define CR2_SSOE_Reset   ((uint16_t)0xFFFB)
#define CR2_SSOE_Set   ((uint16_t)0x0004)
#define I2S2_CLOCK_SRC   ((uint32_t)(0x00020000))
#define I2S3_CLOCK_SRC   ((uint32_t)(0x00040000))
#define I2S_DIV_MASK   ((uint32_t)(0x000000F0))
#define I2S_Mode_Select   ((uint16_t)0x0800)
#define I2S_MUL_MASK   ((uint32_t)(0x0000F000))
#define I2SCFGR_CLEAR_Mask   ((uint16_t)0xF040)
#define I2SCFGR_I2SE_Reset   ((uint16_t)0xFBFF)
#define I2SCFGR_I2SE_Set   ((uint16_t)0x0400)
#define SPI_Mode_Select   ((uint16_t)0xF7FF)

Functions

void I2S_Cmd (SPI_TypeDef *SPIx, FunctionalState NewState)
 Enables or disables the specified SPI peripheral (in I2S mode).
void I2S_Init (SPI_TypeDef *SPIx, I2S_InitTypeDef *I2S_InitStruct)
 Initializes the SPIx peripheral according to the specified parameters in the I2S_InitStruct.
void I2S_StructInit (I2S_InitTypeDef *I2S_InitStruct)
 Fills each I2S_InitStruct member with its default value.
void SPI_BiDirectionalLineConfig (SPI_TypeDef *SPIx, uint16_t SPI_Direction)
 Selects the data transfer direction in bi-directional mode for the specified SPI.
void SPI_CalculateCRC (SPI_TypeDef *SPIx, FunctionalState NewState)
 Enables or disables the CRC value calculation of the transfered bytes.
void SPI_Cmd (SPI_TypeDef *SPIx, FunctionalState NewState)
 Enables or disables the specified SPI peripheral.
void SPI_DataSizeConfig (SPI_TypeDef *SPIx, uint16_t SPI_DataSize)
 Configures the data size for the selected SPI.
uint16_t SPI_GetCRC (SPI_TypeDef *SPIx, uint8_t SPI_CRC)
 Returns the transmit or the receive CRC register value for the specified SPI.
uint16_t SPI_GetCRCPolynomial (SPI_TypeDef *SPIx)
 Returns the CRC Polynomial register value for the specified SPI.
void SPI_I2S_ClearFlag (SPI_TypeDef *SPIx, uint16_t SPI_I2S_FLAG)
 Clears the SPIx CRC Error (CRCERR) flag.
void SPI_I2S_ClearITPendingBit (SPI_TypeDef *SPIx, uint8_t SPI_I2S_IT)
 Clears the SPIx CRC Error (CRCERR) interrupt pending bit.
void SPI_I2S_DeInit (SPI_TypeDef *SPIx)
 Deinitializes the SPIx peripheral registers to their default reset values (Affects also the I2Ss).
void SPI_I2S_DMACmd (SPI_TypeDef *SPIx, uint16_t SPI_I2S_DMAReq, FunctionalState NewState)
 Enables or disables the SPIx/I2Sx DMA interface.
FlagStatus SPI_I2S_GetFlagStatus (SPI_TypeDef *SPIx, uint16_t SPI_I2S_FLAG)
 Checks whether the specified SPI/I2S flag is set or not.
ITStatus SPI_I2S_GetITStatus (SPI_TypeDef *SPIx, uint8_t SPI_I2S_IT)
 Checks whether the specified SPI/I2S interrupt has occurred or not.
void SPI_I2S_ITConfig (SPI_TypeDef *SPIx, uint8_t SPI_I2S_IT, FunctionalState NewState)
 Enables or disables the specified SPI/I2S interrupts.
uint16_t SPI_I2S_ReceiveData (SPI_TypeDef *SPIx)
 Returns the most recent received data by the SPIx/I2Sx peripheral.
void SPI_I2S_SendData (SPI_TypeDef *SPIx, uint16_t Data)
 Transmits a Data through the SPIx/I2Sx peripheral.
void SPI_Init (SPI_TypeDef *SPIx, SPI_InitTypeDef *SPI_InitStruct)
 Initializes the SPIx peripheral according to the specified parameters in the SPI_InitStruct.
void SPI_NSSInternalSoftwareConfig (SPI_TypeDef *SPIx, uint16_t SPI_NSSInternalSoft)
 Configures internally by software the NSS pin for the selected SPI.
void SPI_SSOutputCmd (SPI_TypeDef *SPIx, FunctionalState NewState)
 Enables or disables the SS output for the selected SPI.
void SPI_StructInit (SPI_InitTypeDef *SPI_InitStruct)
 Fills each SPI_InitStruct member with its default value.
void SPI_TransmitCRC (SPI_TypeDef *SPIx)
 Transmit the SPIx CRC value.

Detailed Description

This file provides all the SPI firmware functions.

Author:
MCD Application Team
Version:
V3.4.0
Date:
10/15/2010

THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.

© COPYRIGHT 2010 STMicroelectronics

Definition in file stm32f10x_spi.c.

STM32F10x Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM32(CORTEX M3) 32-bit Microcontrollers platform visit  www.st.com/STM32