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