mbed library sources

Dependents:   frdm_kl05z_gpio_test

Fork of mbed-src by mbed official

Committer:
shaoziyang
Date:
Sat Sep 13 14:25:46 2014 +0000
Revision:
323:9e901b0a5aa1
Parent:
106:ced8cbb51063
test with CLOCK_SETUP = 0

Who changed what in which revision?

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