mbed library sources

Dependents:   frdm_kl05z_gpio_test

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Fri Mar 21 11:45:09 2014 +0000
Revision:
130:1dec54e4aec3
Synchronized with git revision e5c9ff6781a4e277a5a454e5a0b037f76e31739d

Full URL: https://github.com/mbedmicro/mbed/commit/e5c9ff6781a4e277a5a454e5a0b037f76e31739d/

STM32F0-Discovery (STM32F051R8) initial port

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 130:1dec54e4aec3 1 /**
mbed_official 130:1dec54e4aec3 2 ******************************************************************************
mbed_official 130:1dec54e4aec3 3 * @file stm32f0xx_spi.h
mbed_official 130:1dec54e4aec3 4 * @author MCD Application Team
mbed_official 130:1dec54e4aec3 5 * @version V1.3.0
mbed_official 130:1dec54e4aec3 6 * @date 16-January-2014
mbed_official 130:1dec54e4aec3 7 * @brief This file contains all the functions prototypes for the SPI
mbed_official 130:1dec54e4aec3 8 * firmware library.
mbed_official 130:1dec54e4aec3 9 ******************************************************************************
mbed_official 130:1dec54e4aec3 10 * @attention
mbed_official 130:1dec54e4aec3 11 *
mbed_official 130:1dec54e4aec3 12 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
mbed_official 130:1dec54e4aec3 13 *
mbed_official 130:1dec54e4aec3 14 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 130:1dec54e4aec3 15 * are permitted provided that the following conditions are met:
mbed_official 130:1dec54e4aec3 16 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 130:1dec54e4aec3 17 * this list of conditions and the following disclaimer.
mbed_official 130:1dec54e4aec3 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 130:1dec54e4aec3 19 * this list of conditions and the following disclaimer in the documentation
mbed_official 130:1dec54e4aec3 20 * and/or other materials provided with the distribution.
mbed_official 130:1dec54e4aec3 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 130:1dec54e4aec3 22 * may be used to endorse or promote products derived from this software
mbed_official 130:1dec54e4aec3 23 * without specific prior written permission.
mbed_official 130:1dec54e4aec3 24 *
mbed_official 130:1dec54e4aec3 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 130:1dec54e4aec3 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 130:1dec54e4aec3 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 130:1dec54e4aec3 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 130:1dec54e4aec3 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 130:1dec54e4aec3 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 130:1dec54e4aec3 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 130:1dec54e4aec3 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 130:1dec54e4aec3 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 130:1dec54e4aec3 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 130:1dec54e4aec3 35 *
mbed_official 130:1dec54e4aec3 36 ******************************************************************************
mbed_official 130:1dec54e4aec3 37 */
mbed_official 130:1dec54e4aec3 38
mbed_official 130:1dec54e4aec3 39 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 130:1dec54e4aec3 40 #ifndef __STM32F0XX_SPI_H
mbed_official 130:1dec54e4aec3 41 #define __STM32F0XX_SPI_H
mbed_official 130:1dec54e4aec3 42
mbed_official 130:1dec54e4aec3 43 #ifdef __cplusplus
mbed_official 130:1dec54e4aec3 44 extern "C" {
mbed_official 130:1dec54e4aec3 45 #endif
mbed_official 130:1dec54e4aec3 46
mbed_official 130:1dec54e4aec3 47 /* Includes ------------------------------------------------------------------*/
mbed_official 130:1dec54e4aec3 48 #include "stm32f0xx.h"
mbed_official 130:1dec54e4aec3 49
mbed_official 130:1dec54e4aec3 50 /** @addtogroup STM32F0xx_StdPeriph_Driver
mbed_official 130:1dec54e4aec3 51 * @{
mbed_official 130:1dec54e4aec3 52 */
mbed_official 130:1dec54e4aec3 53
mbed_official 130:1dec54e4aec3 54 /** @addtogroup SPI
mbed_official 130:1dec54e4aec3 55 * @{
mbed_official 130:1dec54e4aec3 56 */
mbed_official 130:1dec54e4aec3 57
mbed_official 130:1dec54e4aec3 58 /* Exported types ------------------------------------------------------------*/
mbed_official 130:1dec54e4aec3 59
mbed_official 130:1dec54e4aec3 60 /**
mbed_official 130:1dec54e4aec3 61 * @brief SPI Init structure definition
mbed_official 130:1dec54e4aec3 62 */
mbed_official 130:1dec54e4aec3 63
mbed_official 130:1dec54e4aec3 64 typedef struct
mbed_official 130:1dec54e4aec3 65 {
mbed_official 130:1dec54e4aec3 66 uint16_t SPI_Direction; /*!< Specifies the SPI unidirectional or bidirectional data mode.
mbed_official 130:1dec54e4aec3 67 This parameter can be a value of @ref SPI_data_direction */
mbed_official 130:1dec54e4aec3 68
mbed_official 130:1dec54e4aec3 69 uint16_t SPI_Mode; /*!< Specifies the SPI mode (Master/Slave).
mbed_official 130:1dec54e4aec3 70 This parameter can be a value of @ref SPI_mode */
mbed_official 130:1dec54e4aec3 71
mbed_official 130:1dec54e4aec3 72 uint16_t SPI_DataSize; /*!< Specifies the SPI data size.
mbed_official 130:1dec54e4aec3 73 This parameter can be a value of @ref SPI_data_size */
mbed_official 130:1dec54e4aec3 74
mbed_official 130:1dec54e4aec3 75 uint16_t SPI_CPOL; /*!< Specifies the serial clock steady state.
mbed_official 130:1dec54e4aec3 76 This parameter can be a value of @ref SPI_Clock_Polarity */
mbed_official 130:1dec54e4aec3 77
mbed_official 130:1dec54e4aec3 78 uint16_t SPI_CPHA; /*!< Specifies the clock active edge for the bit capture.
mbed_official 130:1dec54e4aec3 79 This parameter can be a value of @ref SPI_Clock_Phase */
mbed_official 130:1dec54e4aec3 80
mbed_official 130:1dec54e4aec3 81 uint16_t SPI_NSS; /*!< Specifies whether the NSS signal is managed by
mbed_official 130:1dec54e4aec3 82 hardware (NSS pin) or by software using the SSI bit.
mbed_official 130:1dec54e4aec3 83 This parameter can be a value of @ref SPI_Slave_Select_management */
mbed_official 130:1dec54e4aec3 84
mbed_official 130:1dec54e4aec3 85 uint16_t SPI_BaudRatePrescaler; /*!< Specifies the Baud Rate prescaler value which will be
mbed_official 130:1dec54e4aec3 86 used to configure the transmit and receive SCK clock.
mbed_official 130:1dec54e4aec3 87 This parameter can be a value of @ref SPI_BaudRate_Prescaler
mbed_official 130:1dec54e4aec3 88 @note The communication clock is derived from the master
mbed_official 130:1dec54e4aec3 89 clock. The slave clock does not need to be set. */
mbed_official 130:1dec54e4aec3 90
mbed_official 130:1dec54e4aec3 91 uint16_t SPI_FirstBit; /*!< Specifies whether data transfers start from MSB or LSB bit.
mbed_official 130:1dec54e4aec3 92 This parameter can be a value of @ref SPI_MSB_LSB_transmission */
mbed_official 130:1dec54e4aec3 93
mbed_official 130:1dec54e4aec3 94 uint16_t SPI_CRCPolynomial; /*!< Specifies the polynomial used for the CRC calculation. */
mbed_official 130:1dec54e4aec3 95 }SPI_InitTypeDef;
mbed_official 130:1dec54e4aec3 96
mbed_official 130:1dec54e4aec3 97
mbed_official 130:1dec54e4aec3 98 /**
mbed_official 130:1dec54e4aec3 99 * @brief I2S Init structure definition
mbed_official 130:1dec54e4aec3 100 * @note These parameters are not available for STM32F030 devices.
mbed_official 130:1dec54e4aec3 101 */
mbed_official 130:1dec54e4aec3 102
mbed_official 130:1dec54e4aec3 103 typedef struct
mbed_official 130:1dec54e4aec3 104 {
mbed_official 130:1dec54e4aec3 105 uint16_t I2S_Mode; /*!< Specifies the I2S operating mode.
mbed_official 130:1dec54e4aec3 106 This parameter can be a value of @ref SPI_I2S_Mode */
mbed_official 130:1dec54e4aec3 107
mbed_official 130:1dec54e4aec3 108 uint16_t I2S_Standard; /*!< Specifies the standard used for the I2S communication.
mbed_official 130:1dec54e4aec3 109 This parameter can be a value of @ref SPI_I2S_Standard */
mbed_official 130:1dec54e4aec3 110
mbed_official 130:1dec54e4aec3 111 uint16_t I2S_DataFormat; /*!< Specifies the data format for the I2S communication.
mbed_official 130:1dec54e4aec3 112 This parameter can be a value of @ref SPI_I2S_Data_Format */
mbed_official 130:1dec54e4aec3 113
mbed_official 130:1dec54e4aec3 114 uint16_t I2S_MCLKOutput; /*!< Specifies whether the I2S MCLK output is enabled or not.
mbed_official 130:1dec54e4aec3 115 This parameter can be a value of @ref SPI_I2S_MCLK_Output */
mbed_official 130:1dec54e4aec3 116
mbed_official 130:1dec54e4aec3 117 uint32_t I2S_AudioFreq; /*!< Specifies the frequency selected for the I2S communication.
mbed_official 130:1dec54e4aec3 118 This parameter can be a value of @ref SPI_I2S_Audio_Frequency */
mbed_official 130:1dec54e4aec3 119
mbed_official 130:1dec54e4aec3 120 uint16_t I2S_CPOL; /*!< Specifies the idle state of the I2S clock.
mbed_official 130:1dec54e4aec3 121 This parameter can be a value of @ref SPI_I2S_Clock_Polarity */
mbed_official 130:1dec54e4aec3 122 }I2S_InitTypeDef;
mbed_official 130:1dec54e4aec3 123
mbed_official 130:1dec54e4aec3 124 /* Exported constants --------------------------------------------------------*/
mbed_official 130:1dec54e4aec3 125
mbed_official 130:1dec54e4aec3 126 /** @defgroup SPI_Exported_Constants
mbed_official 130:1dec54e4aec3 127 * @{
mbed_official 130:1dec54e4aec3 128 */
mbed_official 130:1dec54e4aec3 129
mbed_official 130:1dec54e4aec3 130 #define IS_SPI_ALL_PERIPH(PERIPH) (((PERIPH) == SPI1) || \
mbed_official 130:1dec54e4aec3 131 ((PERIPH) == SPI2))
mbed_official 130:1dec54e4aec3 132
mbed_official 130:1dec54e4aec3 133 #define IS_SPI_1_PERIPH(PERIPH) (((PERIPH) == SPI1))
mbed_official 130:1dec54e4aec3 134
mbed_official 130:1dec54e4aec3 135 /** @defgroup SPI_data_direction
mbed_official 130:1dec54e4aec3 136 * @{
mbed_official 130:1dec54e4aec3 137 */
mbed_official 130:1dec54e4aec3 138
mbed_official 130:1dec54e4aec3 139 #define SPI_Direction_2Lines_FullDuplex ((uint16_t)0x0000)
mbed_official 130:1dec54e4aec3 140 #define SPI_Direction_2Lines_RxOnly ((uint16_t)0x0400)
mbed_official 130:1dec54e4aec3 141 #define SPI_Direction_1Line_Rx ((uint16_t)0x8000)
mbed_official 130:1dec54e4aec3 142 #define SPI_Direction_1Line_Tx ((uint16_t)0xC000)
mbed_official 130:1dec54e4aec3 143 #define IS_SPI_DIRECTION_MODE(MODE) (((MODE) == SPI_Direction_2Lines_FullDuplex) || \
mbed_official 130:1dec54e4aec3 144 ((MODE) == SPI_Direction_2Lines_RxOnly) || \
mbed_official 130:1dec54e4aec3 145 ((MODE) == SPI_Direction_1Line_Rx) || \
mbed_official 130:1dec54e4aec3 146 ((MODE) == SPI_Direction_1Line_Tx))
mbed_official 130:1dec54e4aec3 147 /**
mbed_official 130:1dec54e4aec3 148 * @}
mbed_official 130:1dec54e4aec3 149 */
mbed_official 130:1dec54e4aec3 150
mbed_official 130:1dec54e4aec3 151 /** @defgroup SPI_mode
mbed_official 130:1dec54e4aec3 152 * @{
mbed_official 130:1dec54e4aec3 153 */
mbed_official 130:1dec54e4aec3 154
mbed_official 130:1dec54e4aec3 155 #define SPI_Mode_Master ((uint16_t)0x0104)
mbed_official 130:1dec54e4aec3 156 #define SPI_Mode_Slave ((uint16_t)0x0000)
mbed_official 130:1dec54e4aec3 157 #define IS_SPI_MODE(MODE) (((MODE) == SPI_Mode_Master) || \
mbed_official 130:1dec54e4aec3 158 ((MODE) == SPI_Mode_Slave))
mbed_official 130:1dec54e4aec3 159 /**
mbed_official 130:1dec54e4aec3 160 * @}
mbed_official 130:1dec54e4aec3 161 */
mbed_official 130:1dec54e4aec3 162
mbed_official 130:1dec54e4aec3 163 /** @defgroup SPI_data_size
mbed_official 130:1dec54e4aec3 164 * @{
mbed_official 130:1dec54e4aec3 165 */
mbed_official 130:1dec54e4aec3 166
mbed_official 130:1dec54e4aec3 167 #define SPI_DataSize_4b ((uint16_t)0x0300)
mbed_official 130:1dec54e4aec3 168 #define SPI_DataSize_5b ((uint16_t)0x0400)
mbed_official 130:1dec54e4aec3 169 #define SPI_DataSize_6b ((uint16_t)0x0500)
mbed_official 130:1dec54e4aec3 170 #define SPI_DataSize_7b ((uint16_t)0x0600)
mbed_official 130:1dec54e4aec3 171 #define SPI_DataSize_8b ((uint16_t)0x0700)
mbed_official 130:1dec54e4aec3 172 #define SPI_DataSize_9b ((uint16_t)0x0800)
mbed_official 130:1dec54e4aec3 173 #define SPI_DataSize_10b ((uint16_t)0x0900)
mbed_official 130:1dec54e4aec3 174 #define SPI_DataSize_11b ((uint16_t)0x0A00)
mbed_official 130:1dec54e4aec3 175 #define SPI_DataSize_12b ((uint16_t)0x0B00)
mbed_official 130:1dec54e4aec3 176 #define SPI_DataSize_13b ((uint16_t)0x0C00)
mbed_official 130:1dec54e4aec3 177 #define SPI_DataSize_14b ((uint16_t)0x0D00)
mbed_official 130:1dec54e4aec3 178 #define SPI_DataSize_15b ((uint16_t)0x0E00)
mbed_official 130:1dec54e4aec3 179 #define SPI_DataSize_16b ((uint16_t)0x0F00)
mbed_official 130:1dec54e4aec3 180 #define IS_SPI_DATA_SIZE(SIZE) (((SIZE) == SPI_DataSize_4b) || \
mbed_official 130:1dec54e4aec3 181 ((SIZE) == SPI_DataSize_5b) || \
mbed_official 130:1dec54e4aec3 182 ((SIZE) == SPI_DataSize_6b) || \
mbed_official 130:1dec54e4aec3 183 ((SIZE) == SPI_DataSize_7b) || \
mbed_official 130:1dec54e4aec3 184 ((SIZE) == SPI_DataSize_8b) || \
mbed_official 130:1dec54e4aec3 185 ((SIZE) == SPI_DataSize_9b) || \
mbed_official 130:1dec54e4aec3 186 ((SIZE) == SPI_DataSize_10b) || \
mbed_official 130:1dec54e4aec3 187 ((SIZE) == SPI_DataSize_11b) || \
mbed_official 130:1dec54e4aec3 188 ((SIZE) == SPI_DataSize_12b) || \
mbed_official 130:1dec54e4aec3 189 ((SIZE) == SPI_DataSize_13b) || \
mbed_official 130:1dec54e4aec3 190 ((SIZE) == SPI_DataSize_14b) || \
mbed_official 130:1dec54e4aec3 191 ((SIZE) == SPI_DataSize_15b) || \
mbed_official 130:1dec54e4aec3 192 ((SIZE) == SPI_DataSize_16b))
mbed_official 130:1dec54e4aec3 193 /**
mbed_official 130:1dec54e4aec3 194 * @}
mbed_official 130:1dec54e4aec3 195 */
mbed_official 130:1dec54e4aec3 196
mbed_official 130:1dec54e4aec3 197 /** @defgroup SPI_CRC_length
mbed_official 130:1dec54e4aec3 198 * @{
mbed_official 130:1dec54e4aec3 199 */
mbed_official 130:1dec54e4aec3 200
mbed_official 130:1dec54e4aec3 201 #define SPI_CRCLength_8b ((uint16_t)0x0000)
mbed_official 130:1dec54e4aec3 202 #define SPI_CRCLength_16b SPI_CR1_CRCL
mbed_official 130:1dec54e4aec3 203 #define IS_SPI_CRC_LENGTH(LENGTH) (((LENGTH) == SPI_CRCLength_8b) || \
mbed_official 130:1dec54e4aec3 204 ((LENGTH) == SPI_CRCLength_16b))
mbed_official 130:1dec54e4aec3 205 /**
mbed_official 130:1dec54e4aec3 206 * @}
mbed_official 130:1dec54e4aec3 207 */
mbed_official 130:1dec54e4aec3 208
mbed_official 130:1dec54e4aec3 209 /** @defgroup SPI_Clock_Polarity
mbed_official 130:1dec54e4aec3 210 * @{
mbed_official 130:1dec54e4aec3 211 */
mbed_official 130:1dec54e4aec3 212
mbed_official 130:1dec54e4aec3 213 #define SPI_CPOL_Low ((uint16_t)0x0000)
mbed_official 130:1dec54e4aec3 214 #define SPI_CPOL_High SPI_CR1_CPOL
mbed_official 130:1dec54e4aec3 215 #define IS_SPI_CPOL(CPOL) (((CPOL) == SPI_CPOL_Low) || \
mbed_official 130:1dec54e4aec3 216 ((CPOL) == SPI_CPOL_High))
mbed_official 130:1dec54e4aec3 217 /**
mbed_official 130:1dec54e4aec3 218 * @}
mbed_official 130:1dec54e4aec3 219 */
mbed_official 130:1dec54e4aec3 220
mbed_official 130:1dec54e4aec3 221 /** @defgroup SPI_Clock_Phase
mbed_official 130:1dec54e4aec3 222 * @{
mbed_official 130:1dec54e4aec3 223 */
mbed_official 130:1dec54e4aec3 224
mbed_official 130:1dec54e4aec3 225 #define SPI_CPHA_1Edge ((uint16_t)0x0000)
mbed_official 130:1dec54e4aec3 226 #define SPI_CPHA_2Edge SPI_CR1_CPHA
mbed_official 130:1dec54e4aec3 227 #define IS_SPI_CPHA(CPHA) (((CPHA) == SPI_CPHA_1Edge) || \
mbed_official 130:1dec54e4aec3 228 ((CPHA) == SPI_CPHA_2Edge))
mbed_official 130:1dec54e4aec3 229 /**
mbed_official 130:1dec54e4aec3 230 * @}
mbed_official 130:1dec54e4aec3 231 */
mbed_official 130:1dec54e4aec3 232
mbed_official 130:1dec54e4aec3 233 /** @defgroup SPI_Slave_Select_management
mbed_official 130:1dec54e4aec3 234 * @{
mbed_official 130:1dec54e4aec3 235 */
mbed_official 130:1dec54e4aec3 236
mbed_official 130:1dec54e4aec3 237 #define SPI_NSS_Soft SPI_CR1_SSM
mbed_official 130:1dec54e4aec3 238 #define SPI_NSS_Hard ((uint16_t)0x0000)
mbed_official 130:1dec54e4aec3 239 #define IS_SPI_NSS(NSS) (((NSS) == SPI_NSS_Soft) || \
mbed_official 130:1dec54e4aec3 240 ((NSS) == SPI_NSS_Hard))
mbed_official 130:1dec54e4aec3 241 /**
mbed_official 130:1dec54e4aec3 242 * @}
mbed_official 130:1dec54e4aec3 243 */
mbed_official 130:1dec54e4aec3 244
mbed_official 130:1dec54e4aec3 245 /** @defgroup SPI_BaudRate_Prescaler
mbed_official 130:1dec54e4aec3 246 * @{
mbed_official 130:1dec54e4aec3 247 */
mbed_official 130:1dec54e4aec3 248
mbed_official 130:1dec54e4aec3 249 #define SPI_BaudRatePrescaler_2 ((uint16_t)0x0000)
mbed_official 130:1dec54e4aec3 250 #define SPI_BaudRatePrescaler_4 ((uint16_t)0x0008)
mbed_official 130:1dec54e4aec3 251 #define SPI_BaudRatePrescaler_8 ((uint16_t)0x0010)
mbed_official 130:1dec54e4aec3 252 #define SPI_BaudRatePrescaler_16 ((uint16_t)0x0018)
mbed_official 130:1dec54e4aec3 253 #define SPI_BaudRatePrescaler_32 ((uint16_t)0x0020)
mbed_official 130:1dec54e4aec3 254 #define SPI_BaudRatePrescaler_64 ((uint16_t)0x0028)
mbed_official 130:1dec54e4aec3 255 #define SPI_BaudRatePrescaler_128 ((uint16_t)0x0030)
mbed_official 130:1dec54e4aec3 256 #define SPI_BaudRatePrescaler_256 ((uint16_t)0x0038)
mbed_official 130:1dec54e4aec3 257 #define IS_SPI_BAUDRATE_PRESCALER(PRESCALER) (((PRESCALER) == SPI_BaudRatePrescaler_2) || \
mbed_official 130:1dec54e4aec3 258 ((PRESCALER) == SPI_BaudRatePrescaler_4) || \
mbed_official 130:1dec54e4aec3 259 ((PRESCALER) == SPI_BaudRatePrescaler_8) || \
mbed_official 130:1dec54e4aec3 260 ((PRESCALER) == SPI_BaudRatePrescaler_16) || \
mbed_official 130:1dec54e4aec3 261 ((PRESCALER) == SPI_BaudRatePrescaler_32) || \
mbed_official 130:1dec54e4aec3 262 ((PRESCALER) == SPI_BaudRatePrescaler_64) || \
mbed_official 130:1dec54e4aec3 263 ((PRESCALER) == SPI_BaudRatePrescaler_128) || \
mbed_official 130:1dec54e4aec3 264 ((PRESCALER) == SPI_BaudRatePrescaler_256))
mbed_official 130:1dec54e4aec3 265 /**
mbed_official 130:1dec54e4aec3 266 * @}
mbed_official 130:1dec54e4aec3 267 */
mbed_official 130:1dec54e4aec3 268
mbed_official 130:1dec54e4aec3 269 /** @defgroup SPI_MSB_LSB_transmission
mbed_official 130:1dec54e4aec3 270 * @{
mbed_official 130:1dec54e4aec3 271 */
mbed_official 130:1dec54e4aec3 272
mbed_official 130:1dec54e4aec3 273 #define SPI_FirstBit_MSB ((uint16_t)0x0000)
mbed_official 130:1dec54e4aec3 274 #define SPI_FirstBit_LSB SPI_CR1_LSBFIRST
mbed_official 130:1dec54e4aec3 275 #define IS_SPI_FIRST_BIT(BIT) (((BIT) == SPI_FirstBit_MSB) || \
mbed_official 130:1dec54e4aec3 276 ((BIT) == SPI_FirstBit_LSB))
mbed_official 130:1dec54e4aec3 277 /**
mbed_official 130:1dec54e4aec3 278 * @}
mbed_official 130:1dec54e4aec3 279 */
mbed_official 130:1dec54e4aec3 280
mbed_official 130:1dec54e4aec3 281 /** @defgroup SPI_I2S_Mode
mbed_official 130:1dec54e4aec3 282 * @{
mbed_official 130:1dec54e4aec3 283 */
mbed_official 130:1dec54e4aec3 284
mbed_official 130:1dec54e4aec3 285 #define I2S_Mode_SlaveTx ((uint16_t)0x0000)
mbed_official 130:1dec54e4aec3 286 #define I2S_Mode_SlaveRx ((uint16_t)0x0100)
mbed_official 130:1dec54e4aec3 287 #define I2S_Mode_MasterTx ((uint16_t)0x0200)
mbed_official 130:1dec54e4aec3 288 #define I2S_Mode_MasterRx ((uint16_t)0x0300)
mbed_official 130:1dec54e4aec3 289 #define IS_I2S_MODE(MODE) (((MODE) == I2S_Mode_SlaveTx) || \
mbed_official 130:1dec54e4aec3 290 ((MODE) == I2S_Mode_SlaveRx) || \
mbed_official 130:1dec54e4aec3 291 ((MODE) == I2S_Mode_MasterTx)|| \
mbed_official 130:1dec54e4aec3 292 ((MODE) == I2S_Mode_MasterRx))
mbed_official 130:1dec54e4aec3 293 /**
mbed_official 130:1dec54e4aec3 294 * @}
mbed_official 130:1dec54e4aec3 295 */
mbed_official 130:1dec54e4aec3 296
mbed_official 130:1dec54e4aec3 297 /** @defgroup SPI_I2S_Standard
mbed_official 130:1dec54e4aec3 298 * @{
mbed_official 130:1dec54e4aec3 299 */
mbed_official 130:1dec54e4aec3 300
mbed_official 130:1dec54e4aec3 301 #define I2S_Standard_Phillips ((uint16_t)0x0000)
mbed_official 130:1dec54e4aec3 302 #define I2S_Standard_MSB ((uint16_t)0x0010)
mbed_official 130:1dec54e4aec3 303 #define I2S_Standard_LSB ((uint16_t)0x0020)
mbed_official 130:1dec54e4aec3 304 #define I2S_Standard_PCMShort ((uint16_t)0x0030)
mbed_official 130:1dec54e4aec3 305 #define I2S_Standard_PCMLong ((uint16_t)0x00B0)
mbed_official 130:1dec54e4aec3 306 #define IS_I2S_STANDARD(STANDARD) (((STANDARD) == I2S_Standard_Phillips) || \
mbed_official 130:1dec54e4aec3 307 ((STANDARD) == I2S_Standard_MSB) || \
mbed_official 130:1dec54e4aec3 308 ((STANDARD) == I2S_Standard_LSB) || \
mbed_official 130:1dec54e4aec3 309 ((STANDARD) == I2S_Standard_PCMShort) || \
mbed_official 130:1dec54e4aec3 310 ((STANDARD) == I2S_Standard_PCMLong))
mbed_official 130:1dec54e4aec3 311 /**
mbed_official 130:1dec54e4aec3 312 * @}
mbed_official 130:1dec54e4aec3 313 */
mbed_official 130:1dec54e4aec3 314
mbed_official 130:1dec54e4aec3 315 /** @defgroup SPI_I2S_Data_Format
mbed_official 130:1dec54e4aec3 316 * @{
mbed_official 130:1dec54e4aec3 317 */
mbed_official 130:1dec54e4aec3 318
mbed_official 130:1dec54e4aec3 319 #define I2S_DataFormat_16b ((uint16_t)0x0000)
mbed_official 130:1dec54e4aec3 320 #define I2S_DataFormat_16bextended ((uint16_t)0x0001)
mbed_official 130:1dec54e4aec3 321 #define I2S_DataFormat_24b ((uint16_t)0x0003)
mbed_official 130:1dec54e4aec3 322 #define I2S_DataFormat_32b ((uint16_t)0x0005)
mbed_official 130:1dec54e4aec3 323 #define IS_I2S_DATA_FORMAT(FORMAT) (((FORMAT) == I2S_DataFormat_16b) || \
mbed_official 130:1dec54e4aec3 324 ((FORMAT) == I2S_DataFormat_16bextended) || \
mbed_official 130:1dec54e4aec3 325 ((FORMAT) == I2S_DataFormat_24b) || \
mbed_official 130:1dec54e4aec3 326 ((FORMAT) == I2S_DataFormat_32b))
mbed_official 130:1dec54e4aec3 327 /**
mbed_official 130:1dec54e4aec3 328 * @}
mbed_official 130:1dec54e4aec3 329 */
mbed_official 130:1dec54e4aec3 330
mbed_official 130:1dec54e4aec3 331 /** @defgroup SPI_I2S_MCLK_Output
mbed_official 130:1dec54e4aec3 332 * @{
mbed_official 130:1dec54e4aec3 333 */
mbed_official 130:1dec54e4aec3 334
mbed_official 130:1dec54e4aec3 335 #define I2S_MCLKOutput_Enable SPI_I2SPR_MCKOE
mbed_official 130:1dec54e4aec3 336 #define I2S_MCLKOutput_Disable ((uint16_t)0x0000)
mbed_official 130:1dec54e4aec3 337 #define IS_I2S_MCLK_OUTPUT(OUTPUT) (((OUTPUT) == I2S_MCLKOutput_Enable) || \
mbed_official 130:1dec54e4aec3 338 ((OUTPUT) == I2S_MCLKOutput_Disable))
mbed_official 130:1dec54e4aec3 339 /**
mbed_official 130:1dec54e4aec3 340 * @}
mbed_official 130:1dec54e4aec3 341 */
mbed_official 130:1dec54e4aec3 342
mbed_official 130:1dec54e4aec3 343 /** @defgroup SPI_I2S_Audio_Frequency
mbed_official 130:1dec54e4aec3 344 * @{
mbed_official 130:1dec54e4aec3 345 */
mbed_official 130:1dec54e4aec3 346
mbed_official 130:1dec54e4aec3 347 #define I2S_AudioFreq_192k ((uint32_t)192000)
mbed_official 130:1dec54e4aec3 348 #define I2S_AudioFreq_96k ((uint32_t)96000)
mbed_official 130:1dec54e4aec3 349 #define I2S_AudioFreq_48k ((uint32_t)48000)
mbed_official 130:1dec54e4aec3 350 #define I2S_AudioFreq_44k ((uint32_t)44100)
mbed_official 130:1dec54e4aec3 351 #define I2S_AudioFreq_32k ((uint32_t)32000)
mbed_official 130:1dec54e4aec3 352 #define I2S_AudioFreq_22k ((uint32_t)22050)
mbed_official 130:1dec54e4aec3 353 #define I2S_AudioFreq_16k ((uint32_t)16000)
mbed_official 130:1dec54e4aec3 354 #define I2S_AudioFreq_11k ((uint32_t)11025)
mbed_official 130:1dec54e4aec3 355 #define I2S_AudioFreq_8k ((uint32_t)8000)
mbed_official 130:1dec54e4aec3 356 #define I2S_AudioFreq_Default ((uint32_t)2)
mbed_official 130:1dec54e4aec3 357
mbed_official 130:1dec54e4aec3 358 #define IS_I2S_AUDIO_FREQ(FREQ) ((((FREQ) >= I2S_AudioFreq_8k) && \
mbed_official 130:1dec54e4aec3 359 ((FREQ) <= I2S_AudioFreq_192k)) || \
mbed_official 130:1dec54e4aec3 360 ((FREQ) == I2S_AudioFreq_Default))
mbed_official 130:1dec54e4aec3 361 /**
mbed_official 130:1dec54e4aec3 362 * @}
mbed_official 130:1dec54e4aec3 363 */
mbed_official 130:1dec54e4aec3 364
mbed_official 130:1dec54e4aec3 365 /** @defgroup SPI_I2S_Clock_Polarity
mbed_official 130:1dec54e4aec3 366 * @{
mbed_official 130:1dec54e4aec3 367 */
mbed_official 130:1dec54e4aec3 368
mbed_official 130:1dec54e4aec3 369 #define I2S_CPOL_Low ((uint16_t)0x0000)
mbed_official 130:1dec54e4aec3 370 #define I2S_CPOL_High SPI_I2SCFGR_CKPOL
mbed_official 130:1dec54e4aec3 371 #define IS_I2S_CPOL(CPOL) (((CPOL) == I2S_CPOL_Low) || \
mbed_official 130:1dec54e4aec3 372 ((CPOL) == I2S_CPOL_High))
mbed_official 130:1dec54e4aec3 373 /**
mbed_official 130:1dec54e4aec3 374 * @}
mbed_official 130:1dec54e4aec3 375 */
mbed_official 130:1dec54e4aec3 376
mbed_official 130:1dec54e4aec3 377 /** @defgroup SPI_FIFO_reception_threshold
mbed_official 130:1dec54e4aec3 378 * @{
mbed_official 130:1dec54e4aec3 379 */
mbed_official 130:1dec54e4aec3 380
mbed_official 130:1dec54e4aec3 381 #define SPI_RxFIFOThreshold_HF ((uint16_t)0x0000)
mbed_official 130:1dec54e4aec3 382 #define SPI_RxFIFOThreshold_QF SPI_CR2_FRXTH
mbed_official 130:1dec54e4aec3 383 #define IS_SPI_RX_FIFO_THRESHOLD(THRESHOLD) (((THRESHOLD) == SPI_RxFIFOThreshold_HF) || \
mbed_official 130:1dec54e4aec3 384 ((THRESHOLD) == SPI_RxFIFOThreshold_QF))
mbed_official 130:1dec54e4aec3 385 /**
mbed_official 130:1dec54e4aec3 386 * @}
mbed_official 130:1dec54e4aec3 387 */
mbed_official 130:1dec54e4aec3 388
mbed_official 130:1dec54e4aec3 389 /** @defgroup SPI_I2S_DMA_transfer_requests
mbed_official 130:1dec54e4aec3 390 * @{
mbed_official 130:1dec54e4aec3 391 */
mbed_official 130:1dec54e4aec3 392
mbed_official 130:1dec54e4aec3 393 #define SPI_I2S_DMAReq_Tx SPI_CR2_TXDMAEN
mbed_official 130:1dec54e4aec3 394 #define SPI_I2S_DMAReq_Rx SPI_CR2_RXDMAEN
mbed_official 130:1dec54e4aec3 395 #define IS_SPI_I2S_DMA_REQ(REQ) ((((REQ) & (uint16_t)0xFFFC) == 0x00) && ((REQ) != 0x00))
mbed_official 130:1dec54e4aec3 396 /**
mbed_official 130:1dec54e4aec3 397 * @}
mbed_official 130:1dec54e4aec3 398 */
mbed_official 130:1dec54e4aec3 399
mbed_official 130:1dec54e4aec3 400 /** @defgroup SPI_last_DMA_transfers
mbed_official 130:1dec54e4aec3 401 * @{
mbed_official 130:1dec54e4aec3 402 */
mbed_official 130:1dec54e4aec3 403
mbed_official 130:1dec54e4aec3 404 #define SPI_LastDMATransfer_TxEvenRxEven ((uint16_t)0x0000)
mbed_official 130:1dec54e4aec3 405 #define SPI_LastDMATransfer_TxOddRxEven ((uint16_t)0x4000)
mbed_official 130:1dec54e4aec3 406 #define SPI_LastDMATransfer_TxEvenRxOdd ((uint16_t)0x2000)
mbed_official 130:1dec54e4aec3 407 #define SPI_LastDMATransfer_TxOddRxOdd ((uint16_t)0x6000)
mbed_official 130:1dec54e4aec3 408 #define IS_SPI_LAST_DMA_TRANSFER(TRANSFER) (((TRANSFER) == SPI_LastDMATransfer_TxEvenRxEven) || \
mbed_official 130:1dec54e4aec3 409 ((TRANSFER) == SPI_LastDMATransfer_TxOddRxEven) || \
mbed_official 130:1dec54e4aec3 410 ((TRANSFER) == SPI_LastDMATransfer_TxEvenRxOdd) || \
mbed_official 130:1dec54e4aec3 411 ((TRANSFER) == SPI_LastDMATransfer_TxOddRxOdd))
mbed_official 130:1dec54e4aec3 412 /**
mbed_official 130:1dec54e4aec3 413 * @}
mbed_official 130:1dec54e4aec3 414 */
mbed_official 130:1dec54e4aec3 415 /** @defgroup SPI_NSS_internal_software_management
mbed_official 130:1dec54e4aec3 416 * @{
mbed_official 130:1dec54e4aec3 417 */
mbed_official 130:1dec54e4aec3 418
mbed_official 130:1dec54e4aec3 419 #define SPI_NSSInternalSoft_Set SPI_CR1_SSI
mbed_official 130:1dec54e4aec3 420 #define SPI_NSSInternalSoft_Reset ((uint16_t)0xFEFF)
mbed_official 130:1dec54e4aec3 421 #define IS_SPI_NSS_INTERNAL(INTERNAL) (((INTERNAL) == SPI_NSSInternalSoft_Set) || \
mbed_official 130:1dec54e4aec3 422 ((INTERNAL) == SPI_NSSInternalSoft_Reset))
mbed_official 130:1dec54e4aec3 423 /**
mbed_official 130:1dec54e4aec3 424 * @}
mbed_official 130:1dec54e4aec3 425 */
mbed_official 130:1dec54e4aec3 426
mbed_official 130:1dec54e4aec3 427 /** @defgroup SPI_CRC_Transmit_Receive
mbed_official 130:1dec54e4aec3 428 * @{
mbed_official 130:1dec54e4aec3 429 */
mbed_official 130:1dec54e4aec3 430
mbed_official 130:1dec54e4aec3 431 #define SPI_CRC_Tx ((uint8_t)0x00)
mbed_official 130:1dec54e4aec3 432 #define SPI_CRC_Rx ((uint8_t)0x01)
mbed_official 130:1dec54e4aec3 433 #define IS_SPI_CRC(CRC) (((CRC) == SPI_CRC_Tx) || ((CRC) == SPI_CRC_Rx))
mbed_official 130:1dec54e4aec3 434 /**
mbed_official 130:1dec54e4aec3 435 * @}
mbed_official 130:1dec54e4aec3 436 */
mbed_official 130:1dec54e4aec3 437
mbed_official 130:1dec54e4aec3 438 /** @defgroup SPI_direction_transmit_receive
mbed_official 130:1dec54e4aec3 439 * @{
mbed_official 130:1dec54e4aec3 440 */
mbed_official 130:1dec54e4aec3 441
mbed_official 130:1dec54e4aec3 442 #define SPI_Direction_Rx ((uint16_t)0xBFFF)
mbed_official 130:1dec54e4aec3 443 #define SPI_Direction_Tx ((uint16_t)0x4000)
mbed_official 130:1dec54e4aec3 444 #define IS_SPI_DIRECTION(DIRECTION) (((DIRECTION) == SPI_Direction_Rx) || \
mbed_official 130:1dec54e4aec3 445 ((DIRECTION) == SPI_Direction_Tx))
mbed_official 130:1dec54e4aec3 446 /**
mbed_official 130:1dec54e4aec3 447 * @}
mbed_official 130:1dec54e4aec3 448 */
mbed_official 130:1dec54e4aec3 449
mbed_official 130:1dec54e4aec3 450 /** @defgroup SPI_I2S_interrupts_definition
mbed_official 130:1dec54e4aec3 451 * @{
mbed_official 130:1dec54e4aec3 452 */
mbed_official 130:1dec54e4aec3 453
mbed_official 130:1dec54e4aec3 454 #define SPI_I2S_IT_TXE ((uint8_t)0x71)
mbed_official 130:1dec54e4aec3 455 #define SPI_I2S_IT_RXNE ((uint8_t)0x60)
mbed_official 130:1dec54e4aec3 456 #define SPI_I2S_IT_ERR ((uint8_t)0x50)
mbed_official 130:1dec54e4aec3 457
mbed_official 130:1dec54e4aec3 458 #define IS_SPI_I2S_CONFIG_IT(IT) (((IT) == SPI_I2S_IT_TXE) || \
mbed_official 130:1dec54e4aec3 459 ((IT) == SPI_I2S_IT_RXNE) || \
mbed_official 130:1dec54e4aec3 460 ((IT) == SPI_I2S_IT_ERR))
mbed_official 130:1dec54e4aec3 461
mbed_official 130:1dec54e4aec3 462 #define I2S_IT_UDR ((uint8_t)0x53)
mbed_official 130:1dec54e4aec3 463 #define SPI_IT_MODF ((uint8_t)0x55)
mbed_official 130:1dec54e4aec3 464 #define SPI_I2S_IT_OVR ((uint8_t)0x56)
mbed_official 130:1dec54e4aec3 465 #define SPI_I2S_IT_FRE ((uint8_t)0x58)
mbed_official 130:1dec54e4aec3 466
mbed_official 130:1dec54e4aec3 467 #define IS_SPI_I2S_GET_IT(IT) (((IT) == SPI_I2S_IT_RXNE) || ((IT) == SPI_I2S_IT_TXE) || \
mbed_official 130:1dec54e4aec3 468 ((IT) == SPI_I2S_IT_OVR) || ((IT) == SPI_IT_MODF) || \
mbed_official 130:1dec54e4aec3 469 ((IT) == SPI_I2S_IT_FRE)|| ((IT) == I2S_IT_UDR))
mbed_official 130:1dec54e4aec3 470 /**
mbed_official 130:1dec54e4aec3 471 * @}
mbed_official 130:1dec54e4aec3 472 */
mbed_official 130:1dec54e4aec3 473
mbed_official 130:1dec54e4aec3 474
mbed_official 130:1dec54e4aec3 475 /** @defgroup SPI_transmission_fifo_status_level
mbed_official 130:1dec54e4aec3 476 * @{
mbed_official 130:1dec54e4aec3 477 */
mbed_official 130:1dec54e4aec3 478
mbed_official 130:1dec54e4aec3 479 #define SPI_TransmissionFIFOStatus_Empty ((uint16_t)0x0000)
mbed_official 130:1dec54e4aec3 480 #define SPI_TransmissionFIFOStatus_1QuarterFull ((uint16_t)0x0800)
mbed_official 130:1dec54e4aec3 481 #define SPI_TransmissionFIFOStatus_HalfFull ((uint16_t)0x1000)
mbed_official 130:1dec54e4aec3 482 #define SPI_TransmissionFIFOStatus_Full ((uint16_t)0x1800)
mbed_official 130:1dec54e4aec3 483
mbed_official 130:1dec54e4aec3 484 /**
mbed_official 130:1dec54e4aec3 485 * @}
mbed_official 130:1dec54e4aec3 486 */
mbed_official 130:1dec54e4aec3 487
mbed_official 130:1dec54e4aec3 488 /** @defgroup SPI_reception_fifo_status_level
mbed_official 130:1dec54e4aec3 489 * @{
mbed_official 130:1dec54e4aec3 490 */
mbed_official 130:1dec54e4aec3 491 #define SPI_ReceptionFIFOStatus_Empty ((uint16_t)0x0000)
mbed_official 130:1dec54e4aec3 492 #define SPI_ReceptionFIFOStatus_1QuarterFull ((uint16_t)0x0200)
mbed_official 130:1dec54e4aec3 493 #define SPI_ReceptionFIFOStatus_HalfFull ((uint16_t)0x0400)
mbed_official 130:1dec54e4aec3 494 #define SPI_ReceptionFIFOStatus_Full ((uint16_t)0x0600)
mbed_official 130:1dec54e4aec3 495
mbed_official 130:1dec54e4aec3 496 /**
mbed_official 130:1dec54e4aec3 497 * @}
mbed_official 130:1dec54e4aec3 498 */
mbed_official 130:1dec54e4aec3 499
mbed_official 130:1dec54e4aec3 500
mbed_official 130:1dec54e4aec3 501 /** @defgroup SPI_I2S_flags_definition
mbed_official 130:1dec54e4aec3 502 * @{
mbed_official 130:1dec54e4aec3 503 */
mbed_official 130:1dec54e4aec3 504
mbed_official 130:1dec54e4aec3 505 #define SPI_I2S_FLAG_RXNE SPI_SR_RXNE
mbed_official 130:1dec54e4aec3 506 #define SPI_I2S_FLAG_TXE SPI_SR_TXE
mbed_official 130:1dec54e4aec3 507 #define I2S_FLAG_CHSIDE SPI_SR_CHSIDE
mbed_official 130:1dec54e4aec3 508 #define I2S_FLAG_UDR SPI_SR_UDR
mbed_official 130:1dec54e4aec3 509 #define SPI_FLAG_CRCERR SPI_SR_CRCERR
mbed_official 130:1dec54e4aec3 510 #define SPI_FLAG_MODF SPI_SR_MODF
mbed_official 130:1dec54e4aec3 511 #define SPI_I2S_FLAG_OVR SPI_SR_OVR
mbed_official 130:1dec54e4aec3 512 #define SPI_I2S_FLAG_BSY SPI_SR_BSY
mbed_official 130:1dec54e4aec3 513 #define SPI_I2S_FLAG_FRE SPI_SR_FRE
mbed_official 130:1dec54e4aec3 514
mbed_official 130:1dec54e4aec3 515
mbed_official 130:1dec54e4aec3 516
mbed_official 130:1dec54e4aec3 517 #define IS_SPI_CLEAR_FLAG(FLAG) (((FLAG) == SPI_FLAG_CRCERR))
mbed_official 130:1dec54e4aec3 518 #define IS_SPI_I2S_GET_FLAG(FLAG) (((FLAG) == SPI_I2S_FLAG_BSY) || ((FLAG) == SPI_I2S_FLAG_OVR) || \
mbed_official 130:1dec54e4aec3 519 ((FLAG) == SPI_FLAG_MODF) || ((FLAG) == SPI_FLAG_CRCERR) || \
mbed_official 130:1dec54e4aec3 520 ((FLAG) == SPI_I2S_FLAG_TXE) || ((FLAG) == SPI_I2S_FLAG_RXNE)|| \
mbed_official 130:1dec54e4aec3 521 ((FLAG) == SPI_I2S_FLAG_FRE)|| ((FLAG) == I2S_FLAG_CHSIDE)|| \
mbed_official 130:1dec54e4aec3 522 ((FLAG) == I2S_FLAG_UDR))
mbed_official 130:1dec54e4aec3 523 /**
mbed_official 130:1dec54e4aec3 524 * @}
mbed_official 130:1dec54e4aec3 525 */
mbed_official 130:1dec54e4aec3 526
mbed_official 130:1dec54e4aec3 527 /** @defgroup SPI_CRC_polynomial
mbed_official 130:1dec54e4aec3 528 * @{
mbed_official 130:1dec54e4aec3 529 */
mbed_official 130:1dec54e4aec3 530
mbed_official 130:1dec54e4aec3 531 #define IS_SPI_CRC_POLYNOMIAL(POLYNOMIAL) ((POLYNOMIAL) >= 0x1)
mbed_official 130:1dec54e4aec3 532 /**
mbed_official 130:1dec54e4aec3 533 * @}
mbed_official 130:1dec54e4aec3 534 */
mbed_official 130:1dec54e4aec3 535
mbed_official 130:1dec54e4aec3 536 /**
mbed_official 130:1dec54e4aec3 537 * @}
mbed_official 130:1dec54e4aec3 538 */
mbed_official 130:1dec54e4aec3 539
mbed_official 130:1dec54e4aec3 540 /* Exported macro ------------------------------------------------------------*/
mbed_official 130:1dec54e4aec3 541 /* Exported functions ------------------------------------------------------- */
mbed_official 130:1dec54e4aec3 542
mbed_official 130:1dec54e4aec3 543 /* Initialization and Configuration functions *********************************/
mbed_official 130:1dec54e4aec3 544 void SPI_I2S_DeInit(SPI_TypeDef* SPIx);
mbed_official 130:1dec54e4aec3 545 void SPI_Init(SPI_TypeDef* SPIx, SPI_InitTypeDef* SPI_InitStruct);
mbed_official 130:1dec54e4aec3 546 void I2S_Init(SPI_TypeDef* SPIx, I2S_InitTypeDef* I2S_InitStruct); /*!< Not applicable for STM32F030 devices */
mbed_official 130:1dec54e4aec3 547 void SPI_StructInit(SPI_InitTypeDef* SPI_InitStruct);
mbed_official 130:1dec54e4aec3 548 void I2S_StructInit(I2S_InitTypeDef* I2S_InitStruct); /*!< Not applicable for STM32F030 devices */
mbed_official 130:1dec54e4aec3 549 void SPI_TIModeCmd(SPI_TypeDef* SPIx, FunctionalState NewState);
mbed_official 130:1dec54e4aec3 550 void SPI_NSSPulseModeCmd(SPI_TypeDef* SPIx, FunctionalState NewState);
mbed_official 130:1dec54e4aec3 551 void SPI_Cmd(SPI_TypeDef* SPIx, FunctionalState NewState);
mbed_official 130:1dec54e4aec3 552 void I2S_Cmd(SPI_TypeDef* SPIx, FunctionalState NewState); /*!< Not applicable for STM32F030 devices */
mbed_official 130:1dec54e4aec3 553 void SPI_DataSizeConfig(SPI_TypeDef* SPIx, uint16_t SPI_DataSize);
mbed_official 130:1dec54e4aec3 554 void SPI_RxFIFOThresholdConfig(SPI_TypeDef* SPIx, uint16_t SPI_RxFIFOThreshold);
mbed_official 130:1dec54e4aec3 555 void SPI_BiDirectionalLineConfig(SPI_TypeDef* SPIx, uint16_t SPI_Direction);
mbed_official 130:1dec54e4aec3 556 void SPI_NSSInternalSoftwareConfig(SPI_TypeDef* SPIx, uint16_t SPI_NSSInternalSoft);
mbed_official 130:1dec54e4aec3 557 void SPI_SSOutputCmd(SPI_TypeDef* SPIx, FunctionalState NewState);
mbed_official 130:1dec54e4aec3 558
mbed_official 130:1dec54e4aec3 559 /* Data transfers functions ***************************************************/
mbed_official 130:1dec54e4aec3 560 void SPI_SendData8(SPI_TypeDef* SPIx, uint8_t Data);
mbed_official 130:1dec54e4aec3 561 void SPI_I2S_SendData16(SPI_TypeDef* SPIx, uint16_t Data);
mbed_official 130:1dec54e4aec3 562 uint8_t SPI_ReceiveData8(SPI_TypeDef* SPIx);
mbed_official 130:1dec54e4aec3 563 uint16_t SPI_I2S_ReceiveData16(SPI_TypeDef* SPIx);
mbed_official 130:1dec54e4aec3 564
mbed_official 130:1dec54e4aec3 565 /* Hardware CRC Calculation functions *****************************************/
mbed_official 130:1dec54e4aec3 566 void SPI_CRCLengthConfig(SPI_TypeDef* SPIx, uint16_t SPI_CRCLength);
mbed_official 130:1dec54e4aec3 567 void SPI_CalculateCRC(SPI_TypeDef* SPIx, FunctionalState NewState);
mbed_official 130:1dec54e4aec3 568 void SPI_TransmitCRC(SPI_TypeDef* SPIx);
mbed_official 130:1dec54e4aec3 569 uint16_t SPI_GetCRC(SPI_TypeDef* SPIx, uint8_t SPI_CRC);
mbed_official 130:1dec54e4aec3 570 uint16_t SPI_GetCRCPolynomial(SPI_TypeDef* SPIx);
mbed_official 130:1dec54e4aec3 571
mbed_official 130:1dec54e4aec3 572 /* DMA transfers management functions *****************************************/
mbed_official 130:1dec54e4aec3 573 void SPI_I2S_DMACmd(SPI_TypeDef* SPIx, uint16_t SPI_I2S_DMAReq, FunctionalState NewState);
mbed_official 130:1dec54e4aec3 574 void SPI_LastDMATransferCmd(SPI_TypeDef* SPIx, uint16_t SPI_LastDMATransfer);
mbed_official 130:1dec54e4aec3 575
mbed_official 130:1dec54e4aec3 576 /* Interrupts and flags management functions **********************************/
mbed_official 130:1dec54e4aec3 577 void SPI_I2S_ITConfig(SPI_TypeDef* SPIx, uint8_t SPI_I2S_IT, FunctionalState NewState);
mbed_official 130:1dec54e4aec3 578 uint16_t SPI_GetTransmissionFIFOStatus(SPI_TypeDef* SPIx);
mbed_official 130:1dec54e4aec3 579 uint16_t SPI_GetReceptionFIFOStatus(SPI_TypeDef* SPIx);
mbed_official 130:1dec54e4aec3 580 FlagStatus SPI_I2S_GetFlagStatus(SPI_TypeDef* SPIx, uint16_t SPI_I2S_FLAG);
mbed_official 130:1dec54e4aec3 581 void SPI_I2S_ClearFlag(SPI_TypeDef* SPIx, uint16_t SPI_I2S_FLAG);
mbed_official 130:1dec54e4aec3 582 ITStatus SPI_I2S_GetITStatus(SPI_TypeDef* SPIx, uint8_t SPI_I2S_IT);
mbed_official 130:1dec54e4aec3 583
mbed_official 130:1dec54e4aec3 584 #ifdef __cplusplus
mbed_official 130:1dec54e4aec3 585 }
mbed_official 130:1dec54e4aec3 586 #endif
mbed_official 130:1dec54e4aec3 587
mbed_official 130:1dec54e4aec3 588 #endif /*__STM32F0XX_SPI_H */
mbed_official 130:1dec54e4aec3 589
mbed_official 130:1dec54e4aec3 590 /**
mbed_official 130:1dec54e4aec3 591 * @}
mbed_official 130:1dec54e4aec3 592 */
mbed_official 130:1dec54e4aec3 593
mbed_official 130:1dec54e4aec3 594 /**
mbed_official 130:1dec54e4aec3 595 * @}
mbed_official 130:1dec54e4aec3 596 */
mbed_official 130:1dec54e4aec3 597
mbed_official 130:1dec54e4aec3 598 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/