You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

508 lines
20 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32l0xx_hal_i2s.h
  4. * @author MCD Application Team
  5. * @brief Header file of I2S HAL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright(c) 2016 STMicroelectronics.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by ST under BSD 3-Clause license,
  13. * the "License"; You may not use this file except in compliance with the
  14. * License. You may obtain a copy of the License at:
  15. * opensource.org/licenses/BSD-3-Clause
  16. *
  17. ******************************************************************************
  18. */
  19. /* Define to prevent recursive inclusion -------------------------------------*/
  20. #ifndef STM32L0xx_HAL_I2S_H
  21. #define STM32L0xx_HAL_I2S_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. #if defined(SPI_I2S_SUPPORT)
  26. /* Includes ------------------------------------------------------------------*/
  27. #include "stm32l0xx_hal_def.h"
  28. /** @addtogroup STM32L0xx_HAL_Driver
  29. * @{
  30. */
  31. /** @addtogroup I2S
  32. * @{
  33. */
  34. /* Exported types ------------------------------------------------------------*/
  35. /** @defgroup I2S_Exported_Types I2S Exported Types
  36. * @{
  37. */
  38. /**
  39. * @brief I2S Init structure definition
  40. */
  41. typedef struct
  42. {
  43. uint32_t Mode; /*!< Specifies the I2S operating mode.
  44. This parameter can be a value of @ref I2S_Mode */
  45. uint32_t Standard; /*!< Specifies the standard used for the I2S communication.
  46. This parameter can be a value of @ref I2S_Standard */
  47. uint32_t DataFormat; /*!< Specifies the data format for the I2S communication.
  48. This parameter can be a value of @ref I2S_Data_Format */
  49. uint32_t MCLKOutput; /*!< Specifies whether the I2S MCLK output is enabled or not.
  50. This parameter can be a value of @ref I2S_MCLK_Output */
  51. uint32_t AudioFreq; /*!< Specifies the frequency selected for the I2S communication.
  52. This parameter can be a value of @ref I2S_Audio_Frequency */
  53. uint32_t CPOL; /*!< Specifies the idle state of the I2S clock.
  54. This parameter can be a value of @ref I2S_Clock_Polarity */
  55. } I2S_InitTypeDef;
  56. /**
  57. * @brief HAL State structures definition
  58. */
  59. typedef enum
  60. {
  61. HAL_I2S_STATE_RESET = 0x00U, /*!< I2S not yet initialized or disabled */
  62. HAL_I2S_STATE_READY = 0x01U, /*!< I2S initialized and ready for use */
  63. HAL_I2S_STATE_BUSY = 0x02U, /*!< I2S internal process is ongoing */
  64. HAL_I2S_STATE_BUSY_TX = 0x03U, /*!< Data Transmission process is ongoing */
  65. HAL_I2S_STATE_BUSY_RX = 0x04U, /*!< Data Reception process is ongoing */
  66. HAL_I2S_STATE_TIMEOUT = 0x06U, /*!< I2S timeout state */
  67. HAL_I2S_STATE_ERROR = 0x07U /*!< I2S error state */
  68. } HAL_I2S_StateTypeDef;
  69. /**
  70. * @brief I2S handle Structure definition
  71. */
  72. typedef struct __I2S_HandleTypeDef
  73. {
  74. SPI_TypeDef *Instance; /*!< I2S registers base address */
  75. I2S_InitTypeDef Init; /*!< I2S communication parameters */
  76. uint16_t *pTxBuffPtr; /*!< Pointer to I2S Tx transfer buffer */
  77. __IO uint16_t TxXferSize; /*!< I2S Tx transfer size */
  78. __IO uint16_t TxXferCount; /*!< I2S Tx transfer Counter */
  79. uint16_t *pRxBuffPtr; /*!< Pointer to I2S Rx transfer buffer */
  80. __IO uint16_t RxXferSize; /*!< I2S Rx transfer size */
  81. __IO uint16_t RxXferCount; /*!< I2S Rx transfer counter
  82. (This field is initialized at the
  83. same value as transfer size at the
  84. beginning of the transfer and
  85. decremented when a sample is received
  86. NbSamplesReceived = RxBufferSize-RxBufferCount) */
  87. DMA_HandleTypeDef *hdmatx; /*!< I2S Tx DMA handle parameters */
  88. DMA_HandleTypeDef *hdmarx; /*!< I2S Rx DMA handle parameters */
  89. __IO HAL_LockTypeDef Lock; /*!< I2S locking object */
  90. __IO HAL_I2S_StateTypeDef State; /*!< I2S communication state */
  91. __IO uint32_t ErrorCode; /*!< I2S Error code
  92. This parameter can be a value of @ref I2S_Error */
  93. #if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
  94. void (* TxCpltCallback)(struct __I2S_HandleTypeDef *hi2s); /*!< I2S Tx Completed callback */
  95. void (* RxCpltCallback)(struct __I2S_HandleTypeDef *hi2s); /*!< I2S Rx Completed callback */
  96. void (* TxHalfCpltCallback)(struct __I2S_HandleTypeDef *hi2s); /*!< I2S Tx Half Completed callback */
  97. void (* RxHalfCpltCallback)(struct __I2S_HandleTypeDef *hi2s); /*!< I2S Rx Half Completed callback */
  98. void (* ErrorCallback)(struct __I2S_HandleTypeDef *hi2s); /*!< I2S Error callback */
  99. void (* MspInitCallback)(struct __I2S_HandleTypeDef *hi2s); /*!< I2S Msp Init callback */
  100. void (* MspDeInitCallback)(struct __I2S_HandleTypeDef *hi2s); /*!< I2S Msp DeInit callback */
  101. #endif /* USE_HAL_I2S_REGISTER_CALLBACKS */
  102. } I2S_HandleTypeDef;
  103. #if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
  104. /**
  105. * @brief HAL I2S Callback ID enumeration definition
  106. */
  107. typedef enum
  108. {
  109. HAL_I2S_TX_COMPLETE_CB_ID = 0x00U, /*!< I2S Tx Completed callback ID */
  110. HAL_I2S_RX_COMPLETE_CB_ID = 0x01U, /*!< I2S Rx Completed callback ID */
  111. HAL_I2S_TX_HALF_COMPLETE_CB_ID = 0x03U, /*!< I2S Tx Half Completed callback ID */
  112. HAL_I2S_RX_HALF_COMPLETE_CB_ID = 0x04U, /*!< I2S Rx Half Completed callback ID */
  113. HAL_I2S_ERROR_CB_ID = 0x06U, /*!< I2S Error callback ID */
  114. HAL_I2S_MSPINIT_CB_ID = 0x07U, /*!< I2S Msp Init callback ID */
  115. HAL_I2S_MSPDEINIT_CB_ID = 0x08U /*!< I2S Msp DeInit callback ID */
  116. } HAL_I2S_CallbackIDTypeDef;
  117. /**
  118. * @brief HAL I2S Callback pointer definition
  119. */
  120. typedef void (*pI2S_CallbackTypeDef)(I2S_HandleTypeDef *hi2s); /*!< pointer to an I2S callback function */
  121. #endif /* USE_HAL_I2S_REGISTER_CALLBACKS */
  122. /**
  123. * @}
  124. */
  125. /* Exported constants --------------------------------------------------------*/
  126. /** @defgroup I2S_Exported_Constants I2S Exported Constants
  127. * @{
  128. */
  129. /** @defgroup I2S_Error I2S Error
  130. * @{
  131. */
  132. #define HAL_I2S_ERROR_NONE (0x00000000U) /*!< No error */
  133. #define HAL_I2S_ERROR_TIMEOUT (0x00000001U) /*!< Timeout error */
  134. #define HAL_I2S_ERROR_OVR (0x00000002U) /*!< OVR error */
  135. #define HAL_I2S_ERROR_UDR (0x00000004U) /*!< UDR error */
  136. #define HAL_I2S_ERROR_DMA (0x00000008U) /*!< DMA transfer error */
  137. #define HAL_I2S_ERROR_PRESCALER (0x00000010U) /*!< Prescaler Calculation error */
  138. #if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
  139. #define HAL_I2S_ERROR_INVALID_CALLBACK (0x00000020U) /*!< Invalid Callback error */
  140. #endif /* USE_HAL_I2S_REGISTER_CALLBACKS */
  141. /**
  142. * @}
  143. */
  144. /** @defgroup I2S_Mode I2S Mode
  145. * @{
  146. */
  147. #define I2S_MODE_SLAVE_TX (0x00000000U)
  148. #define I2S_MODE_SLAVE_RX (SPI_I2SCFGR_I2SCFG_0)
  149. #define I2S_MODE_MASTER_TX (SPI_I2SCFGR_I2SCFG_1)
  150. #define I2S_MODE_MASTER_RX ((SPI_I2SCFGR_I2SCFG_0 | SPI_I2SCFGR_I2SCFG_1))
  151. /**
  152. * @}
  153. */
  154. /** @defgroup I2S_Standard I2S Standard
  155. * @{
  156. */
  157. #define I2S_STANDARD_PHILIPS (0x00000000U)
  158. #define I2S_STANDARD_MSB (SPI_I2SCFGR_I2SSTD_0)
  159. #define I2S_STANDARD_LSB (SPI_I2SCFGR_I2SSTD_1)
  160. #define I2S_STANDARD_PCM_SHORT ((SPI_I2SCFGR_I2SSTD_0 | SPI_I2SCFGR_I2SSTD_1))
  161. #define I2S_STANDARD_PCM_LONG ((SPI_I2SCFGR_I2SSTD_0 | SPI_I2SCFGR_I2SSTD_1 | SPI_I2SCFGR_PCMSYNC))
  162. /**
  163. * @}
  164. */
  165. /** @defgroup I2S_Data_Format I2S Data Format
  166. * @{
  167. */
  168. #define I2S_DATAFORMAT_16B (0x00000000U)
  169. #define I2S_DATAFORMAT_16B_EXTENDED (SPI_I2SCFGR_CHLEN)
  170. #define I2S_DATAFORMAT_24B ((SPI_I2SCFGR_CHLEN | SPI_I2SCFGR_DATLEN_0))
  171. #define I2S_DATAFORMAT_32B ((SPI_I2SCFGR_CHLEN | SPI_I2SCFGR_DATLEN_1))
  172. /**
  173. * @}
  174. */
  175. /** @defgroup I2S_MCLK_Output I2S MCLK Output
  176. * @{
  177. */
  178. #define I2S_MCLKOUTPUT_ENABLE (SPI_I2SPR_MCKOE)
  179. #define I2S_MCLKOUTPUT_DISABLE (0x00000000U)
  180. /**
  181. * @}
  182. */
  183. /** @defgroup I2S_Audio_Frequency I2S Audio Frequency
  184. * @{
  185. */
  186. #define I2S_AUDIOFREQ_192K (192000U)
  187. #define I2S_AUDIOFREQ_96K (96000U)
  188. #define I2S_AUDIOFREQ_48K (48000U)
  189. #define I2S_AUDIOFREQ_44K (44100U)
  190. #define I2S_AUDIOFREQ_32K (32000U)
  191. #define I2S_AUDIOFREQ_22K (22050U)
  192. #define I2S_AUDIOFREQ_16K (16000U)
  193. #define I2S_AUDIOFREQ_11K (11025U)
  194. #define I2S_AUDIOFREQ_8K (8000U)
  195. #define I2S_AUDIOFREQ_DEFAULT (2U)
  196. /**
  197. * @}
  198. */
  199. /** @defgroup I2S_Clock_Polarity I2S Clock Polarity
  200. * @{
  201. */
  202. #define I2S_CPOL_LOW (0x00000000U)
  203. #define I2S_CPOL_HIGH (SPI_I2SCFGR_CKPOL)
  204. /**
  205. * @}
  206. */
  207. /** @defgroup I2S_Interrupts_Definition I2S Interrupts Definition
  208. * @{
  209. */
  210. #define I2S_IT_TXE SPI_CR2_TXEIE
  211. #define I2S_IT_RXNE SPI_CR2_RXNEIE
  212. #define I2S_IT_ERR SPI_CR2_ERRIE
  213. /**
  214. * @}
  215. */
  216. /** @defgroup I2S_Flags_Definition I2S Flags Definition
  217. * @{
  218. */
  219. #define I2S_FLAG_TXE SPI_SR_TXE
  220. #define I2S_FLAG_RXNE SPI_SR_RXNE
  221. #define I2S_FLAG_UDR SPI_SR_UDR
  222. #define I2S_FLAG_OVR SPI_SR_OVR
  223. #define I2S_FLAG_FRE SPI_SR_FRE
  224. #define I2S_FLAG_CHSIDE SPI_SR_CHSIDE
  225. #define I2S_FLAG_BSY SPI_SR_BSY
  226. /**
  227. * @}
  228. */
  229. /**
  230. * @}
  231. */
  232. /* Exported macros -----------------------------------------------------------*/
  233. /** @defgroup I2S_Exported_macros I2S Exported Macros
  234. * @{
  235. */
  236. /** @brief Reset I2S handle state
  237. * @param __HANDLE__ specifies the I2S Handle.
  238. * @retval None
  239. */
  240. #if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
  241. #define __HAL_I2S_RESET_HANDLE_STATE(__HANDLE__) do{ \
  242. (__HANDLE__)->State = HAL_I2S_STATE_RESET; \
  243. (__HANDLE__)->MspInitCallback = NULL; \
  244. (__HANDLE__)->MspDeInitCallback = NULL; \
  245. } while(0)
  246. #else
  247. #define __HAL_I2S_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_I2S_STATE_RESET)
  248. #endif
  249. /** @brief Enable the specified SPI peripheral (in I2S mode).
  250. * @param __HANDLE__ specifies the I2S Handle.
  251. * @retval None
  252. */
  253. #define __HAL_I2S_ENABLE(__HANDLE__) (SET_BIT((__HANDLE__)->Instance->I2SCFGR, SPI_I2SCFGR_I2SE))
  254. /** @brief Disable the specified SPI peripheral (in I2S mode).
  255. * @param __HANDLE__ specifies the I2S Handle.
  256. * @retval None
  257. */
  258. #define __HAL_I2S_DISABLE(__HANDLE__) (CLEAR_BIT((__HANDLE__)->Instance->I2SCFGR, SPI_I2SCFGR_I2SE))
  259. /** @brief Enable the specified I2S interrupts.
  260. * @param __HANDLE__ specifies the I2S Handle.
  261. * @param __INTERRUPT__ specifies the interrupt source to enable or disable.
  262. * This parameter can be one of the following values:
  263. * @arg I2S_IT_TXE: Tx buffer empty interrupt enable
  264. * @arg I2S_IT_RXNE: RX buffer not empty interrupt enable
  265. * @arg I2S_IT_ERR: Error interrupt enable
  266. * @retval None
  267. */
  268. #define __HAL_I2S_ENABLE_IT(__HANDLE__, __INTERRUPT__) (SET_BIT((__HANDLE__)->Instance->CR2,(__INTERRUPT__)))
  269. /** @brief Disable the specified I2S interrupts.
  270. * @param __HANDLE__ specifies the I2S Handle.
  271. * @param __INTERRUPT__ specifies the interrupt source to enable or disable.
  272. * This parameter can be one of the following values:
  273. * @arg I2S_IT_TXE: Tx buffer empty interrupt enable
  274. * @arg I2S_IT_RXNE: RX buffer not empty interrupt enable
  275. * @arg I2S_IT_ERR: Error interrupt enable
  276. * @retval None
  277. */
  278. #define __HAL_I2S_DISABLE_IT(__HANDLE__, __INTERRUPT__) (CLEAR_BIT((__HANDLE__)->Instance->CR2,(__INTERRUPT__)))
  279. /** @brief Checks if the specified I2S interrupt source is enabled or disabled.
  280. * @param __HANDLE__ specifies the I2S Handle.
  281. * This parameter can be I2S where x: 1, 2, or 3 to select the I2S peripheral.
  282. * @param __INTERRUPT__ specifies the I2S interrupt source to check.
  283. * This parameter can be one of the following values:
  284. * @arg I2S_IT_TXE: Tx buffer empty interrupt enable
  285. * @arg I2S_IT_RXNE: RX buffer not empty interrupt enable
  286. * @arg I2S_IT_ERR: Error interrupt enable
  287. * @retval The new state of __IT__ (TRUE or FALSE).
  288. */
  289. #define __HAL_I2S_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->CR2 & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
  290. /** @brief Checks whether the specified I2S flag is set or not.
  291. * @param __HANDLE__ specifies the I2S Handle.
  292. * @param __FLAG__ specifies the flag to check.
  293. * This parameter can be one of the following values:
  294. * @arg I2S_FLAG_RXNE: Receive buffer not empty flag
  295. * @arg I2S_FLAG_TXE: Transmit buffer empty flag
  296. * @arg I2S_FLAG_UDR: Underrun flag
  297. * @arg I2S_FLAG_OVR: Overrun flag
  298. * @arg I2S_FLAG_FRE: Frame error flag
  299. * @arg I2S_FLAG_CHSIDE: Channel Side flag
  300. * @arg I2S_FLAG_BSY: Busy flag
  301. * @retval The new state of __FLAG__ (TRUE or FALSE).
  302. */
  303. #define __HAL_I2S_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__))
  304. /** @brief Clears the I2S OVR pending flag.
  305. * @param __HANDLE__ specifies the I2S Handle.
  306. * @retval None
  307. */
  308. #define __HAL_I2S_CLEAR_OVRFLAG(__HANDLE__) do{ \
  309. __IO uint32_t tmpreg_ovr = 0x00U; \
  310. tmpreg_ovr = (__HANDLE__)->Instance->DR; \
  311. tmpreg_ovr = (__HANDLE__)->Instance->SR; \
  312. UNUSED(tmpreg_ovr); \
  313. }while(0U)
  314. /** @brief Clears the I2S UDR pending flag.
  315. * @param __HANDLE__ specifies the I2S Handle.
  316. * @retval None
  317. */
  318. #define __HAL_I2S_CLEAR_UDRFLAG(__HANDLE__) do{\
  319. __IO uint32_t tmpreg_udr = 0x00U;\
  320. tmpreg_udr = ((__HANDLE__)->Instance->SR);\
  321. UNUSED(tmpreg_udr); \
  322. }while(0U)
  323. /**
  324. * @}
  325. */
  326. /* Exported functions --------------------------------------------------------*/
  327. /** @addtogroup I2S_Exported_Functions
  328. * @{
  329. */
  330. /** @addtogroup I2S_Exported_Functions_Group1
  331. * @{
  332. */
  333. /* Initialization/de-initialization functions ********************************/
  334. HAL_StatusTypeDef HAL_I2S_Init(I2S_HandleTypeDef *hi2s);
  335. HAL_StatusTypeDef HAL_I2S_DeInit(I2S_HandleTypeDef *hi2s);
  336. void HAL_I2S_MspInit(I2S_HandleTypeDef *hi2s);
  337. void HAL_I2S_MspDeInit(I2S_HandleTypeDef *hi2s);
  338. /* Callbacks Register/UnRegister functions ***********************************/
  339. #if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
  340. HAL_StatusTypeDef HAL_I2S_RegisterCallback(I2S_HandleTypeDef *hi2s, HAL_I2S_CallbackIDTypeDef CallbackID, pI2S_CallbackTypeDef pCallback);
  341. HAL_StatusTypeDef HAL_I2S_UnRegisterCallback(I2S_HandleTypeDef *hi2s, HAL_I2S_CallbackIDTypeDef CallbackID);
  342. #endif /* USE_HAL_I2S_REGISTER_CALLBACKS */
  343. /**
  344. * @}
  345. */
  346. /** @addtogroup I2S_Exported_Functions_Group2
  347. * @{
  348. */
  349. /* I/O operation functions ***************************************************/
  350. /* Blocking mode: Polling */
  351. HAL_StatusTypeDef HAL_I2S_Transmit(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size, uint32_t Timeout);
  352. HAL_StatusTypeDef HAL_I2S_Receive(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size, uint32_t Timeout);
  353. /* Non-Blocking mode: Interrupt */
  354. HAL_StatusTypeDef HAL_I2S_Transmit_IT(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size);
  355. HAL_StatusTypeDef HAL_I2S_Receive_IT(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size);
  356. void HAL_I2S_IRQHandler(I2S_HandleTypeDef *hi2s);
  357. /* Non-Blocking mode: DMA */
  358. HAL_StatusTypeDef HAL_I2S_Transmit_DMA(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size);
  359. HAL_StatusTypeDef HAL_I2S_Receive_DMA(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size);
  360. HAL_StatusTypeDef HAL_I2S_DMAPause(I2S_HandleTypeDef *hi2s);
  361. HAL_StatusTypeDef HAL_I2S_DMAResume(I2S_HandleTypeDef *hi2s);
  362. HAL_StatusTypeDef HAL_I2S_DMAStop(I2S_HandleTypeDef *hi2s);
  363. /* Callbacks used in non blocking modes (Interrupt and DMA) *******************/
  364. void HAL_I2S_TxHalfCpltCallback(I2S_HandleTypeDef *hi2s);
  365. void HAL_I2S_TxCpltCallback(I2S_HandleTypeDef *hi2s);
  366. void HAL_I2S_RxHalfCpltCallback(I2S_HandleTypeDef *hi2s);
  367. void HAL_I2S_RxCpltCallback(I2S_HandleTypeDef *hi2s);
  368. void HAL_I2S_ErrorCallback(I2S_HandleTypeDef *hi2s);
  369. /**
  370. * @}
  371. */
  372. /** @addtogroup I2S_Exported_Functions_Group3
  373. * @{
  374. */
  375. /* Peripheral Control and State functions ************************************/
  376. HAL_I2S_StateTypeDef HAL_I2S_GetState(I2S_HandleTypeDef *hi2s);
  377. uint32_t HAL_I2S_GetError(I2S_HandleTypeDef *hi2s);
  378. /**
  379. * @}
  380. */
  381. /**
  382. * @}
  383. */
  384. /* Private types -------------------------------------------------------------*/
  385. /* Private variables ---------------------------------------------------------*/
  386. /* Private constants ---------------------------------------------------------*/
  387. /** @defgroup I2S_Private_Constants I2S Private Constants
  388. * @{
  389. */
  390. /**
  391. * @}
  392. */
  393. /* Private macros ------------------------------------------------------------*/
  394. /** @defgroup I2S_Private_Macros I2S Private Macros
  395. * @{
  396. */
  397. #define IS_I2S_MODE(MODE) (((MODE) == I2S_MODE_SLAVE_TX) || \
  398. ((MODE) == I2S_MODE_SLAVE_RX) || \
  399. ((MODE) == I2S_MODE_MASTER_TX) || \
  400. ((MODE) == I2S_MODE_MASTER_RX))
  401. #define IS_I2S_STANDARD(STANDARD) (((STANDARD) == I2S_STANDARD_PHILIPS) || \
  402. ((STANDARD) == I2S_STANDARD_MSB) || \
  403. ((STANDARD) == I2S_STANDARD_LSB) || \
  404. ((STANDARD) == I2S_STANDARD_PCM_SHORT) || \
  405. ((STANDARD) == I2S_STANDARD_PCM_LONG))
  406. #define IS_I2S_DATA_FORMAT(FORMAT) (((FORMAT) == I2S_DATAFORMAT_16B) || \
  407. ((FORMAT) == I2S_DATAFORMAT_16B_EXTENDED) || \
  408. ((FORMAT) == I2S_DATAFORMAT_24B) || \
  409. ((FORMAT) == I2S_DATAFORMAT_32B))
  410. #define IS_I2S_MCLK_OUTPUT(OUTPUT) (((OUTPUT) == I2S_MCLKOUTPUT_ENABLE) || \
  411. ((OUTPUT) == I2S_MCLKOUTPUT_DISABLE))
  412. #define IS_I2S_AUDIO_FREQ(FREQ) ((((FREQ) >= I2S_AUDIOFREQ_8K) && \
  413. ((FREQ) <= I2S_AUDIOFREQ_192K)) || \
  414. ((FREQ) == I2S_AUDIOFREQ_DEFAULT))
  415. #define IS_I2S_CPOL(CPOL) (((CPOL) == I2S_CPOL_LOW) || \
  416. ((CPOL) == I2S_CPOL_HIGH))
  417. /**
  418. * @}
  419. */
  420. /**
  421. * @}
  422. */
  423. /**
  424. * @}
  425. */
  426. #endif /* SPI_I2S_SUPPORT */
  427. #ifdef __cplusplus
  428. }
  429. #endif
  430. #endif /* STM32L0xx_HAL_I2S_H */
  431. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/