The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
mbed 2
This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.
TARGET_B96B_F446VE/TARGET_STM/TARGET_STM32F4/device/stm32f4xx_hal_i2s.h@145:64910690c574, 2017-06-21 (annotated)
- Committer:
- AnnaBridge
- Date:
- Wed Jun 21 17:31:38 2017 +0100
- Revision:
- 145:64910690c574
- Parent:
- 128:9bcdf88f62b0
Release 145 of the mbed library.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 122:f9eeca106725 | 1 | /** |
Kojto | 122:f9eeca106725 | 2 | ****************************************************************************** |
Kojto | 122:f9eeca106725 | 3 | * @file stm32f4xx_hal_i2s.h |
Kojto | 122:f9eeca106725 | 4 | * @author MCD Application Team |
AnnaBridge | 145:64910690c574 | 5 | * @version V1.7.1 |
AnnaBridge | 145:64910690c574 | 6 | * @date 14-April-2017 |
Kojto | 122:f9eeca106725 | 7 | * @brief Header file of I2S HAL module. |
Kojto | 122:f9eeca106725 | 8 | ****************************************************************************** |
Kojto | 122:f9eeca106725 | 9 | * @attention |
Kojto | 122:f9eeca106725 | 10 | * |
AnnaBridge | 145:64910690c574 | 11 | * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> |
Kojto | 122:f9eeca106725 | 12 | * |
Kojto | 122:f9eeca106725 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
Kojto | 122:f9eeca106725 | 14 | * are permitted provided that the following conditions are met: |
Kojto | 122:f9eeca106725 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
Kojto | 122:f9eeca106725 | 16 | * this list of conditions and the following disclaimer. |
Kojto | 122:f9eeca106725 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
Kojto | 122:f9eeca106725 | 18 | * this list of conditions and the following disclaimer in the documentation |
Kojto | 122:f9eeca106725 | 19 | * and/or other materials provided with the distribution. |
Kojto | 122:f9eeca106725 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
Kojto | 122:f9eeca106725 | 21 | * may be used to endorse or promote products derived from this software |
Kojto | 122:f9eeca106725 | 22 | * without specific prior written permission. |
Kojto | 122:f9eeca106725 | 23 | * |
Kojto | 122:f9eeca106725 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
Kojto | 122:f9eeca106725 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
Kojto | 122:f9eeca106725 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Kojto | 122:f9eeca106725 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
Kojto | 122:f9eeca106725 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
Kojto | 122:f9eeca106725 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
Kojto | 122:f9eeca106725 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
Kojto | 122:f9eeca106725 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
Kojto | 122:f9eeca106725 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
Kojto | 122:f9eeca106725 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Kojto | 122:f9eeca106725 | 34 | * |
Kojto | 122:f9eeca106725 | 35 | ****************************************************************************** |
AnnaBridge | 145:64910690c574 | 36 | */ |
Kojto | 122:f9eeca106725 | 37 | |
Kojto | 122:f9eeca106725 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
Kojto | 122:f9eeca106725 | 39 | #ifndef __STM32F4xx_HAL_I2S_H |
Kojto | 122:f9eeca106725 | 40 | #define __STM32F4xx_HAL_I2S_H |
Kojto | 122:f9eeca106725 | 41 | |
Kojto | 122:f9eeca106725 | 42 | #ifdef __cplusplus |
Kojto | 122:f9eeca106725 | 43 | extern "C" { |
Kojto | 122:f9eeca106725 | 44 | #endif |
Kojto | 122:f9eeca106725 | 45 | |
Kojto | 122:f9eeca106725 | 46 | /* Includes ------------------------------------------------------------------*/ |
AnnaBridge | 145:64910690c574 | 47 | #include "stm32f4xx_hal_def.h" |
Kojto | 122:f9eeca106725 | 48 | |
Kojto | 122:f9eeca106725 | 49 | /** @addtogroup STM32F4xx_HAL_Driver |
Kojto | 122:f9eeca106725 | 50 | * @{ |
Kojto | 122:f9eeca106725 | 51 | */ |
Kojto | 122:f9eeca106725 | 52 | |
AnnaBridge | 145:64910690c574 | 53 | /** @addtogroup I2S I2S |
Kojto | 122:f9eeca106725 | 54 | * @{ |
AnnaBridge | 145:64910690c574 | 55 | */ |
Kojto | 122:f9eeca106725 | 56 | |
Kojto | 122:f9eeca106725 | 57 | /* Exported types ------------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 58 | /** @defgroup I2S_Exported_Types I2S Exported Types |
Kojto | 122:f9eeca106725 | 59 | * @{ |
Kojto | 122:f9eeca106725 | 60 | */ |
AnnaBridge | 145:64910690c574 | 61 | |
AnnaBridge | 145:64910690c574 | 62 | /** |
AnnaBridge | 145:64910690c574 | 63 | * @brief I2S Init structure definition |
Kojto | 122:f9eeca106725 | 64 | */ |
Kojto | 122:f9eeca106725 | 65 | typedef struct |
Kojto | 122:f9eeca106725 | 66 | { |
AnnaBridge | 145:64910690c574 | 67 | uint32_t Mode; /*!< Specifies the I2S operating mode. |
AnnaBridge | 145:64910690c574 | 68 | This parameter can be a value of @ref I2S_Mode */ |
Kojto | 122:f9eeca106725 | 69 | |
AnnaBridge | 145:64910690c574 | 70 | uint32_t Standard; /*!< Specifies the standard used for the I2S communication. |
AnnaBridge | 145:64910690c574 | 71 | This parameter can be a value of @ref I2S_Standard */ |
Kojto | 122:f9eeca106725 | 72 | |
AnnaBridge | 145:64910690c574 | 73 | uint32_t DataFormat; /*!< Specifies the data format for the I2S communication. |
AnnaBridge | 145:64910690c574 | 74 | This parameter can be a value of @ref I2S_Data_Format */ |
Kojto | 122:f9eeca106725 | 75 | |
AnnaBridge | 145:64910690c574 | 76 | uint32_t MCLKOutput; /*!< Specifies whether the I2S MCLK output is enabled or not. |
AnnaBridge | 145:64910690c574 | 77 | This parameter can be a value of @ref I2S_MCLK_Output */ |
Kojto | 122:f9eeca106725 | 78 | |
AnnaBridge | 145:64910690c574 | 79 | uint32_t AudioFreq; /*!< Specifies the frequency selected for the I2S communication. |
AnnaBridge | 145:64910690c574 | 80 | This parameter can be a value of @ref I2S_Audio_Frequency */ |
Kojto | 122:f9eeca106725 | 81 | |
AnnaBridge | 145:64910690c574 | 82 | uint32_t CPOL; /*!< Specifies the idle state of the I2S clock. |
AnnaBridge | 145:64910690c574 | 83 | This parameter can be a value of @ref I2S_Clock_Polarity */ |
Kojto | 122:f9eeca106725 | 84 | |
AnnaBridge | 145:64910690c574 | 85 | uint32_t ClockSource; /*!< Specifies the I2S Clock Source. |
AnnaBridge | 145:64910690c574 | 86 | This parameter can be a value of @ref I2S_Clock_Source */ |
Kojto | 122:f9eeca106725 | 87 | |
Kojto | 122:f9eeca106725 | 88 | uint32_t FullDuplexMode; /*!< Specifies the I2S FullDuplex mode. |
Kojto | 122:f9eeca106725 | 89 | This parameter can be a value of @ref I2S_FullDuplex_Mode */ |
Kojto | 122:f9eeca106725 | 90 | |
Kojto | 122:f9eeca106725 | 91 | }I2S_InitTypeDef; |
Kojto | 122:f9eeca106725 | 92 | |
AnnaBridge | 145:64910690c574 | 93 | /** |
Kojto | 122:f9eeca106725 | 94 | * @brief HAL State structures definition |
AnnaBridge | 145:64910690c574 | 95 | */ |
Kojto | 122:f9eeca106725 | 96 | typedef enum |
Kojto | 122:f9eeca106725 | 97 | { |
Kojto | 122:f9eeca106725 | 98 | HAL_I2S_STATE_RESET = 0x00U, /*!< I2S not yet initialized or disabled */ |
Kojto | 122:f9eeca106725 | 99 | HAL_I2S_STATE_READY = 0x01U, /*!< I2S initialized and ready for use */ |
Kojto | 122:f9eeca106725 | 100 | HAL_I2S_STATE_BUSY = 0x02U, /*!< I2S internal process is ongoing */ |
AnnaBridge | 145:64910690c574 | 101 | HAL_I2S_STATE_BUSY_TX = 0x03U, /*!< Data Transmission process is ongoing */ |
AnnaBridge | 145:64910690c574 | 102 | HAL_I2S_STATE_BUSY_RX = 0x04U, /*!< Data Reception process is ongoing */ |
AnnaBridge | 145:64910690c574 | 103 | HAL_I2S_STATE_BUSY_TX_RX = 0x05U, /*!< Data Transmission and Reception process is ongoing */ |
AnnaBridge | 145:64910690c574 | 104 | HAL_I2S_STATE_TIMEOUT = 0x06U, /*!< I2S timeout state */ |
AnnaBridge | 145:64910690c574 | 105 | HAL_I2S_STATE_ERROR = 0x07U /*!< I2S error state */ |
Kojto | 122:f9eeca106725 | 106 | |
Kojto | 122:f9eeca106725 | 107 | }HAL_I2S_StateTypeDef; |
Kojto | 122:f9eeca106725 | 108 | |
AnnaBridge | 145:64910690c574 | 109 | /** |
AnnaBridge | 145:64910690c574 | 110 | * @brief I2S handle Structure definition |
Kojto | 122:f9eeca106725 | 111 | */ |
AnnaBridge | 145:64910690c574 | 112 | typedef struct __I2S_HandleTypeDef |
Kojto | 122:f9eeca106725 | 113 | { |
AnnaBridge | 145:64910690c574 | 114 | SPI_TypeDef *Instance; /*!< I2S registers base address */ |
AnnaBridge | 145:64910690c574 | 115 | |
AnnaBridge | 145:64910690c574 | 116 | I2S_InitTypeDef Init; /*!< I2S communication parameters */ |
AnnaBridge | 145:64910690c574 | 117 | |
AnnaBridge | 145:64910690c574 | 118 | uint16_t *pTxBuffPtr; /*!< Pointer to I2S Tx transfer buffer */ |
AnnaBridge | 145:64910690c574 | 119 | |
AnnaBridge | 145:64910690c574 | 120 | __IO uint16_t TxXferSize; /*!< I2S Tx transfer size */ |
AnnaBridge | 145:64910690c574 | 121 | |
AnnaBridge | 145:64910690c574 | 122 | __IO uint16_t TxXferCount; /*!< I2S Tx transfer Counter */ |
AnnaBridge | 145:64910690c574 | 123 | |
AnnaBridge | 145:64910690c574 | 124 | uint16_t *pRxBuffPtr; /*!< Pointer to I2S Rx transfer buffer */ |
AnnaBridge | 145:64910690c574 | 125 | |
AnnaBridge | 145:64910690c574 | 126 | __IO uint16_t RxXferSize; /*!< I2S Rx transfer size */ |
Kojto | 122:f9eeca106725 | 127 | |
AnnaBridge | 145:64910690c574 | 128 | __IO uint16_t RxXferCount; /*!< I2S Rx transfer counter |
AnnaBridge | 145:64910690c574 | 129 | (This field is initialized at the |
AnnaBridge | 145:64910690c574 | 130 | same value as transfer size at the |
AnnaBridge | 145:64910690c574 | 131 | beginning of the transfer and |
AnnaBridge | 145:64910690c574 | 132 | decremented when a sample is received |
AnnaBridge | 145:64910690c574 | 133 | NbSamplesReceived = RxBufferSize-RxBufferCount) */ |
AnnaBridge | 145:64910690c574 | 134 | |
AnnaBridge | 145:64910690c574 | 135 | void (*IrqHandlerISR) (struct __I2S_HandleTypeDef *hi2s); /*!< I2S function pointer on IrqHandler */ |
Kojto | 122:f9eeca106725 | 136 | |
AnnaBridge | 145:64910690c574 | 137 | DMA_HandleTypeDef *hdmatx; /*!< I2S Tx DMA handle parameters */ |
AnnaBridge | 145:64910690c574 | 138 | |
AnnaBridge | 145:64910690c574 | 139 | DMA_HandleTypeDef *hdmarx; /*!< I2S Rx DMA handle parameters */ |
AnnaBridge | 145:64910690c574 | 140 | |
AnnaBridge | 145:64910690c574 | 141 | __IO HAL_LockTypeDef Lock; /*!< I2S locking object */ |
Kojto | 122:f9eeca106725 | 142 | |
AnnaBridge | 145:64910690c574 | 143 | __IO HAL_I2S_StateTypeDef State; /*!< I2S communication state */ |
AnnaBridge | 145:64910690c574 | 144 | |
AnnaBridge | 145:64910690c574 | 145 | __IO uint32_t ErrorCode; /*!< I2S Error code |
AnnaBridge | 145:64910690c574 | 146 | This parameter can be a value of @ref I2S_ErrorCode */ |
AnnaBridge | 145:64910690c574 | 147 | |
Kojto | 122:f9eeca106725 | 148 | }I2S_HandleTypeDef; |
Kojto | 122:f9eeca106725 | 149 | /** |
Kojto | 122:f9eeca106725 | 150 | * @} |
Kojto | 122:f9eeca106725 | 151 | */ |
Kojto | 122:f9eeca106725 | 152 | |
Kojto | 122:f9eeca106725 | 153 | /* Exported constants --------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 154 | /** @defgroup I2S_Exported_Constants I2S Exported Constants |
Kojto | 122:f9eeca106725 | 155 | * @{ |
Kojto | 122:f9eeca106725 | 156 | */ |
AnnaBridge | 145:64910690c574 | 157 | /** |
AnnaBridge | 145:64910690c574 | 158 | * @defgroup I2S_ErrorCode I2S Error Code |
Kojto | 122:f9eeca106725 | 159 | * @{ |
AnnaBridge | 145:64910690c574 | 160 | */ |
AnnaBridge | 145:64910690c574 | 161 | #define HAL_I2S_ERROR_NONE (0x00000000U) /*!< No error */ |
AnnaBridge | 145:64910690c574 | 162 | #define HAL_I2S_ERROR_TIMEOUT (0x00000001U) /*!< Timeout error */ |
AnnaBridge | 145:64910690c574 | 163 | #define HAL_I2S_ERROR_OVR (0x00000002U) /*!< OVR error */ |
AnnaBridge | 145:64910690c574 | 164 | #define HAL_I2S_ERROR_UDR (0x00000004U) /*!< UDR error */ |
AnnaBridge | 145:64910690c574 | 165 | #define HAL_I2S_ERROR_DMA (0x00000008U) /*!< DMA transfer error */ |
AnnaBridge | 145:64910690c574 | 166 | #define HAL_I2S_ERROR_PRESCALER (0x00000010U) /*!< Prescaler Calculation error */ |
Kojto | 122:f9eeca106725 | 167 | /** |
Kojto | 122:f9eeca106725 | 168 | * @} |
Kojto | 122:f9eeca106725 | 169 | */ |
Kojto | 122:f9eeca106725 | 170 | |
AnnaBridge | 145:64910690c574 | 171 | /** @defgroup I2S_Mode I2S Mode |
Kojto | 122:f9eeca106725 | 172 | * @{ |
Kojto | 122:f9eeca106725 | 173 | */ |
AnnaBridge | 145:64910690c574 | 174 | #define I2S_MODE_SLAVE_TX (0x00000000U) |
AnnaBridge | 145:64910690c574 | 175 | #define I2S_MODE_SLAVE_RX (0x00000100U) |
AnnaBridge | 145:64910690c574 | 176 | #define I2S_MODE_MASTER_TX (0x00000200U) |
AnnaBridge | 145:64910690c574 | 177 | #define I2S_MODE_MASTER_RX (0x00000300U) |
Kojto | 122:f9eeca106725 | 178 | /** |
Kojto | 122:f9eeca106725 | 179 | * @} |
Kojto | 122:f9eeca106725 | 180 | */ |
AnnaBridge | 145:64910690c574 | 181 | |
Kojto | 122:f9eeca106725 | 182 | /** @defgroup I2S_Standard I2S Standard |
Kojto | 122:f9eeca106725 | 183 | * @{ |
Kojto | 122:f9eeca106725 | 184 | */ |
AnnaBridge | 145:64910690c574 | 185 | #define I2S_STANDARD_PHILIPS (0x00000000U) |
AnnaBridge | 145:64910690c574 | 186 | #define I2S_STANDARD_MSB (0x00000010U) |
AnnaBridge | 145:64910690c574 | 187 | #define I2S_STANDARD_LSB (0x00000020U) |
AnnaBridge | 145:64910690c574 | 188 | #define I2S_STANDARD_PCM_SHORT (0x00000030U) |
AnnaBridge | 145:64910690c574 | 189 | #define I2S_STANDARD_PCM_LONG (0x000000B0U) |
Kojto | 122:f9eeca106725 | 190 | /** |
Kojto | 122:f9eeca106725 | 191 | * @} |
Kojto | 122:f9eeca106725 | 192 | */ |
AnnaBridge | 145:64910690c574 | 193 | |
Kojto | 122:f9eeca106725 | 194 | /** @defgroup I2S_Data_Format I2S Data Format |
Kojto | 122:f9eeca106725 | 195 | * @{ |
Kojto | 122:f9eeca106725 | 196 | */ |
AnnaBridge | 145:64910690c574 | 197 | #define I2S_DATAFORMAT_16B (0x00000000U) |
AnnaBridge | 145:64910690c574 | 198 | #define I2S_DATAFORMAT_16B_EXTENDED (0x00000001U) |
AnnaBridge | 145:64910690c574 | 199 | #define I2S_DATAFORMAT_24B (0x00000003U) |
AnnaBridge | 145:64910690c574 | 200 | #define I2S_DATAFORMAT_32B (0x00000005U) |
Kojto | 122:f9eeca106725 | 201 | /** |
Kojto | 122:f9eeca106725 | 202 | * @} |
Kojto | 122:f9eeca106725 | 203 | */ |
Kojto | 122:f9eeca106725 | 204 | |
Kojto | 122:f9eeca106725 | 205 | /** @defgroup I2S_MCLK_Output I2S Mclk Output |
Kojto | 122:f9eeca106725 | 206 | * @{ |
Kojto | 122:f9eeca106725 | 207 | */ |
AnnaBridge | 145:64910690c574 | 208 | #define I2S_MCLKOUTPUT_ENABLE SPI_I2SPR_MCKOE |
AnnaBridge | 145:64910690c574 | 209 | #define I2S_MCLKOUTPUT_DISABLE (0x00000000U) |
Kojto | 122:f9eeca106725 | 210 | /** |
Kojto | 122:f9eeca106725 | 211 | * @} |
Kojto | 122:f9eeca106725 | 212 | */ |
Kojto | 122:f9eeca106725 | 213 | |
AnnaBridge | 145:64910690c574 | 214 | /** @defgroup I2S_Audio_Frequency I2S Audio Frequency |
Kojto | 122:f9eeca106725 | 215 | * @{ |
Kojto | 122:f9eeca106725 | 216 | */ |
AnnaBridge | 145:64910690c574 | 217 | #define I2S_AUDIOFREQ_192K (192000U) |
AnnaBridge | 145:64910690c574 | 218 | #define I2S_AUDIOFREQ_96K (96000U) |
AnnaBridge | 145:64910690c574 | 219 | #define I2S_AUDIOFREQ_48K (48000U) |
AnnaBridge | 145:64910690c574 | 220 | #define I2S_AUDIOFREQ_44K (44100U) |
AnnaBridge | 145:64910690c574 | 221 | #define I2S_AUDIOFREQ_32K (32000U) |
AnnaBridge | 145:64910690c574 | 222 | #define I2S_AUDIOFREQ_22K (22050U) |
AnnaBridge | 145:64910690c574 | 223 | #define I2S_AUDIOFREQ_16K (16000U) |
AnnaBridge | 145:64910690c574 | 224 | #define I2S_AUDIOFREQ_11K (11025U) |
AnnaBridge | 145:64910690c574 | 225 | #define I2S_AUDIOFREQ_8K (8000U) |
AnnaBridge | 145:64910690c574 | 226 | #define I2S_AUDIOFREQ_DEFAULT (2U) |
Kojto | 122:f9eeca106725 | 227 | /** |
Kojto | 122:f9eeca106725 | 228 | * @} |
Kojto | 122:f9eeca106725 | 229 | */ |
Kojto | 122:f9eeca106725 | 230 | |
Kojto | 122:f9eeca106725 | 231 | /** @defgroup I2S_FullDuplex_Mode I2S FullDuplex Mode |
Kojto | 122:f9eeca106725 | 232 | * @{ |
Kojto | 122:f9eeca106725 | 233 | */ |
AnnaBridge | 145:64910690c574 | 234 | #define I2S_FULLDUPLEXMODE_DISABLE (0x00000000U) |
AnnaBridge | 145:64910690c574 | 235 | #define I2S_FULLDUPLEXMODE_ENABLE (0x00000001U) |
Kojto | 122:f9eeca106725 | 236 | /** |
Kojto | 122:f9eeca106725 | 237 | * @} |
Kojto | 122:f9eeca106725 | 238 | */ |
Kojto | 122:f9eeca106725 | 239 | |
Kojto | 122:f9eeca106725 | 240 | /** @defgroup I2S_Clock_Polarity I2S Clock Polarity |
Kojto | 122:f9eeca106725 | 241 | * @{ |
Kojto | 122:f9eeca106725 | 242 | */ |
AnnaBridge | 145:64910690c574 | 243 | #define I2S_CPOL_LOW (0x00000000U) |
AnnaBridge | 145:64910690c574 | 244 | #define I2S_CPOL_HIGH (SPI_I2SCFGR_CKPOL) |
Kojto | 122:f9eeca106725 | 245 | /** |
Kojto | 122:f9eeca106725 | 246 | * @} |
Kojto | 122:f9eeca106725 | 247 | */ |
Kojto | 122:f9eeca106725 | 248 | |
Kojto | 122:f9eeca106725 | 249 | /** @defgroup I2S_Interrupts_Definition I2S Interrupts Definition |
Kojto | 122:f9eeca106725 | 250 | * @{ |
Kojto | 122:f9eeca106725 | 251 | */ |
Kojto | 122:f9eeca106725 | 252 | #define I2S_IT_TXE SPI_CR2_TXEIE |
Kojto | 122:f9eeca106725 | 253 | #define I2S_IT_RXNE SPI_CR2_RXNEIE |
Kojto | 122:f9eeca106725 | 254 | #define I2S_IT_ERR SPI_CR2_ERRIE |
Kojto | 122:f9eeca106725 | 255 | /** |
Kojto | 122:f9eeca106725 | 256 | * @} |
Kojto | 122:f9eeca106725 | 257 | */ |
Kojto | 122:f9eeca106725 | 258 | |
Kojto | 122:f9eeca106725 | 259 | /** @defgroup I2S_Flags_Definition I2S Flags Definition |
Kojto | 122:f9eeca106725 | 260 | * @{ |
Kojto | 122:f9eeca106725 | 261 | */ |
Kojto | 122:f9eeca106725 | 262 | #define I2S_FLAG_TXE SPI_SR_TXE |
Kojto | 122:f9eeca106725 | 263 | #define I2S_FLAG_RXNE SPI_SR_RXNE |
Kojto | 122:f9eeca106725 | 264 | |
Kojto | 122:f9eeca106725 | 265 | #define I2S_FLAG_UDR SPI_SR_UDR |
Kojto | 122:f9eeca106725 | 266 | #define I2S_FLAG_OVR SPI_SR_OVR |
Kojto | 122:f9eeca106725 | 267 | #define I2S_FLAG_FRE SPI_SR_FRE |
Kojto | 122:f9eeca106725 | 268 | |
Kojto | 122:f9eeca106725 | 269 | #define I2S_FLAG_CHSIDE SPI_SR_CHSIDE |
Kojto | 122:f9eeca106725 | 270 | #define I2S_FLAG_BSY SPI_SR_BSY |
Kojto | 122:f9eeca106725 | 271 | /** |
Kojto | 122:f9eeca106725 | 272 | * @} |
Kojto | 122:f9eeca106725 | 273 | */ |
AnnaBridge | 145:64910690c574 | 274 | /** @defgroup I2S_Clock_Source I2S Clock Source Definition |
AnnaBridge | 145:64910690c574 | 275 | * @{ |
AnnaBridge | 145:64910690c574 | 276 | */ |
AnnaBridge | 145:64910690c574 | 277 | #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \ |
AnnaBridge | 145:64910690c574 | 278 | defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \ |
AnnaBridge | 145:64910690c574 | 279 | defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F469xx) || \ |
AnnaBridge | 145:64910690c574 | 280 | defined(STM32F479xx) |
AnnaBridge | 145:64910690c574 | 281 | #define I2S_CLOCK_PLL (0x00000000U) |
AnnaBridge | 145:64910690c574 | 282 | #define I2S_CLOCK_EXTERNAL (0x00000001U) |
AnnaBridge | 145:64910690c574 | 283 | #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || |
AnnaBridge | 145:64910690c574 | 284 | STM32F401xC || STM32F401xE || STM32F411xE || STM32F469xx || STM32F479xx */ |
AnnaBridge | 145:64910690c574 | 285 | |
AnnaBridge | 145:64910690c574 | 286 | #if defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) ||\ |
AnnaBridge | 145:64910690c574 | 287 | defined(STM32F413xx) || defined(STM32F423xx) |
AnnaBridge | 145:64910690c574 | 288 | #define I2S_CLOCK_PLL (0x00000000U) |
AnnaBridge | 145:64910690c574 | 289 | #define I2S_CLOCK_EXTERNAL (0x00000001U) |
AnnaBridge | 145:64910690c574 | 290 | #define I2S_CLOCK_PLLR (0x00000002U) |
AnnaBridge | 145:64910690c574 | 291 | #define I2S_CLOCK_PLLSRC (0x00000003U) |
AnnaBridge | 145:64910690c574 | 292 | #endif /* STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ |
AnnaBridge | 145:64910690c574 | 293 | |
AnnaBridge | 145:64910690c574 | 294 | #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) |
AnnaBridge | 145:64910690c574 | 295 | #define I2S_CLOCK_PLLSRC (0x00000000U) |
AnnaBridge | 145:64910690c574 | 296 | #define I2S_CLOCK_EXTERNAL (0x00000001U) |
AnnaBridge | 145:64910690c574 | 297 | #define I2S_CLOCK_PLLR (0x00000002U) |
AnnaBridge | 145:64910690c574 | 298 | #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */ |
AnnaBridge | 145:64910690c574 | 299 | /** |
AnnaBridge | 145:64910690c574 | 300 | * @} |
AnnaBridge | 145:64910690c574 | 301 | */ |
Kojto | 122:f9eeca106725 | 302 | |
Kojto | 122:f9eeca106725 | 303 | /** |
Kojto | 122:f9eeca106725 | 304 | * @} |
AnnaBridge | 145:64910690c574 | 305 | */ |
Kojto | 122:f9eeca106725 | 306 | |
Kojto | 122:f9eeca106725 | 307 | /* Exported macro ------------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 308 | /** @defgroup I2S_Exported_Macros I2S Exported Macros |
Kojto | 122:f9eeca106725 | 309 | * @{ |
Kojto | 122:f9eeca106725 | 310 | */ |
Kojto | 122:f9eeca106725 | 311 | |
Kojto | 122:f9eeca106725 | 312 | /** @brief Reset I2S handle state |
Kojto | 122:f9eeca106725 | 313 | * @param __HANDLE__: specifies the I2S Handle. |
Kojto | 122:f9eeca106725 | 314 | * @retval None |
Kojto | 122:f9eeca106725 | 315 | */ |
Kojto | 122:f9eeca106725 | 316 | #define __HAL_I2S_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_I2S_STATE_RESET) |
Kojto | 122:f9eeca106725 | 317 | |
Kojto | 122:f9eeca106725 | 318 | /** @brief Enable or disable the specified SPI peripheral (in I2S mode). |
AnnaBridge | 145:64910690c574 | 319 | * @param __HANDLE__: specifies the I2S Handle. |
Kojto | 122:f9eeca106725 | 320 | * @retval None |
Kojto | 122:f9eeca106725 | 321 | */ |
Kojto | 122:f9eeca106725 | 322 | #define __HAL_I2S_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->I2SCFGR |= SPI_I2SCFGR_I2SE) |
AnnaBridge | 145:64910690c574 | 323 | #define __HAL_I2S_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->I2SCFGR &=(uint16_t)(~SPI_I2SCFGR_I2SE)) |
Kojto | 122:f9eeca106725 | 324 | |
Kojto | 122:f9eeca106725 | 325 | /** @brief Enable or disable the specified I2S interrupts. |
Kojto | 122:f9eeca106725 | 326 | * @param __HANDLE__: specifies the I2S Handle. |
Kojto | 122:f9eeca106725 | 327 | * @param __INTERRUPT__: specifies the interrupt source to enable or disable. |
Kojto | 122:f9eeca106725 | 328 | * This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 329 | * @arg I2S_IT_TXE: Tx buffer empty interrupt enable |
Kojto | 122:f9eeca106725 | 330 | * @arg I2S_IT_RXNE: RX buffer not empty interrupt enable |
Kojto | 122:f9eeca106725 | 331 | * @arg I2S_IT_ERR: Error interrupt enable |
Kojto | 122:f9eeca106725 | 332 | * @retval None |
AnnaBridge | 145:64910690c574 | 333 | */ |
Kojto | 122:f9eeca106725 | 334 | #define __HAL_I2S_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR2 |= (__INTERRUPT__)) |
AnnaBridge | 145:64910690c574 | 335 | #define __HAL_I2S_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR2 &=(uint16_t)(~(__INTERRUPT__))) |
AnnaBridge | 145:64910690c574 | 336 | |
Kojto | 122:f9eeca106725 | 337 | /** @brief Checks if the specified I2S interrupt source is enabled or disabled. |
Kojto | 122:f9eeca106725 | 338 | * @param __HANDLE__: specifies the I2S Handle. |
Kojto | 122:f9eeca106725 | 339 | * This parameter can be I2S where x: 1, 2, or 3 to select the I2S peripheral. |
Kojto | 122:f9eeca106725 | 340 | * @param __INTERRUPT__: specifies the I2S interrupt source to check. |
Kojto | 122:f9eeca106725 | 341 | * This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 342 | * @arg I2S_IT_TXE: Tx buffer empty interrupt enable |
Kojto | 122:f9eeca106725 | 343 | * @arg I2S_IT_RXNE: RX buffer not empty interrupt enable |
Kojto | 122:f9eeca106725 | 344 | * @arg I2S_IT_ERR: Error interrupt enable |
Kojto | 122:f9eeca106725 | 345 | * @retval The new state of __IT__ (TRUE or FALSE). |
Kojto | 122:f9eeca106725 | 346 | */ |
Kojto | 122:f9eeca106725 | 347 | #define __HAL_I2S_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->CR2 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET) |
Kojto | 122:f9eeca106725 | 348 | |
Kojto | 122:f9eeca106725 | 349 | /** @brief Checks whether the specified I2S flag is set or not. |
Kojto | 122:f9eeca106725 | 350 | * @param __HANDLE__: specifies the I2S Handle. |
Kojto | 122:f9eeca106725 | 351 | * @param __FLAG__: specifies the flag to check. |
Kojto | 122:f9eeca106725 | 352 | * This parameter can be one of the following values: |
Kojto | 122:f9eeca106725 | 353 | * @arg I2S_FLAG_RXNE: Receive buffer not empty flag |
Kojto | 122:f9eeca106725 | 354 | * @arg I2S_FLAG_TXE: Transmit buffer empty flag |
Kojto | 122:f9eeca106725 | 355 | * @arg I2S_FLAG_UDR: Underrun flag |
Kojto | 122:f9eeca106725 | 356 | * @arg I2S_FLAG_OVR: Overrun flag |
Kojto | 122:f9eeca106725 | 357 | * @arg I2S_FLAG_FRE: Frame error flag |
Kojto | 122:f9eeca106725 | 358 | * @arg I2S_FLAG_CHSIDE: Channel Side flag |
Kojto | 122:f9eeca106725 | 359 | * @arg I2S_FLAG_BSY: Busy flag |
Kojto | 122:f9eeca106725 | 360 | * @retval The new state of __FLAG__ (TRUE or FALSE). |
Kojto | 122:f9eeca106725 | 361 | */ |
Kojto | 122:f9eeca106725 | 362 | #define __HAL_I2S_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__)) |
Kojto | 122:f9eeca106725 | 363 | |
Kojto | 122:f9eeca106725 | 364 | /** @brief Clears the I2S OVR pending flag. |
Kojto | 122:f9eeca106725 | 365 | * @param __HANDLE__: specifies the I2S Handle. |
Kojto | 122:f9eeca106725 | 366 | * @retval None |
Kojto | 122:f9eeca106725 | 367 | */ |
Kojto | 122:f9eeca106725 | 368 | #define __HAL_I2S_CLEAR_OVRFLAG(__HANDLE__) \ |
Kojto | 122:f9eeca106725 | 369 | do{ \ |
Kojto | 122:f9eeca106725 | 370 | __IO uint32_t tmpreg = 0x00U; \ |
Kojto | 122:f9eeca106725 | 371 | tmpreg = (__HANDLE__)->Instance->DR; \ |
Kojto | 122:f9eeca106725 | 372 | tmpreg = (__HANDLE__)->Instance->SR; \ |
Kojto | 122:f9eeca106725 | 373 | UNUSED(tmpreg); \ |
Kojto | 122:f9eeca106725 | 374 | } while(0) |
AnnaBridge | 145:64910690c574 | 375 | |
Kojto | 122:f9eeca106725 | 376 | /** @brief Clears the I2S UDR pending flag. |
Kojto | 122:f9eeca106725 | 377 | * @param __HANDLE__: specifies the I2S Handle. |
Kojto | 122:f9eeca106725 | 378 | * @retval None |
Kojto | 122:f9eeca106725 | 379 | */ |
Kojto | 122:f9eeca106725 | 380 | #define __HAL_I2S_CLEAR_UDRFLAG(__HANDLE__) \ |
Kojto | 122:f9eeca106725 | 381 | do{ \ |
Kojto | 122:f9eeca106725 | 382 | __IO uint32_t tmpreg = 0x00U; \ |
Kojto | 122:f9eeca106725 | 383 | tmpreg = (__HANDLE__)->Instance->SR; \ |
Kojto | 122:f9eeca106725 | 384 | UNUSED(tmpreg); \ |
Kojto | 122:f9eeca106725 | 385 | } while(0) |
Kojto | 122:f9eeca106725 | 386 | /** |
Kojto | 122:f9eeca106725 | 387 | * @} |
Kojto | 122:f9eeca106725 | 388 | */ |
AnnaBridge | 145:64910690c574 | 389 | |
Kojto | 122:f9eeca106725 | 390 | /* Include I2S Extension module */ |
Kojto | 122:f9eeca106725 | 391 | #include "stm32f4xx_hal_i2s_ex.h" |
Kojto | 122:f9eeca106725 | 392 | |
Kojto | 122:f9eeca106725 | 393 | /* Exported functions --------------------------------------------------------*/ |
AnnaBridge | 145:64910690c574 | 394 | /** @defgroup I2S_Exported_Functions I2S Exported Functions |
Kojto | 122:f9eeca106725 | 395 | * @{ |
Kojto | 122:f9eeca106725 | 396 | */ |
Kojto | 122:f9eeca106725 | 397 | |
AnnaBridge | 145:64910690c574 | 398 | /** @defgroup I2S_Exported_Functions_Group1 I2S Initialization and de-initialization functions |
Kojto | 122:f9eeca106725 | 399 | * @{ |
Kojto | 122:f9eeca106725 | 400 | */ |
Kojto | 122:f9eeca106725 | 401 | /* Initialization/de-initialization functions **********************************/ |
Kojto | 122:f9eeca106725 | 402 | HAL_StatusTypeDef HAL_I2S_Init(I2S_HandleTypeDef *hi2s); |
Kojto | 122:f9eeca106725 | 403 | HAL_StatusTypeDef HAL_I2S_DeInit (I2S_HandleTypeDef *hi2s); |
Kojto | 122:f9eeca106725 | 404 | void HAL_I2S_MspInit(I2S_HandleTypeDef *hi2s); |
Kojto | 122:f9eeca106725 | 405 | void HAL_I2S_MspDeInit(I2S_HandleTypeDef *hi2s); |
Kojto | 122:f9eeca106725 | 406 | /** |
Kojto | 122:f9eeca106725 | 407 | * @} |
Kojto | 122:f9eeca106725 | 408 | */ |
Kojto | 122:f9eeca106725 | 409 | |
AnnaBridge | 145:64910690c574 | 410 | /** @defgroup I2S_Exported_Functions_Group2 I2S IO operation functions |
Kojto | 122:f9eeca106725 | 411 | * @{ |
Kojto | 122:f9eeca106725 | 412 | */ |
Kojto | 122:f9eeca106725 | 413 | /* I/O operation functions *****************************************************/ |
Kojto | 122:f9eeca106725 | 414 | /* Blocking mode: Polling */ |
Kojto | 122:f9eeca106725 | 415 | HAL_StatusTypeDef HAL_I2S_Transmit(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 122:f9eeca106725 | 416 | HAL_StatusTypeDef HAL_I2S_Receive(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size, uint32_t Timeout); |
Kojto | 122:f9eeca106725 | 417 | |
Kojto | 122:f9eeca106725 | 418 | /* Non-Blocking mode: Interrupt */ |
Kojto | 122:f9eeca106725 | 419 | HAL_StatusTypeDef HAL_I2S_Transmit_IT(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size); |
Kojto | 122:f9eeca106725 | 420 | HAL_StatusTypeDef HAL_I2S_Receive_IT(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size); |
Kojto | 122:f9eeca106725 | 421 | void HAL_I2S_IRQHandler(I2S_HandleTypeDef *hi2s); |
Kojto | 122:f9eeca106725 | 422 | |
Kojto | 122:f9eeca106725 | 423 | /* Non-Blocking mode: DMA */ |
Kojto | 122:f9eeca106725 | 424 | HAL_StatusTypeDef HAL_I2S_Transmit_DMA(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size); |
Kojto | 122:f9eeca106725 | 425 | HAL_StatusTypeDef HAL_I2S_Receive_DMA(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size); |
Kojto | 122:f9eeca106725 | 426 | |
Kojto | 122:f9eeca106725 | 427 | HAL_StatusTypeDef HAL_I2S_DMAPause(I2S_HandleTypeDef *hi2s); |
Kojto | 122:f9eeca106725 | 428 | HAL_StatusTypeDef HAL_I2S_DMAResume(I2S_HandleTypeDef *hi2s); |
Kojto | 122:f9eeca106725 | 429 | HAL_StatusTypeDef HAL_I2S_DMAStop(I2S_HandleTypeDef *hi2s); |
Kojto | 122:f9eeca106725 | 430 | |
Kojto | 122:f9eeca106725 | 431 | /* Callbacks used in non blocking modes (Interrupt and DMA) *******************/ |
Kojto | 122:f9eeca106725 | 432 | void HAL_I2S_TxHalfCpltCallback(I2S_HandleTypeDef *hi2s); |
Kojto | 122:f9eeca106725 | 433 | void HAL_I2S_TxCpltCallback(I2S_HandleTypeDef *hi2s); |
Kojto | 122:f9eeca106725 | 434 | void HAL_I2S_RxHalfCpltCallback(I2S_HandleTypeDef *hi2s); |
Kojto | 122:f9eeca106725 | 435 | void HAL_I2S_RxCpltCallback(I2S_HandleTypeDef *hi2s); |
Kojto | 122:f9eeca106725 | 436 | void HAL_I2S_ErrorCallback(I2S_HandleTypeDef *hi2s); |
Kojto | 122:f9eeca106725 | 437 | /** |
Kojto | 122:f9eeca106725 | 438 | * @} |
AnnaBridge | 145:64910690c574 | 439 | */ |
AnnaBridge | 145:64910690c574 | 440 | |
AnnaBridge | 145:64910690c574 | 441 | /** @defgroup I2S_Exported_Functions_Group3 I2S Peripheral Control and State functions |
AnnaBridge | 145:64910690c574 | 442 | * @{ |
AnnaBridge | 145:64910690c574 | 443 | */ |
AnnaBridge | 145:64910690c574 | 444 | /* Peripheral Control and State functions ************************************/ |
AnnaBridge | 145:64910690c574 | 445 | HAL_I2S_StateTypeDef HAL_I2S_GetState(I2S_HandleTypeDef *hi2s); |
AnnaBridge | 145:64910690c574 | 446 | uint32_t HAL_I2S_GetError(I2S_HandleTypeDef *hi2s); |
AnnaBridge | 145:64910690c574 | 447 | /** |
AnnaBridge | 145:64910690c574 | 448 | * @} |
AnnaBridge | 145:64910690c574 | 449 | */ |
Kojto | 122:f9eeca106725 | 450 | |
Kojto | 122:f9eeca106725 | 451 | /** |
Kojto | 122:f9eeca106725 | 452 | * @} |
Kojto | 122:f9eeca106725 | 453 | */ |
Kojto | 122:f9eeca106725 | 454 | |
Kojto | 122:f9eeca106725 | 455 | /* Private types -------------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 456 | /* Private variables ---------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 457 | /* Private constants ---------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 458 | /** @defgroup I2S_Private_Constants I2S Private Constants |
Kojto | 122:f9eeca106725 | 459 | * @{ |
Kojto | 122:f9eeca106725 | 460 | */ |
Kojto | 122:f9eeca106725 | 461 | |
Kojto | 122:f9eeca106725 | 462 | /** |
Kojto | 122:f9eeca106725 | 463 | * @} |
Kojto | 122:f9eeca106725 | 464 | */ |
Kojto | 122:f9eeca106725 | 465 | |
Kojto | 122:f9eeca106725 | 466 | /* Private macros ------------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 467 | /** @defgroup I2S_Private_Macros I2S Private Macros |
Kojto | 122:f9eeca106725 | 468 | * @{ |
Kojto | 122:f9eeca106725 | 469 | */ |
Kojto | 122:f9eeca106725 | 470 | #define IS_I2S_MODE(MODE) (((MODE) == I2S_MODE_SLAVE_TX) || \ |
Kojto | 122:f9eeca106725 | 471 | ((MODE) == I2S_MODE_SLAVE_RX) || \ |
Kojto | 122:f9eeca106725 | 472 | ((MODE) == I2S_MODE_MASTER_TX) || \ |
Kojto | 122:f9eeca106725 | 473 | ((MODE) == I2S_MODE_MASTER_RX)) |
AnnaBridge | 145:64910690c574 | 474 | |
Kojto | 122:f9eeca106725 | 475 | #define IS_I2S_STANDARD(STANDARD) (((STANDARD) == I2S_STANDARD_PHILIPS) || \ |
Kojto | 122:f9eeca106725 | 476 | ((STANDARD) == I2S_STANDARD_MSB) || \ |
Kojto | 122:f9eeca106725 | 477 | ((STANDARD) == I2S_STANDARD_LSB) || \ |
Kojto | 122:f9eeca106725 | 478 | ((STANDARD) == I2S_STANDARD_PCM_SHORT) || \ |
Kojto | 122:f9eeca106725 | 479 | ((STANDARD) == I2S_STANDARD_PCM_LONG)) |
Kojto | 122:f9eeca106725 | 480 | |
Kojto | 122:f9eeca106725 | 481 | #define IS_I2S_DATA_FORMAT(FORMAT) (((FORMAT) == I2S_DATAFORMAT_16B) || \ |
Kojto | 122:f9eeca106725 | 482 | ((FORMAT) == I2S_DATAFORMAT_16B_EXTENDED) || \ |
Kojto | 122:f9eeca106725 | 483 | ((FORMAT) == I2S_DATAFORMAT_24B) || \ |
Kojto | 122:f9eeca106725 | 484 | ((FORMAT) == I2S_DATAFORMAT_32B)) |
Kojto | 122:f9eeca106725 | 485 | |
Kojto | 122:f9eeca106725 | 486 | #define IS_I2S_MCLK_OUTPUT(OUTPUT) (((OUTPUT) == I2S_MCLKOUTPUT_ENABLE) || \ |
Kojto | 122:f9eeca106725 | 487 | ((OUTPUT) == I2S_MCLKOUTPUT_DISABLE)) |
AnnaBridge | 145:64910690c574 | 488 | |
Kojto | 122:f9eeca106725 | 489 | #define IS_I2S_AUDIO_FREQ(FREQ) ((((FREQ) >= I2S_AUDIOFREQ_8K) && \ |
Kojto | 122:f9eeca106725 | 490 | ((FREQ) <= I2S_AUDIOFREQ_192K)) || \ |
Kojto | 122:f9eeca106725 | 491 | ((FREQ) == I2S_AUDIOFREQ_DEFAULT)) |
Kojto | 122:f9eeca106725 | 492 | |
Kojto | 122:f9eeca106725 | 493 | #define IS_I2S_FULLDUPLEX_MODE(MODE) (((MODE) == I2S_FULLDUPLEXMODE_DISABLE) || \ |
Kojto | 122:f9eeca106725 | 494 | ((MODE) == I2S_FULLDUPLEXMODE_ENABLE)) |
Kojto | 122:f9eeca106725 | 495 | |
Kojto | 122:f9eeca106725 | 496 | #define IS_I2S_CPOL(CPOL) (((CPOL) == I2S_CPOL_LOW) || \ |
Kojto | 122:f9eeca106725 | 497 | ((CPOL) == I2S_CPOL_HIGH)) |
AnnaBridge | 145:64910690c574 | 498 | |
AnnaBridge | 145:64910690c574 | 499 | #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \ |
AnnaBridge | 145:64910690c574 | 500 | defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \ |
AnnaBridge | 145:64910690c574 | 501 | defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F469xx) || \ |
AnnaBridge | 145:64910690c574 | 502 | defined(STM32F479xx) |
AnnaBridge | 145:64910690c574 | 503 | #define IS_I2S_CLOCKSOURCE(CLOCK) (((CLOCK) == I2S_CLOCK_EXTERNAL) ||\ |
AnnaBridge | 145:64910690c574 | 504 | ((CLOCK) == I2S_CLOCK_PLL)) |
AnnaBridge | 145:64910690c574 | 505 | #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || |
AnnaBridge | 145:64910690c574 | 506 | STM32F401xC || STM32F401xE || STM32F411xE || STM32F469xx || STM32F479xx */ |
AnnaBridge | 145:64910690c574 | 507 | |
AnnaBridge | 145:64910690c574 | 508 | #if defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) ||\ |
AnnaBridge | 145:64910690c574 | 509 | defined(STM32F412Rx) || defined(STM32F412Cx) || defined (STM32F413xx) ||\ |
AnnaBridge | 145:64910690c574 | 510 | defined(STM32F423xx) |
AnnaBridge | 145:64910690c574 | 511 | #define IS_I2S_CLOCKSOURCE(CLOCK) (((CLOCK) == I2S_CLOCK_EXTERNAL) ||\ |
AnnaBridge | 145:64910690c574 | 512 | ((CLOCK) == I2S_CLOCK_PLL) ||\ |
AnnaBridge | 145:64910690c574 | 513 | ((CLOCK) == I2S_CLOCK_PLLSRC) ||\ |
AnnaBridge | 145:64910690c574 | 514 | ((CLOCK) == I2S_CLOCK_PLLR)) |
AnnaBridge | 145:64910690c574 | 515 | #endif /* STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */ |
AnnaBridge | 145:64910690c574 | 516 | |
AnnaBridge | 145:64910690c574 | 517 | #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) |
AnnaBridge | 145:64910690c574 | 518 | #define IS_I2S_CLOCKSOURCE(CLOCK) (((CLOCK) == I2S_CLOCK_EXTERNAL) ||\ |
AnnaBridge | 145:64910690c574 | 519 | ((CLOCK) == I2S_CLOCK_PLLSRC) ||\ |
AnnaBridge | 145:64910690c574 | 520 | ((CLOCK) == I2S_CLOCK_PLLR)) |
AnnaBridge | 145:64910690c574 | 521 | #endif /* STM32F410Tx || STM32F410Cx || STM32F410Rx */ |
AnnaBridge | 145:64910690c574 | 522 | |
Kojto | 122:f9eeca106725 | 523 | /** |
Kojto | 122:f9eeca106725 | 524 | * @} |
Kojto | 122:f9eeca106725 | 525 | */ |
Kojto | 122:f9eeca106725 | 526 | |
Kojto | 122:f9eeca106725 | 527 | /* Private functions ---------------------------------------------------------*/ |
Kojto | 122:f9eeca106725 | 528 | /** |
Kojto | 122:f9eeca106725 | 529 | * @} |
Kojto | 122:f9eeca106725 | 530 | */ |
Kojto | 122:f9eeca106725 | 531 | |
Kojto | 122:f9eeca106725 | 532 | /** |
Kojto | 122:f9eeca106725 | 533 | * @} |
AnnaBridge | 145:64910690c574 | 534 | */ |
Kojto | 122:f9eeca106725 | 535 | |
Kojto | 122:f9eeca106725 | 536 | #ifdef __cplusplus |
Kojto | 122:f9eeca106725 | 537 | } |
Kojto | 122:f9eeca106725 | 538 | #endif |
Kojto | 122:f9eeca106725 | 539 | |
Kojto | 122:f9eeca106725 | 540 | |
Kojto | 122:f9eeca106725 | 541 | #endif /* __STM32F4xx_HAL_I2S_H */ |
Kojto | 122:f9eeca106725 | 542 | |
Kojto | 122:f9eeca106725 | 543 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |