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