Home » Source Code » » stm32f10x_spi.h

stm32f10x_spi.h ( File view )

From:
Description:...
  • By aaa923124003 2018-04-22
  • View(s):0
  • Download(s):0
  • Point(s): 1
			/**
  ******************************************************************************
  * @file    stm32f10x_spi.h
  * @author  MCD Application Team
  * @version V3.5.0
  * @date    11-March-2011
  * @brief   This file contains all the functions prototypes for the SPI firmware 
  *          library.
  ******************************************************************************
  * @attention
  *
  * 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.
  *
  * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
  ******************************************************************************
  */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F10x_SPI_H
#define __STM32F10x_SPI_H

#ifdef __cplusplus
 extern "C" {

#endif

/* Includes ------------------------------------------------------------------*/
#include "stm32f10x.h"

/** @addtogroup STM32F10x_StdPeriph_Driver
  * @{

  */

/** @addtogroup SPI
  * @{

  */ 

/** @defgroup SPI_Exported_Types
  * @{

  */

/** 
  * @brief  SPI Init structure definition  
  */

typedef struct
{

  uint16_t SPI_Direction;           /*!< Specifies the SPI unidirectional or bidirectional data mode.
                                         This parameter can be a value of @ref SPI_data_direction */

  uint16_t SPI_Mode;                /*!< Specifies the SPI operating mode.
                                         This parameter can be a value of @ref SPI_mode */

  uint16_t SPI_DataSize;            /*!< Specifies the SPI data size.
                                         This parameter can be a value of @ref SPI_data_size */

  uint16_t SPI_CPOL;                /*!< Specifies the serial clock steady state.
                                         This parameter can be a value of @ref SPI_Clock_Polarity */

  uint16_t SPI_CPHA;                /*!< Specifies the clock active edge for the bit capture.
                                         This parameter can be a value of @ref SPI_Clock_Phase */

  uint16_t SPI_NSS;                 /*!< Specifies whether the NSS signal is managed by
                                         hardware (NSS pin) or by software using the SSI bit.
                                         This parameter can be a value of @ref SPI_Slave_Select_management */
 
  uint16_t SPI_BaudRatePrescaler;   /*!< Specifies the Baud Rate prescaler value which will be
                                         used to configure the transmit and receive SCK clock.
                                         This parameter can be a value of @ref SPI_BaudRate_Prescaler.
                                         @note The communication clock is derived from the master
                                               clock. The slave clock does not need to be set. */

  uint16_t SPI_FirstBit;            /*!< Specifies whether data transfers start from MSB or LSB bit.
                                         This parameter can be a value of @ref SPI_MSB_LSB_transmission */

  uint16_t SPI_CRCPolynomial;       /*!< Specifies the polynomial used for the CRC calculation. */

}SPI_InitTypeDef;

/** 
  * @brief  I2S Init structure definition  
  */

typedef struct
{


  uint16_t I2S_Mode;         /*!< Specifies the I2S operating mode.
                                  This parameter can be a value of @ref I2S_Mode */

  uint16_t I2S_Standard;     /*!< Specifies the standard used for the I2S communication.
                                  This parameter can be a value of @ref I2S_Standard */

  uint16_t I2S_DataFormat;   /*!< Specifies the data format for the I2S communication.
                                  This parameter can be a value of @ref I2S_Data_Format */

  uint16_t I2S_MCLKOutput;   /*!< Specifies whether the I2S MCLK output is enabled or not.
                                  This parameter can be a value of @ref I2S_MCLK_Output */

  uint32_t I2S_AudioFreq;    /*!< Specifies the frequency selected for the I2S communication.
                                  This parameter can be a value of @ref I2S_Audio_Frequency */

  uint16_t I2S_CPOL;         /*!< Specifies the idle state of the I2S clock.
                                  This parameter can be a value of @ref I2S_Clock_Polarity */

}I2S_InitTypeDef;

/**
  * @
}
  */

/** @defgroup SPI_Exported_Constants
  * @{

  */

#define IS_SPI_ALL_PERIPH(PERIPH) (((PERIPH) == SPI1) || \
                                   ((PERIPH) == SPI2) || \
                                   ((PERIPH) == SPI3))

