mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Wed Mar 19 10:15:22 2014 +0000
Revision:
125:23cc3068a9e4
Synchronized with git revision ace35dfba3748c7cdc102eb38ec6b9e1067c3252

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

[NUCLEO_F302R8] Add cmsis and hal files + change F401RE clock to 84MHz

Who changed what in which revision?

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