#define IS_SPI_23_PERIPH(PERIPH) (((PERIPH) == SPI2) || \
                                  ((PERIPH) == SPI3))

/** @defgroup SPI_data_direction 
  * @{

  */
  
#define SPI_Direction_2Lines_FullDuplex ((uint16_t)0x0000)
#define SPI_Direction_2Lines_RxOnly     ((uint16_t)0x0400)
#define SPI_Direction_1Line_Rx          ((uint16_t)0x8000)
#define SPI_Direction_1Line_Tx          ((uint16_t)0xC000)
#define IS_SPI_DIRECTION_MODE(MODE) (((MODE) == SPI_Direction_2Lines_FullDuplex) || \
                                     ((MODE) == SPI_Direction_2Lines_RxOnly) || \
                                     ((MODE) == SPI_Direction_1Line_Rx) || \
                                     ((MODE) == SPI_Direction_1Line_Tx))
/**
  * @
}
  */

/** @defgroup SPI_mode 
  * @{

  */

#define SPI_Mode_Master                 ((uint16_t)0x0104)
#define SPI_Mode_Slave                  ((uint16_t)0x0000)
#define IS_SPI_MODE(MODE) (((MODE) == SPI_Mode_Master) || \
                           ((MODE) == SPI_Mode_Slave))
/**
  * @
}
  */

/** @defgroup SPI_data_size 
  * @{

  */

#define SPI_DataSize_16b                ((uint16_t)0x0800)
#define SPI_DataSize_8b                 ((uint16_t)0x0000)
#define IS_SPI_DATASIZE(DATASIZE) (((DATASIZE) == SPI_DataSize_16b) || \
                                   ((DATASIZE) == SPI_DataSize_8b))
/**
  * @
}
  */ 

/** @defgroup SPI_Clock_Polarity 
  * @{

  */

#define SPI_CPOL_Low                    ((uint16_t)0x0000)
#define SPI_CPOL_High                   ((uint16_t)0x0002)
#define IS_SPI_CPOL(CPOL) (((CPOL) == SPI_CPOL_Low) || \
                           ((CPOL) == SPI_CPOL_High))
/**
  * @
}
  */

/** @defgroup SPI_Clock_Phase 
  * @{

  */

#define SPI_CPHA_1Edge                  ((uint16_t)0x0000)
#define SPI_CPHA_2Edge                  ((uint16_t)0x0001)
#define IS_SPI_CPHA(CPHA) (((CPHA) == SPI_CPHA_1Edge) || \
                           ((CPHA) == SPI_CPHA_2Edge))
/**
  * @
}
  */

/** @defgroup SPI_Slave_Select_management 
  * @{

  */

#define SPI_NSS_Soft                    ((uint16_t)0x0200)
#define SPI_NSS_Hard                    ((uint16_t)0x0000)
#define IS_SPI_NSS(NSS) (((NSS) == SPI_NSS_Soft) || \
                         ((NSS) == SPI_NSS_Hard))
/**
  * @
}
  */ 

/** @defgroup SPI_BaudRate_Prescaler 
  * @{

  */

#define SPI_BaudRatePrescaler_2         ((uint16_t)0x0000)
#define SPI_BaudRatePrescaler_4         ((uint16_t)0x0008)
#define SPI_BaudRatePrescaler_8         ((uint16_t)0x0010)
#define SPI_BaudRatePrescaler_16        ((uint16_t)0x0018)
#define SPI_BaudRatePrescaler_32        ((uint16_t)0x0020)
#define SPI_BaudRatePrescaler_64        ((uint16_t)0x0028)
#define SPI_BaudRatePrescaler_128       ((uint16_t)0x0030)
#define SPI_BaudRatePrescaler_256       ((uint16_t)0x0038)
#define IS_SPI_BAUDRATE_PRESCALER(PRESCALER) (((PRESCALER) == SPI_BaudRatePrescaler_2) || \
                                              ((PRESCALER) == SPI_BaudRatePrescaler_4) || \
                                              ((PRESCALER) == SPI_BaudRatePrescaler_8) || \
                                              ((PRESCALER) == SPI_BaudRatePrescaler_16) || \
                                              ((PRESCALER) == SPI_BaudRatePrescaler_32) || \
                                              ((PRESCALER) == SPI_BaudRatePrescaler_64) || \
                                              ((PRESCALER) == SPI_BaudRatePrescaler_128) || \
                                              ((PRESCALER) == SPI_BaudRatePrescaler_256))
/**
  * @
}
  */ 

/** @defgroup SPI_MSB_LSB_transmission 
  * @{

  */

#define SPI_FirstBit_MSB                ((uint16_t)0x0000)
#define SPI_FirstBit_LSB                ((uint16_t)0x0080)
#define IS_SPI_FIRST_BIT(BIT) (((BIT) == SPI_FirstBit_MSB) || \
                               ((BIT) == SPI_FirstBit_LSB))
/**
  * @
}
  */

/** @defgroup I2S_Mode 
  * @{

  */

#define I2S_Mode_SlaveTx                ((uint16_t)0x0000)
#define I2S_Mode_SlaveRx                ((uint16_t)0x0100)
#define I2S_Mode_MasterTx               ((uint16_t)0x0200)
#define I2S_Mode_MasterRx               ((uint16_t)0x0300)
#define IS_I2S_MODE(MODE) (((MODE) == I2S_Mode_SlaveTx) || \
                           ((MODE) == I2S_Mode_SlaveRx) || \
                           ((MODE) == I2S_Mode_MasterTx) || \
                           ((MODE) == I2S_Mode_MasterRx) )
/**
  * @
}
  */

/** @defgroup I2S_Standard 
  * @{

  */

#define I2S_Standard_Phillips           ((uint16_t)0x0000)
#define I2S_Standard_MSB                ((uint16_t)0x0010)
#define I2S_Standard_LSB                ((uint16_t)0x0020)
#define I2S_Standard_PCMShort           ((uint16_t)0x0030)
#define I2S_Standard_PCMLong            ((uint16_t)0x00B0)
#define IS_I2S_STANDARD(STANDARD) (((STANDARD) == I2S_Standard_Phillips) || \
                                   ((STANDARD) == I2S_Standard_MSB) || \
                                   ((STANDARD) == I2S_Standard_LSB) || \
                                   ((STANDARD) == I2S_Standard_PCMShort) || \
                                   ((STANDARD) == I2S_Standar
...
...
(Not finished, please download and read the complete file)
			
...
Expand> <Close

Want complete source code? Download it here

Point(s): 1

Download
0 lines left, continue to read
Sponsored links

File list

Tips: You can preview the content of files by clicking file names^_^
Name Size Date
01.97 kB
01.97 kB
core_cm3.c16.87 kB2010-06-07 10:25
core_cm3.h83.71 kB2011-02-09 14:59
startup_stm32f10x_hd.s15.14 kB2011-03-10 10:52
01.97 kB
01.97 kB
misc.h8.77 kB2011-03-10 10:47
stm32f10x_adc.h21.18 kB2011-03-10 10:47
stm32f10x_bkp.h7.38 kB2011-03-10 10:47
stm32f10x_can.h26.91 kB2011-03-10 10:47
stm32f10x_cec.h6.42 kB2011-03-10 10:47
stm32f10x_crc.h2.11 kB2011-03-10 10:47
stm32f10x_dac.h14.88 kB2011-03-10 10:47
stm32f10x_dbgmcu.h3.73 kB2011-03-10 10:47
stm32f10x_dma.h20.27 kB2011-03-10 10:47
stm32f10x_exti.h6.66 kB2011-03-10 10:47
stm32f10x_flash.h24.85 kB2011-03-10 10:47
stm32f10x_fsmc.h26.38 kB2011-03-10 10:47
stm32f10x_gpio.h19.70 kB2017-10-13 22:36
stm32f10x_i2c.h29.33 kB2011-03-10 10:47
stm32f10x_iwdg.h3.74 kB2011-03-10 10:47
stm32f10x_pwr.h4.28 kB2011-03-10 10:47
stm32f10x_rcc.h29.74 kB2011-03-10 10:47
stm32f10x_rtc.h3.77 kB2011-03-10 10:47
stm32f10x_sdio.h21.35 kB2011-03-10 10:47
stm32f10x_spi.h17.31 kB2011-03-10 10:47
stm32f10x_tim.h51.20 kB2011-03-10 10:47
stm32f10x_usart.h16.16 kB2011-03-10 10:47
stm32f10x_wwdg.h2.90 kB2011-03-10 10:47
01.97 kB
misc.c6.88 kB2011-03-10 10:47
stm32f10x_adc.c46.09 kB2011-03-10 10:47
stm32f10x_bkp.c8.26 kB2011-03-10 10:47
stm32f10x_can.c44.05 kB2011-03-10 10:47
stm32f10x_cec.c11.38 kB2011-03-10 10:47
stm32f10x_crc.c3.27 kB2011-03-10 10:47
stm32f10x_dac.c18.64 kB2011-03-10 10:47
stm32f10x_dbgmcu.c5.03 kB2011-03-10 10:47
stm32f10x_dma.c28.91 kB2011-03-10 10:47
stm32f10x_exti.c6.80 kB2011-03-10 10:47
stm32f10x_flash.c61.08 kB2011-03-10 10:47
stm32f10x_fsmc.c34.65 kB2011-03-10 10:47
stm32f10x_gpio.c22.68 kB2011-03-11 17:43
stm32f10x_i2c.c44.71 kB2011-03-10 10:47
stm32f10x_iwdg.c4.80 kB2011-03-10 10:47
stm32f10x_pwr.c8.55 kB2011-03-10 10:47
stm32f10x_rcc.c50.07 kB2011-03-10 10:47
stm32f10x_rtc.c8.40 kB2011-03-10 10:47
stm32f10x_sdio.c28.25 kB2011-03-10 10:47
stm32f10x_spi.c29.52 kB2011-03-10 10:47
stm32f10x_tim.c106.60 kB2011-03-10 10:47
stm32f10x_usart.c37.41 kB2011-03-10 10:47
stm32f10x_wwdg.c5.60 kB2011-03-10 10:47
01.97 kB
morot.c2.52 kB2017-12-17 23:08
motor.h1.57 kB2017-12-17 23:09
01.97 kB
core_cm3.crf3.57 kB2017-12-17 23:19
core_cm3.d104.00 B2017-12-17 23:19
core_cm3.o10.54 kB2017-12-17 23:19
delay.crf341.66 kB2017-12-17 23:19
delay.d1.41 kB2017-12-17 23:19
delay.o373.57 kB2017-12-17 23:19
main.crf348.30 kB2017-12-17 23:19
main.d1.50 kB2017-12-17 23:19
main.o381.77 kB2017-12-17 23:19
misc.crf340.19 kB2017-12-17 23:19
misc.d1.33 kB2017-12-17 23:19
misc.o370.69 kB2017-12-17 23:19
morot.crf347.94 kB2017-12-17 23:19
morot.d1.43 kB2017-12-17 23:19
morot.o378.45 kB2017-12-17 23:19
remote.crf346.86 kB2017-12-17 23:19
remote.d1.57 kB2017-12-17 23:19
remote.o379.29 kB2017-12-17 23:19
startup_stm32f10x_hd.d63.00 B2017-12-17 23:19
startup_stm32f10x_hd.o6.65 kB2017-12-17 23:19
stm32f10x_adc.crf347.19 kB2017-12-17 23:19
stm32f10x_adc.d1.62 kB2017-12-17 23:19
stm32f10x_adc.o384.34 kB2017-12-17 23:19
stm32f10x_bkp.crf341.11 kB2017-12-17 23:19
stm32f10x_bkp.d1.62 kB2017-12-17 23:19
stm32f10x_bkp.o373.05 kB2017-12-17 23:19
stm32f10x_can.crf348.76 kB2017-12-17 23:19
stm32f10x_can.d1.62 kB2017-12-17 23:19
stm32f10x_can.o381.59 kB2017-12-17 23:19
stm32f10x_cec.crf341.65 kB2017-12-17 23:19
stm32f10x_cec.d1.62 kB2017-12-17 23:19
stm32f10x_cec.o373.47 kB2017-12-17 23:19
stm32f10x_crc.crf339.75 kB2017-12-17 23:19
stm32f10x_crc.d1.62 kB2017-12-17 23:19
stm32f10x_crc.o370.60 kB2017-12-17 23:19
stm32f10x_dac.crf341.78 kB2017-12-17 23:19
stm32f10x_dac.d1.62 kB2017-12-17 23:19
stm32f10x_dac.o373.62 kB2017-12-17 23:19
stm32f10x_dbgmcu.crf339.55 kB2017-12-17 23:19
stm32f10x_dbgmcu.d1.72 kB2017-12-17 23:19
stm32f10x_dbgmcu.o369.86 kB2017-12-17 23:19
stm32f10x_dma.crf343.22 kB2017-12-17 23:19
stm32f10x_dma.d1.62 kB2017-12-17 23:19
stm32f10x_dma.o374.23 kB2017-12-17 23:19
stm32f10x_exti.crf340.73 kB2017-12-17 23:19
stm32f10x_exti.d1.65 kB2017-12-17 23:19
stm32f10x_exti.o371.53 kB2017-12-17 23:19
stm32f10x_flash.crf347.03 kB2017-12-17 23:19
stm32f10x_flash.d1.69 kB2017-12-17 23:19
stm32f10x_flash.o380.89 kB2017-12-17 23:19
stm32f10x_fsmc.crf345.57 kB2017-12-17 23:19
stm32f10x_fsmc.d1.65 kB2017-12-17 23:19
stm32f10x_fsmc.o377.03 kB2017-12-17 23:19
stm32f10x_gpio.crf343.60 kB2017-12-17 23:19
stm32f10x_gpio.d1.65 kB2017-12-17 23:19
stm32f10x_gpio.o376.90 kB2017-12-17 23:19
stm32f10x_i2c.crf345.98 kB2017-12-17 23:19
stm32f10x_i2c.d1.62 kB2017-12-17 23:19
stm32f10x_i2c.o382.00 kB2017-12-17 23:19
stm32f10x_it.crf339.63 kB2017-12-17 23:19
stm32f10x_it.d1.54 kB2017-12-17 23:19
stm32f10x_it.o371.13 kB2017-12-17 23:19
stm32f10x_iwdg.crf339.85 kB2017-12-17 23:19
stm32f10x_iwdg.d1.65 kB2017-12-17 23:19
stm32f10x_iwdg.o370.51 kB2017-12-17 23:19
stm32f10x_pwr.crf341.02 kB2017-12-17 23:19
stm32f10x_pwr.d1.62 kB2017-12-17 23:19
stm32f10x_pwr.o372.05 kB2017-12-17 23:19
stm32f10x_rcc.crf347.10 kB2017-12-17 23:19
stm32f10x_rcc.d1.62 kB2017-12-17 23:19
stm32f10x_rcc.o381.23 kB2017-12-17 23:19
stm32f10x_rtc.crf341.02 kB2017-12-17 23:19
stm32f10x_rtc.d1.62 kB2017-12-17 23:19
stm32f10x_rtc.o372.94 kB2017-12-17 23:19
stm32f10x_sdio.crf344.20 kB2017-12-17 23:19
stm32f10x_sdio.d1.65 kB2017-12-17 23:19
stm32f10x_sdio.o378.45 kB2017-12-17 23:19
stm32f10x_spi.crf344.07 kB2017-12-17 23:19
stm32f10x_spi.d1.62 kB2017-12-17 23:19
stm32f10x_spi.o378.19 kB2017-12-17 23:19
stm32f10x_tim.crf361.76 kB2017-12-17 23:19
stm32f10x_tim.d1.62 kB2017-12-17 23:19
stm32f10x_tim.o404.37 kB2017-12-17 23:19
stm32f10x_usart.crf345.67 kB2017-12-17 23:19
stm32f10x_usart.d1.69 kB2017-12-17 23:19
stm32f10x_usart.o380.94 kB2017-12-17 23:19
stm32f10x_wwdg.crf340.29 kB2017-12-17 23:19
stm32f10x_wwdg.d1.65 kB2017-12-17 23:19
stm32f10x_wwdg.o371.44 kB2017-12-17 23:19
sys.crf342.48 kB2017-12-17 23:19
sys.d1.30 kB2017-12-17 23:19
sys.o375.83 kB2017-12-17 23:19
system_stm32f10x.crf341.32 kB2017-12-17 23:19
system_stm32f10x.d1.62 kB2017-12-17 23:19
system_stm32f10x.o371.02 kB2017-12-17 23:19
template.axf555.93 kB2017-12-17 23:19
template.build_log.htm204.00 B2017-12-18 10:43
template.hex31.47 kB2017-12-17 23:19
template.htm81.13 kB2017-12-17 23:19
template.lnp1.09 kB2017-12-17 23:19
template.sct479.00 B2017-11-26 10:06
usart.crf346.12 kB2017-12-17 23:19
usart.d1.46 kB2017-12-17 23:19
usart.o376.92 kB2017-12-17 23:19
01.97 kB
remote.c5.26 kB2017-12-07 12:43
remote.h877.00 B2017-12-07 12:51
01.97 kB
01.97 kB
delay.c7.74 kB2017-12-06 20:53
delay.h1.94 kB2017-12-06 20:53
01.97 kB
sys.c5.10 kB2017-12-17 23:19
sys.h2.98 kB2017-12-17 23:19
01.97 kB
usart.c4.97 kB2015-03-23 12:28
usart.h1.25 kB2012-09-13 14:17
01.97 kB
main.c4.46 kB2017-12-17 23:19
Release_Notes.html29.41 kB2011-04-06 18:15
startup_stm32f10x_hd.lst49.81 kB2017-12-17 23:19
stm32f10x.h619.08 kB2011-03-10 10:51
stm32f10x_conf.h3.18 kB2017-10-14 09:49
stm32f10x_it.c4.30 kB2011-04-04 19:03
stm32f10x_it.h2.04 kB2011-04-04 19:03
system_stm32f10x.c35.70 kB2011-04-04 19:03
system_stm32f10x.h2.04 kB2011-03-10 10:51
template.build_log.htm7.28 kB2017-10-14 09:38
template.map89.78 kB2017-12-17 23:19
template.uvgui.ZHENG70.76 kB2017-12-18 10:43
template.uvgui_ZHENG.bak70.58 kB2017-12-14 10:32
template.uvopt19.72 kB2017-12-07 15:36
template.uvproj21.42 kB2017-12-07 15:36
template_Target55.85 kB2017-12-17 23:19
template_uvopt.bak18.77 kB2017-11-26 10:06
template_uvproj.bak20.94 kB2017-11-26 10:06
...
Sponsored links

stm32f10x_spi.h (6.40 MB)

Need 1 point
Your Point(s)

Your Point isn't enough.

Get point immediately by PayPal

More(Debit card / Credit card / PayPal Credit / Online Banking)

Submit your source codes. Get more point

LOGIN

Don't have an account? Register now
Need any help?
Mail to: support@codeforge.com

切换到中文版?

CodeForge Chinese Version
CodeForge English Version

Where are you going?

^_^"Oops ...

Sorry!This guy is mysterious, its blog hasn't been opened, try another, please!
OK

Warm tip!

CodeForge to FavoriteFavorite by Ctrl+D