训练营PLSR题目
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 
 

1142 строки
62 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32f4xx_hal_dfsdm.h
  4. * @author MCD Application Team
  5. * @brief Header file of DFSDM HAL module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2017 STMicroelectronics.
  10. * All rights reserved.
  11. *
  12. * This software is licensed under terms that can be found in the LICENSE file
  13. * in the root directory of this software component.
  14. * If no LICENSE file comes with this software, it is provided AS-IS.
  15. *
  16. ******************************************************************************
  17. */
  18. /* Define to prevent recursive inclusion -------------------------------------*/
  19. #ifndef __STM32F4xx_HAL_DFSDM_H
  20. #define __STM32F4xx_HAL_DFSDM_H
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
  25. /* Includes ------------------------------------------------------------------*/
  26. #include "stm32f4xx_hal_def.h"
  27. /** @addtogroup STM32F4xx_HAL_Driver
  28. * @{
  29. */
  30. /** @addtogroup DFSDM
  31. * @{
  32. */
  33. /* Exported types ------------------------------------------------------------*/
  34. /** @defgroup DFSDM_Exported_Types DFSDM Exported Types
  35. * @{
  36. */
  37. /**
  38. * @brief HAL DFSDM Channel states definition
  39. */
  40. typedef enum
  41. {
  42. HAL_DFSDM_CHANNEL_STATE_RESET = 0x00U, /*!< DFSDM channel not initialized */
  43. HAL_DFSDM_CHANNEL_STATE_READY = 0x01U, /*!< DFSDM channel initialized and ready for use */
  44. HAL_DFSDM_CHANNEL_STATE_ERROR = 0xFFU /*!< DFSDM channel state error */
  45. }HAL_DFSDM_Channel_StateTypeDef;
  46. /**
  47. * @brief DFSDM channel output clock structure definition
  48. */
  49. typedef struct
  50. {
  51. FunctionalState Activation; /*!< Output clock enable/disable */
  52. uint32_t Selection; /*!< Output clock is system clock or audio clock.
  53. This parameter can be a value of @ref DFSDM_Channel_OutputClock */
  54. uint32_t Divider; /*!< Output clock divider.
  55. This parameter must be a number between Min_Data = 2 and Max_Data = 256 */
  56. }DFSDM_Channel_OutputClockTypeDef;
  57. /**
  58. * @brief DFSDM channel input structure definition
  59. */
  60. typedef struct
  61. {
  62. uint32_t Multiplexer; /*!< Input is external serial inputs or internal register.
  63. This parameter can be a value of @ref DFSDM_Channel_InputMultiplexer */
  64. uint32_t DataPacking; /*!< Standard, interleaved or dual mode for internal register.
  65. This parameter can be a value of @ref DFSDM_Channel_DataPacking */
  66. uint32_t Pins; /*!< Input pins are taken from same or following channel.
  67. This parameter can be a value of @ref DFSDM_Channel_InputPins */
  68. }DFSDM_Channel_InputTypeDef;
  69. /**
  70. * @brief DFSDM channel serial interface structure definition
  71. */
  72. typedef struct
  73. {
  74. uint32_t Type; /*!< SPI or Manchester modes.
  75. This parameter can be a value of @ref DFSDM_Channel_SerialInterfaceType */
  76. uint32_t SpiClock; /*!< SPI clock select (external or internal with different sampling point).
  77. This parameter can be a value of @ref DFSDM_Channel_SpiClock */
  78. }DFSDM_Channel_SerialInterfaceTypeDef;
  79. /**
  80. * @brief DFSDM channel analog watchdog structure definition
  81. */
  82. typedef struct
  83. {
  84. uint32_t FilterOrder; /*!< Analog watchdog Sinc filter order.
  85. This parameter can be a value of @ref DFSDM_Channel_AwdFilterOrder */
  86. uint32_t Oversampling; /*!< Analog watchdog filter oversampling ratio.
  87. This parameter must be a number between Min_Data = 1 and Max_Data = 32 */
  88. }DFSDM_Channel_AwdTypeDef;
  89. /**
  90. * @brief DFSDM channel init structure definition
  91. */
  92. typedef struct
  93. {
  94. DFSDM_Channel_OutputClockTypeDef OutputClock; /*!< DFSDM channel output clock parameters */
  95. DFSDM_Channel_InputTypeDef Input; /*!< DFSDM channel input parameters */
  96. DFSDM_Channel_SerialInterfaceTypeDef SerialInterface; /*!< DFSDM channel serial interface parameters */
  97. DFSDM_Channel_AwdTypeDef Awd; /*!< DFSDM channel analog watchdog parameters */
  98. int32_t Offset; /*!< DFSDM channel offset.
  99. This parameter must be a number between Min_Data = -8388608 and Max_Data = 8388607 */
  100. uint32_t RightBitShift; /*!< DFSDM channel right bit shift.
  101. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x1F */
  102. }DFSDM_Channel_InitTypeDef;
  103. /**
  104. * @brief DFSDM channel handle structure definition
  105. */
  106. #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
  107. typedef struct __DFSDM_Channel_HandleTypeDef
  108. #else
  109. typedef struct
  110. #endif /* USE_HAL_DFSDM_REGISTER_CALLBACKS */
  111. {
  112. DFSDM_Channel_TypeDef *Instance; /*!< DFSDM channel instance */
  113. DFSDM_Channel_InitTypeDef Init; /*!< DFSDM channel init parameters */
  114. HAL_DFSDM_Channel_StateTypeDef State; /*!< DFSDM channel state */
  115. #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
  116. void (*CkabCallback) (struct __DFSDM_Channel_HandleTypeDef *hdfsdm_channel); /*!< DFSDM channel clock absence detection callback */
  117. void (*ScdCallback) (struct __DFSDM_Channel_HandleTypeDef *hdfsdm_channel); /*!< DFSDM channel short circuit detection callback */
  118. void (*MspInitCallback) (struct __DFSDM_Channel_HandleTypeDef *hdfsdm_channel); /*!< DFSDM channel MSP init callback */
  119. void (*MspDeInitCallback) (struct __DFSDM_Channel_HandleTypeDef *hdfsdm_channel); /*!< DFSDM channel MSP de-init callback */
  120. #endif
  121. }DFSDM_Channel_HandleTypeDef;
  122. #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
  123. /**
  124. * @brief DFSDM channel callback ID enumeration definition
  125. */
  126. typedef enum
  127. {
  128. HAL_DFSDM_CHANNEL_CKAB_CB_ID = 0x00U, /*!< DFSDM channel clock absence detection callback ID */
  129. HAL_DFSDM_CHANNEL_SCD_CB_ID = 0x01U, /*!< DFSDM channel short circuit detection callback ID */
  130. HAL_DFSDM_CHANNEL_MSPINIT_CB_ID = 0x02U, /*!< DFSDM channel MSP init callback ID */
  131. HAL_DFSDM_CHANNEL_MSPDEINIT_CB_ID = 0x03U /*!< DFSDM channel MSP de-init callback ID */
  132. }HAL_DFSDM_Channel_CallbackIDTypeDef;
  133. /**
  134. * @brief DFSDM channel callback pointer definition
  135. */
  136. typedef void (*pDFSDM_Channel_CallbackTypeDef)(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  137. #endif
  138. /**
  139. * @brief HAL DFSDM Filter states definition
  140. */
  141. typedef enum
  142. {
  143. HAL_DFSDM_FILTER_STATE_RESET = 0x00U, /*!< DFSDM filter not initialized */
  144. HAL_DFSDM_FILTER_STATE_READY = 0x01U, /*!< DFSDM filter initialized and ready for use */
  145. HAL_DFSDM_FILTER_STATE_REG = 0x02U, /*!< DFSDM filter regular conversion in progress */
  146. HAL_DFSDM_FILTER_STATE_INJ = 0x03U, /*!< DFSDM filter injected conversion in progress */
  147. HAL_DFSDM_FILTER_STATE_REG_INJ = 0x04U, /*!< DFSDM filter regular and injected conversions in progress */
  148. HAL_DFSDM_FILTER_STATE_ERROR = 0xFFU /*!< DFSDM filter state error */
  149. }HAL_DFSDM_Filter_StateTypeDef;
  150. /**
  151. * @brief DFSDM filter regular conversion parameters structure definition
  152. */
  153. typedef struct
  154. {
  155. uint32_t Trigger; /*!< Trigger used to start regular conversion: software or synchronous.
  156. This parameter can be a value of @ref DFSDM_Filter_Trigger */
  157. FunctionalState FastMode; /*!< Enable/disable fast mode for regular conversion */
  158. FunctionalState DmaMode; /*!< Enable/disable DMA for regular conversion */
  159. }DFSDM_Filter_RegularParamTypeDef;
  160. /**
  161. * @brief DFSDM filter injected conversion parameters structure definition
  162. */
  163. typedef struct
  164. {
  165. uint32_t Trigger; /*!< Trigger used to start injected conversion: software, external or synchronous.
  166. This parameter can be a value of @ref DFSDM_Filter_Trigger */
  167. FunctionalState ScanMode; /*!< Enable/disable scanning mode for injected conversion */
  168. FunctionalState DmaMode; /*!< Enable/disable DMA for injected conversion */
  169. uint32_t ExtTrigger; /*!< External trigger.
  170. This parameter can be a value of @ref DFSDM_Filter_ExtTrigger */
  171. uint32_t ExtTriggerEdge; /*!< External trigger edge: rising, falling or both.
  172. This parameter can be a value of @ref DFSDM_Filter_ExtTriggerEdge */
  173. }DFSDM_Filter_InjectedParamTypeDef;
  174. /**
  175. * @brief DFSDM filter parameters structure definition
  176. */
  177. typedef struct
  178. {
  179. uint32_t SincOrder; /*!< Sinc filter order.
  180. This parameter can be a value of @ref DFSDM_Filter_SincOrder */
  181. uint32_t Oversampling; /*!< Filter oversampling ratio.
  182. This parameter must be a number between Min_Data = 1 and Max_Data = 1024 */
  183. uint32_t IntOversampling; /*!< Integrator oversampling ratio.
  184. This parameter must be a number between Min_Data = 1 and Max_Data = 256 */
  185. }DFSDM_Filter_FilterParamTypeDef;
  186. /**
  187. * @brief DFSDM filter init structure definition
  188. */
  189. typedef struct
  190. {
  191. DFSDM_Filter_RegularParamTypeDef RegularParam; /*!< DFSDM regular conversion parameters */
  192. DFSDM_Filter_InjectedParamTypeDef InjectedParam; /*!< DFSDM injected conversion parameters */
  193. DFSDM_Filter_FilterParamTypeDef FilterParam; /*!< DFSDM filter parameters */
  194. }DFSDM_Filter_InitTypeDef;
  195. /**
  196. * @brief DFSDM filter handle structure definition
  197. */
  198. #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
  199. typedef struct __DFSDM_Filter_HandleTypeDef
  200. #else
  201. typedef struct
  202. #endif /* USE_HAL_DFSDM_REGISTER_CALLBACKS */
  203. {
  204. DFSDM_Filter_TypeDef *Instance; /*!< DFSDM filter instance */
  205. DFSDM_Filter_InitTypeDef Init; /*!< DFSDM filter init parameters */
  206. DMA_HandleTypeDef *hdmaReg; /*!< Pointer on DMA handler for regular conversions */
  207. DMA_HandleTypeDef *hdmaInj; /*!< Pointer on DMA handler for injected conversions */
  208. uint32_t RegularContMode; /*!< Regular conversion continuous mode */
  209. uint32_t RegularTrigger; /*!< Trigger used for regular conversion */
  210. uint32_t InjectedTrigger; /*!< Trigger used for injected conversion */
  211. uint32_t ExtTriggerEdge; /*!< Rising, falling or both edges selected */
  212. FunctionalState InjectedScanMode; /*!< Injected scanning mode */
  213. uint32_t InjectedChannelsNbr; /*!< Number of channels in injected sequence */
  214. uint32_t InjConvRemaining; /*!< Injected conversions remaining */
  215. HAL_DFSDM_Filter_StateTypeDef State; /*!< DFSDM filter state */
  216. uint32_t ErrorCode; /*!< DFSDM filter error code */
  217. #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
  218. void (*AwdCallback) (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
  219. uint32_t Channel, uint32_t Threshold); /*!< DFSDM filter analog watchdog callback */
  220. void (*RegConvCpltCallback) (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter); /*!< DFSDM filter regular conversion complete callback */
  221. void (*RegConvHalfCpltCallback) (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter); /*!< DFSDM filter half regular conversion complete callback */
  222. void (*InjConvCpltCallback) (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter); /*!< DFSDM filter injected conversion complete callback */
  223. void (*InjConvHalfCpltCallback) (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter); /*!< DFSDM filter half injected conversion complete callback */
  224. void (*ErrorCallback) (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter); /*!< DFSDM filter error callback */
  225. void (*MspInitCallback) (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter); /*!< DFSDM filter MSP init callback */
  226. void (*MspDeInitCallback) (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter); /*!< DFSDM filter MSP de-init callback */
  227. #endif
  228. }DFSDM_Filter_HandleTypeDef;
  229. /**
  230. * @brief DFSDM filter analog watchdog parameters structure definition
  231. */
  232. typedef struct
  233. {
  234. uint32_t DataSource; /*!< Values from digital filter or from channel watchdog filter.
  235. This parameter can be a value of @ref DFSDM_Filter_AwdDataSource */
  236. uint32_t Channel; /*!< Analog watchdog channel selection.
  237. This parameter can be a values combination of @ref DFSDM_Channel_Selection */
  238. int32_t HighThreshold; /*!< High threshold for the analog watchdog.
  239. This parameter must be a number between Min_Data = -8388608 and Max_Data = 8388607 */
  240. int32_t LowThreshold; /*!< Low threshold for the analog watchdog.
  241. This parameter must be a number between Min_Data = -8388608 and Max_Data = 8388607 */
  242. uint32_t HighBreakSignal; /*!< Break signal assigned to analog watchdog high threshold event.
  243. This parameter can be a values combination of @ref DFSDM_BreakSignals */
  244. uint32_t LowBreakSignal; /*!< Break signal assigned to analog watchdog low threshold event.
  245. This parameter can be a values combination of @ref DFSDM_BreakSignals */
  246. }DFSDM_Filter_AwdParamTypeDef;
  247. #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
  248. /**
  249. * @brief DFSDM filter callback ID enumeration definition
  250. */
  251. typedef enum
  252. {
  253. HAL_DFSDM_FILTER_REGCONV_COMPLETE_CB_ID = 0x00U, /*!< DFSDM filter regular conversion complete callback ID */
  254. HAL_DFSDM_FILTER_REGCONV_HALFCOMPLETE_CB_ID = 0x01U, /*!< DFSDM filter half regular conversion complete callback ID */
  255. HAL_DFSDM_FILTER_INJCONV_COMPLETE_CB_ID = 0x02U, /*!< DFSDM filter injected conversion complete callback ID */
  256. HAL_DFSDM_FILTER_INJCONV_HALFCOMPLETE_CB_ID = 0x03U, /*!< DFSDM filter half injected conversion complete callback ID */
  257. HAL_DFSDM_FILTER_ERROR_CB_ID = 0x04U, /*!< DFSDM filter error callback ID */
  258. HAL_DFSDM_FILTER_MSPINIT_CB_ID = 0x05U, /*!< DFSDM filter MSP init callback ID */
  259. HAL_DFSDM_FILTER_MSPDEINIT_CB_ID = 0x06U /*!< DFSDM filter MSP de-init callback ID */
  260. }HAL_DFSDM_Filter_CallbackIDTypeDef;
  261. /**
  262. * @brief DFSDM filter callback pointer definition
  263. */
  264. typedef void (*pDFSDM_Filter_CallbackTypeDef)(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  265. typedef void (*pDFSDM_Filter_AwdCallbackTypeDef)(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Channel, uint32_t Threshold);
  266. #endif
  267. /**
  268. * @}
  269. */
  270. #if defined(SYSCFG_MCHDLYCR_BSCKSEL)
  271. /**
  272. * @brief Synchronization parameters structure definition for STM32F413xx/STM32F423xx devices
  273. */
  274. typedef struct
  275. {
  276. uint32_t DFSDM1ClockIn; /*!< Source selection for DFSDM1_Ckin.
  277. This parameter can be a value of @ref DFSDM_1_CLOCKIN_SELECTION*/
  278. uint32_t DFSDM2ClockIn; /*!< Source selection for DFSDM2_Ckin.
  279. This parameter can be a value of @ref DFSDM_2_CLOCKIN_SELECTION*/
  280. uint32_t DFSDM1ClockOut; /*!< Source selection for DFSDM1_Ckout.
  281. This parameter can be a value of @ref DFSDM_1_CLOCKOUT_SELECTION*/
  282. uint32_t DFSDM2ClockOut; /*!< Source selection for DFSDM2_Ckout.
  283. This parameter can be a value of @ref DFSDM_2_CLOCKOUT_SELECTION*/
  284. uint32_t DFSDM1BitClkDistribution; /*!< Distribution of the DFSDM1 bitstream clock gated by TIM4 OC1 or TIM4 OC2.
  285. This parameter can be a value of @ref DFSDM_1_BIT_STREAM_DISTRIBUTION
  286. @note The DFSDM2 audio gated by TIM4 OC2 can be injected on CKIN0 or CKIN2
  287. @note The DFSDM2 audio gated by TIM4 OC1 can be injected on CKIN1 or CKIN3 */
  288. uint32_t DFSDM2BitClkDistribution; /*!< Distribution of the DFSDM2 bitstream clock gated by TIM3 OC1 or TIM3 OC2 or TIM3 OC3 or TIM3 OC4.
  289. This parameter can be a value of @ref DFSDM_2_BIT_STREAM_DISTRIBUTION
  290. @note The DFSDM2 audio gated by TIM3 OC4 can be injected on CKIN0 or CKIN4
  291. @note The DFSDM2 audio gated by TIM3 OC3 can be injected on CKIN1 or CKIN5
  292. @note The DFSDM2 audio gated by TIM3 OC2 can be injected on CKIN2 or CKIN6
  293. @note The DFSDM2 audio gated by TIM3 OC1 can be injected on CKIN3 or CKIN7 */
  294. uint32_t DFSDM1DataDistribution; /*!< Source selection for DatIn0 and DatIn2 of DFSDM1.
  295. This parameter can be a value of @ref DFSDM_1_DATA_DISTRIBUTION */
  296. uint32_t DFSDM2DataDistribution; /*!< Source selection for DatIn0, DatIn2, DatIn4 and DatIn6 of DFSDM2.
  297. This parameter can be a value of @ref DFSDM_2_DATA_DISTRIBUTION */
  298. }DFSDM_MultiChannelConfigTypeDef;
  299. #endif /* SYSCFG_MCHDLYCR_BSCKSEL */
  300. /**
  301. * @}
  302. */
  303. /* End of exported types -----------------------------------------------------*/
  304. /* Exported constants --------------------------------------------------------*/
  305. /** @defgroup DFSDM_Exported_Constants DFSDM Exported Constants
  306. * @{
  307. */
  308. /** @defgroup DFSDM_Channel_OutputClock DFSDM channel output clock selection
  309. * @{
  310. */
  311. #define DFSDM_CHANNEL_OUTPUT_CLOCK_SYSTEM 0x00000000U /*!< Source for output clock is system clock */
  312. #define DFSDM_CHANNEL_OUTPUT_CLOCK_AUDIO DFSDM_CHCFGR1_CKOUTSRC /*!< Source for output clock is audio clock */
  313. /**
  314. * @}
  315. */
  316. /** @defgroup DFSDM_Channel_InputMultiplexer DFSDM channel input multiplexer
  317. * @{
  318. */
  319. #define DFSDM_CHANNEL_EXTERNAL_INPUTS 0x00000000U /*!< Data are taken from external inputs */
  320. #define DFSDM_CHANNEL_INTERNAL_REGISTER DFSDM_CHCFGR1_DATMPX_1 /*!< Data are taken from internal register */
  321. /**
  322. * @}
  323. */
  324. /** @defgroup DFSDM_Channel_DataPacking DFSDM channel input data packing
  325. * @{
  326. */
  327. #define DFSDM_CHANNEL_STANDARD_MODE 0x00000000U /*!< Standard data packing mode */
  328. #define DFSDM_CHANNEL_INTERLEAVED_MODE DFSDM_CHCFGR1_DATPACK_0 /*!< Interleaved data packing mode */
  329. #define DFSDM_CHANNEL_DUAL_MODE DFSDM_CHCFGR1_DATPACK_1 /*!< Dual data packing mode */
  330. /**
  331. * @}
  332. */
  333. /** @defgroup DFSDM_Channel_InputPins DFSDM channel input pins
  334. * @{
  335. */
  336. #define DFSDM_CHANNEL_SAME_CHANNEL_PINS 0x00000000U /*!< Input from pins on same channel */
  337. #define DFSDM_CHANNEL_FOLLOWING_CHANNEL_PINS DFSDM_CHCFGR1_CHINSEL /*!< Input from pins on following channel */
  338. /**
  339. * @}
  340. */
  341. /** @defgroup DFSDM_Channel_SerialInterfaceType DFSDM channel serial interface type
  342. * @{
  343. */
  344. #define DFSDM_CHANNEL_SPI_RISING 0x00000000U /*!< SPI with rising edge */
  345. #define DFSDM_CHANNEL_SPI_FALLING DFSDM_CHCFGR1_SITP_0 /*!< SPI with falling edge */
  346. #define DFSDM_CHANNEL_MANCHESTER_RISING DFSDM_CHCFGR1_SITP_1 /*!< Manchester with rising edge */
  347. #define DFSDM_CHANNEL_MANCHESTER_FALLING DFSDM_CHCFGR1_SITP /*!< Manchester with falling edge */
  348. /**
  349. * @}
  350. */
  351. /** @defgroup DFSDM_Channel_SpiClock DFSDM channel SPI clock selection
  352. * @{
  353. */
  354. #define DFSDM_CHANNEL_SPI_CLOCK_EXTERNAL 0x00000000U /*!< External SPI clock */
  355. #define DFSDM_CHANNEL_SPI_CLOCK_INTERNAL DFSDM_CHCFGR1_SPICKSEL_0 /*!< Internal SPI clock */
  356. #define DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_FALLING DFSDM_CHCFGR1_SPICKSEL_1 /*!< Internal SPI clock divided by 2, falling edge */
  357. #define DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_RISING DFSDM_CHCFGR1_SPICKSEL /*!< Internal SPI clock divided by 2, rising edge */
  358. /**
  359. * @}
  360. */
  361. /** @defgroup DFSDM_Channel_AwdFilterOrder DFSDM channel analog watchdog filter order
  362. * @{
  363. */
  364. #define DFSDM_CHANNEL_FASTSINC_ORDER 0x00000000U /*!< FastSinc filter type */
  365. #define DFSDM_CHANNEL_SINC1_ORDER DFSDM_CHAWSCDR_AWFORD_0 /*!< Sinc 1 filter type */
  366. #define DFSDM_CHANNEL_SINC2_ORDER DFSDM_CHAWSCDR_AWFORD_1 /*!< Sinc 2 filter type */
  367. #define DFSDM_CHANNEL_SINC3_ORDER DFSDM_CHAWSCDR_AWFORD /*!< Sinc 3 filter type */
  368. /**
  369. * @}
  370. */
  371. /** @defgroup DFSDM_Filter_Trigger DFSDM filter conversion trigger
  372. * @{
  373. */
  374. #define DFSDM_FILTER_SW_TRIGGER 0x00000000U /*!< Software trigger */
  375. #define DFSDM_FILTER_SYNC_TRIGGER 0x00000001U /*!< Synchronous with DFSDM_FLT0 */
  376. #define DFSDM_FILTER_EXT_TRIGGER 0x00000002U /*!< External trigger (only for injected conversion) */
  377. /**
  378. * @}
  379. */
  380. /** @defgroup DFSDM_Filter_ExtTrigger DFSDM filter external trigger
  381. * @{
  382. */
  383. #if defined(STM32F413xx) || defined(STM32F423xx)
  384. /* Trigger for stm32f413xx and STM32f423xx devices */
  385. #define DFSDM_FILTER_EXT_TRIG_TIM1_TRGO 0x00000000U /*!< For All DFSDM1/2 filters */
  386. #define DFSDM_FILTER_EXT_TRIG_TIM3_TRGO DFSDM_FLTCR1_JEXTSEL_0 /*!< For All DFSDM1/2 filters */
  387. #define DFSDM_FILTER_EXT_TRIG_TIM8_TRGO DFSDM_FLTCR1_JEXTSEL_1 /*!< For All DFSDM1/2 filters */
  388. #define DFSDM_FILTER_EXT_TRIG_TIM10_OC1 (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_1) /*!< For DFSDM1 filter 0 and 1 and DFSDM2 filter 0, 1 and 2 */
  389. #define DFSDM_FILTER_EXT_TRIG_TIM2_TRGO (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_1) /*!< For DFSDM2 filter 3 */
  390. #define DFSDM_FILTER_EXT_TRIG_TIM4_TRGO DFSDM_FLTCR1_JEXTSEL_2 /*!< For DFSDM1 filter 0 and 1 and DFSDM2 filter 0, 1 and 2 */
  391. #define DFSDM_FILTER_EXT_TRIG_TIM11_OC1 DFSDM_FLTCR1_JEXTSEL_2 /*!< For DFSDM2 filter 3 */
  392. #define DFSDM_FILTER_EXT_TRIG_TIM6_TRGO (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_2) /*!< For DFSDM1 filter 0 and 1 and DFSDM2 filter 0 and 1 */
  393. #define DFSDM_FILTER_EXT_TRIG_TIM7_TRGO (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_2) /*!< For DFSDM2 filter 2 and 3*/
  394. #define DFSDM_FILTER_EXT_TRIG_EXTI11 (DFSDM_FLTCR1_JEXTSEL_1 | DFSDM_FLTCR1_JEXTSEL_2) /*!< For All DFSDM1/2 filters */
  395. #define DFSDM_FILTER_EXT_TRIG_EXTI15 DFSDM_FLTCR1_JEXTSEL /*!< For All DFSDM1/2 filters */
  396. #else
  397. /* Trigger for stm32f412xx devices */
  398. #define DFSDM_FILTER_EXT_TRIG_TIM1_TRGO 0x00000000U /*!< For DFSDM1 filter 0 and 1*/
  399. #define DFSDM_FILTER_EXT_TRIG_TIM3_TRGO DFSDM_FLTCR1_JEXTSEL_0 /*!< For DFSDM1 filter 0 and 1*/
  400. #define DFSDM_FILTER_EXT_TRIG_TIM8_TRGO DFSDM_FLTCR1_JEXTSEL_1 /*!< For DFSDM1 filter 0 and 1*/
  401. #define DFSDM_FILTER_EXT_TRIG_TIM10_OC1 (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_1) /*!< For DFSDM1 filter 0 and 1*/
  402. #define DFSDM_FILTER_EXT_TRIG_TIM4_TRGO DFSDM_FLTCR1_JEXTSEL_2 /*!< For DFSDM1 filter 0 and 1*/
  403. #define DFSDM_FILTER_EXT_TRIG_TIM6_TRGO (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_2) /*!< For DFSDM1 filter 0 and 1*/
  404. #define DFSDM_FILTER_EXT_TRIG_EXTI11 (DFSDM_FLTCR1_JEXTSEL_1 | DFSDM_FLTCR1_JEXTSEL_2) /*!< For DFSDM1 filter 0 and 1*/
  405. #define DFSDM_FILTER_EXT_TRIG_EXTI15 DFSDM_FLTCR1_JEXTSEL /*!< For DFSDM1 filter 0 and 1*/
  406. #endif
  407. /**
  408. * @}
  409. */
  410. /** @defgroup DFSDM_Filter_ExtTriggerEdge DFSDM filter external trigger edge
  411. * @{
  412. */
  413. #define DFSDM_FILTER_EXT_TRIG_RISING_EDGE DFSDM_FLTCR1_JEXTEN_0 /*!< External rising edge */
  414. #define DFSDM_FILTER_EXT_TRIG_FALLING_EDGE DFSDM_FLTCR1_JEXTEN_1 /*!< External falling edge */
  415. #define DFSDM_FILTER_EXT_TRIG_BOTH_EDGES DFSDM_FLTCR1_JEXTEN /*!< External rising and falling edges */
  416. /**
  417. * @}
  418. */
  419. /** @defgroup DFSDM_Filter_SincOrder DFSDM filter sinc order
  420. * @{
  421. */
  422. #define DFSDM_FILTER_FASTSINC_ORDER 0x00000000U /*!< FastSinc filter type */
  423. #define DFSDM_FILTER_SINC1_ORDER DFSDM_FLTFCR_FORD_0 /*!< Sinc 1 filter type */
  424. #define DFSDM_FILTER_SINC2_ORDER DFSDM_FLTFCR_FORD_1 /*!< Sinc 2 filter type */
  425. #define DFSDM_FILTER_SINC3_ORDER (DFSDM_FLTFCR_FORD_0 | DFSDM_FLTFCR_FORD_1) /*!< Sinc 3 filter type */
  426. #define DFSDM_FILTER_SINC4_ORDER DFSDM_FLTFCR_FORD_2 /*!< Sinc 4 filter type */
  427. #define DFSDM_FILTER_SINC5_ORDER (DFSDM_FLTFCR_FORD_0 | DFSDM_FLTFCR_FORD_2) /*!< Sinc 5 filter type */
  428. /**
  429. * @}
  430. */
  431. /** @defgroup DFSDM_Filter_AwdDataSource DFSDM filter analog watchdog data source
  432. * @{
  433. */
  434. #define DFSDM_FILTER_AWD_FILTER_DATA 0x00000000U /*!< From digital filter */
  435. #define DFSDM_FILTER_AWD_CHANNEL_DATA DFSDM_FLTCR1_AWFSEL /*!< From analog watchdog channel */
  436. /**
  437. * @}
  438. */
  439. /** @defgroup DFSDM_Filter_ErrorCode DFSDM filter error code
  440. * @{
  441. */
  442. #define DFSDM_FILTER_ERROR_NONE 0x00000000U /*!< No error */
  443. #define DFSDM_FILTER_ERROR_REGULAR_OVERRUN 0x00000001U /*!< Overrun occurs during regular conversion */
  444. #define DFSDM_FILTER_ERROR_INJECTED_OVERRUN 0x00000002U /*!< Overrun occurs during injected conversion */
  445. #define DFSDM_FILTER_ERROR_DMA 0x00000003U /*!< DMA error occurs */
  446. #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
  447. #define DFSDM_FILTER_ERROR_INVALID_CALLBACK 0x00000004U /*!< Invalid callback error occurs */
  448. #endif
  449. /**
  450. * @}
  451. */
  452. /** @defgroup DFSDM_BreakSignals DFSDM break signals
  453. * @{
  454. */
  455. #define DFSDM_NO_BREAK_SIGNAL 0x00000000U /*!< No break signal */
  456. #define DFSDM_BREAK_SIGNAL_0 0x00000001U /*!< Break signal 0 */
  457. #define DFSDM_BREAK_SIGNAL_1 0x00000002U /*!< Break signal 1 */
  458. #define DFSDM_BREAK_SIGNAL_2 0x00000004U /*!< Break signal 2 */
  459. #define DFSDM_BREAK_SIGNAL_3 0x00000008U /*!< Break signal 3 */
  460. /**
  461. * @}
  462. */
  463. /** @defgroup DFSDM_Channel_Selection DFSDM Channel Selection
  464. * @{
  465. */
  466. /* DFSDM Channels ------------------------------------------------------------*/
  467. /* The DFSDM channels are defined as follows:
  468. - in 16-bit LSB the channel mask is set
  469. - in 16-bit MSB the channel number is set
  470. e.g. for channel 3 definition:
  471. - the channel mask is 0x00000008 (bit 3 is set)
  472. - the channel number 3 is 0x00030000
  473. --> Consequently, channel 3 definition is 0x00000008 | 0x00030000 = 0x00030008 */
  474. #define DFSDM_CHANNEL_0 0x00000001U
  475. #define DFSDM_CHANNEL_1 0x00010002U
  476. #define DFSDM_CHANNEL_2 0x00020004U
  477. #define DFSDM_CHANNEL_3 0x00030008U
  478. #define DFSDM_CHANNEL_4 0x00040010U /* only for stmm32f413xx and stm32f423xx devices */
  479. #define DFSDM_CHANNEL_5 0x00050020U /* only for stmm32f413xx and stm32f423xx devices */
  480. #define DFSDM_CHANNEL_6 0x00060040U /* only for stmm32f413xx and stm32f423xx devices */
  481. #define DFSDM_CHANNEL_7 0x00070080U /* only for stmm32f413xx and stm32f423xx devices */
  482. /**
  483. * @}
  484. */
  485. /** @defgroup DFSDM_ContinuousMode DFSDM Continuous Mode
  486. * @{
  487. */
  488. #define DFSDM_CONTINUOUS_CONV_OFF 0x00000000U /*!< Conversion are not continuous */
  489. #define DFSDM_CONTINUOUS_CONV_ON 0x00000001U /*!< Conversion are continuous */
  490. /**
  491. * @}
  492. */
  493. /** @defgroup DFSDM_AwdThreshold DFSDM analog watchdog threshold
  494. * @{
  495. */
  496. #define DFSDM_AWD_HIGH_THRESHOLD 0x00000000U /*!< Analog watchdog high threshold */
  497. #define DFSDM_AWD_LOW_THRESHOLD 0x00000001U /*!< Analog watchdog low threshold */
  498. /**
  499. * @}
  500. */
  501. #if defined(SYSCFG_MCHDLYCR_BSCKSEL)
  502. /** @defgroup DFSDM_1_CLOCKOUT_SELECTION DFSDM1 ClockOut Selection
  503. * @{
  504. */
  505. #define DFSDM1_CKOUT_DFSDM2_CKOUT 0x00000080U
  506. #define DFSDM1_CKOUT_DFSDM1 0x00000000U
  507. /**
  508. * @}
  509. */
  510. /** @defgroup DFSDM_2_CLOCKOUT_SELECTION DFSDM2 ClockOut Selection
  511. * @{
  512. */
  513. #define DFSDM2_CKOUT_DFSDM2_CKOUT 0x00040000U
  514. #define DFSDM2_CKOUT_DFSDM2 0x00000000U
  515. /**
  516. * @}
  517. */
  518. /** @defgroup DFSDM_1_CLOCKIN_SELECTION DFSDM1 ClockIn Selection
  519. * @{
  520. */
  521. #define DFSDM1_CKIN_DFSDM2_CKOUT 0x00000040U
  522. #define DFSDM1_CKIN_PAD 0x00000000U
  523. /**
  524. * @}
  525. */
  526. /** @defgroup DFSDM_2_CLOCKIN_SELECTION DFSDM2 ClockIn Selection
  527. * @{
  528. */
  529. #define DFSDM2_CKIN_DFSDM2_CKOUT 0x00020000U
  530. #define DFSDM2_CKIN_PAD 0x00000000U
  531. /**
  532. * @}
  533. */
  534. /** @defgroup DFSDM_1_BIT_STREAM_DISTRIBUTION DFSDM1 Bit Stream Distribution
  535. * @{
  536. */
  537. #define DFSDM1_T4_OC2_BITSTREAM_CKIN0 0x00000000U /* TIM4_OC2 to CLKIN0 */
  538. #define DFSDM1_T4_OC2_BITSTREAM_CKIN2 SYSCFG_MCHDLYCR_DFSDM1CK02SEL /* TIM4_OC2 to CLKIN2 */
  539. #define DFSDM1_T4_OC1_BITSTREAM_CKIN3 SYSCFG_MCHDLYCR_DFSDM1CK13SEL /* TIM4_OC1 to CLKIN3 */
  540. #define DFSDM1_T4_OC1_BITSTREAM_CKIN1 0x00000000U /* TIM4_OC1 to CLKIN1 */
  541. /**
  542. * @}
  543. */
  544. /** @defgroup DFSDM_2_BIT_STREAM_DISTRIBUTION DFSDM12 Bit Stream Distribution
  545. * @{
  546. */
  547. #define DFSDM2_T3_OC4_BITSTREAM_CKIN0 0x00000000U /* TIM3_OC4 to CKIN0 */
  548. #define DFSDM2_T3_OC4_BITSTREAM_CKIN4 SYSCFG_MCHDLYCR_DFSDM2CK04SEL /* TIM3_OC4 to CKIN4 */
  549. #define DFSDM2_T3_OC3_BITSTREAM_CKIN5 SYSCFG_MCHDLYCR_DFSDM2CK15SEL /* TIM3_OC3 to CKIN5 */
  550. #define DFSDM2_T3_OC3_BITSTREAM_CKIN1 0x00000000U /* TIM3_OC3 to CKIN1 */
  551. #define DFSDM2_T3_OC2_BITSTREAM_CKIN6 SYSCFG_MCHDLYCR_DFSDM2CK26SEL /* TIM3_OC2to CKIN6 */
  552. #define DFSDM2_T3_OC2_BITSTREAM_CKIN2 0x00000000U /* TIM3_OC2 to CKIN2 */
  553. #define DFSDM2_T3_OC1_BITSTREAM_CKIN3 0x00000000U /* TIM3_OC1 to CKIN3 */
  554. #define DFSDM2_T3_OC1_BITSTREAM_CKIN7 SYSCFG_MCHDLYCR_DFSDM2CK37SEL /* TIM3_OC1 to CKIN7 */
  555. /**
  556. * @}
  557. */
  558. /** @defgroup DFSDM_1_DATA_DISTRIBUTION DFSDM1 Data Distribution
  559. * @{
  560. */
  561. #define DFSDM1_DATIN0_TO_DATIN0_PAD 0x00000000U
  562. #define DFSDM1_DATIN0_TO_DATIN1_PAD SYSCFG_MCHDLYCR_DFSDM1D0SEL
  563. #define DFSDM1_DATIN2_TO_DATIN2_PAD 0x00000000U
  564. #define DFSDM1_DATIN2_TO_DATIN3_PAD SYSCFG_MCHDLYCR_DFSDM1D2SEL
  565. /**
  566. * @}
  567. */
  568. /** @defgroup DFSDM_2_DATA_DISTRIBUTION DFSDM2 Data Distribution
  569. * @{
  570. */
  571. #define DFSDM2_DATIN0_TO_DATIN0_PAD 0x00000000U
  572. #define DFSDM2_DATIN0_TO_DATIN1_PAD SYSCFG_MCHDLYCR_DFSDM2D0SEL
  573. #define DFSDM2_DATIN2_TO_DATIN2_PAD 0x00000000U
  574. #define DFSDM2_DATIN2_TO_DATIN3_PAD SYSCFG_MCHDLYCR_DFSDM2D2SEL
  575. #define DFSDM2_DATIN4_TO_DATIN4_PAD 0x00000000U
  576. #define DFSDM2_DATIN4_TO_DATIN5_PAD SYSCFG_MCHDLYCR_DFSDM2D4SEL
  577. #define DFSDM2_DATIN6_TO_DATIN6_PAD 0x00000000U
  578. #define DFSDM2_DATIN6_TO_DATIN7_PAD SYSCFG_MCHDLYCR_DFSDM2D6SEL
  579. /**
  580. * @}
  581. */
  582. /** @defgroup HAL_MCHDLY_CLOCK HAL MCHDLY Clock enable
  583. * @{
  584. */
  585. #define HAL_MCHDLY_CLOCK_DFSDM2 SYSCFG_MCHDLYCR_MCHDLY2EN
  586. #define HAL_MCHDLY_CLOCK_DFSDM1 SYSCFG_MCHDLYCR_MCHDLY1EN
  587. /**
  588. * @}
  589. */
  590. /** @defgroup DFSDM_CLOCKIN_SOURCE DFSDM Clock In Source Selection
  591. * @{
  592. */
  593. #define HAL_DFSDM2_CKIN_PAD 0x00040000U
  594. #define HAL_DFSDM2_CKIN_DM SYSCFG_MCHDLYCR_DFSDM2CFG
  595. #define HAL_DFSDM1_CKIN_PAD 0x00000000U
  596. #define HAL_DFSDM1_CKIN_DM SYSCFG_MCHDLYCR_DFSDM1CFG
  597. /**
  598. * @}
  599. */
  600. /** @defgroup DFSDM_CLOCKOUT_SOURCE DFSDM Clock Source Selection
  601. * @{
  602. */
  603. #define HAL_DFSDM2_CKOUT_DFSDM2 0x10000000U
  604. #define HAL_DFSDM2_CKOUT_M27 SYSCFG_MCHDLYCR_DFSDM2CKOSEL
  605. #define HAL_DFSDM1_CKOUT_DFSDM1 0x00000000U
  606. #define HAL_DFSDM1_CKOUT_M27 SYSCFG_MCHDLYCR_DFSDM1CKOSEL
  607. /**
  608. * @}
  609. */
  610. /** @defgroup DFSDM_DATAIN0_SOURCE DFSDM Source Selection For DATAIN0
  611. * @{
  612. */
  613. #define HAL_DATAIN0_DFSDM2_PAD 0x10000000U
  614. #define HAL_DATAIN0_DFSDM2_DATAIN1 SYSCFG_MCHDLYCR_DFSDM2D0SEL
  615. #define HAL_DATAIN0_DFSDM1_PAD 0x00000000U
  616. #define HAL_DATAIN0_DFSDM1_DATAIN1 SYSCFG_MCHDLYCR_DFSDM1D0SEL
  617. /**
  618. * @}
  619. */
  620. /** @defgroup DFSDM_DATAIN2_SOURCE DFSDM Source Selection For DATAIN2
  621. * @{
  622. */
  623. #define HAL_DATAIN2_DFSDM2_PAD 0x10000000U
  624. #define HAL_DATAIN2_DFSDM2_DATAIN3 SYSCFG_MCHDLYCR_DFSDM2D2SEL
  625. #define HAL_DATAIN2_DFSDM1_PAD 0x00000000U
  626. #define HAL_DATAIN2_DFSDM1_DATAIN3 SYSCFG_MCHDLYCR_DFSDM1D2SEL
  627. /**
  628. * @}
  629. */
  630. /** @defgroup DFSDM_DATAIN4_SOURCE DFSDM Source Selection For DATAIN4
  631. * @{
  632. */
  633. #define HAL_DATAIN4_DFSDM2_PAD 0x00000000U
  634. #define HAL_DATAIN4_DFSDM2_DATAIN5 SYSCFG_MCHDLYCR_DFSDM2D4SEL
  635. /**
  636. * @}
  637. */
  638. /** @defgroup DFSDM_DATAIN6_SOURCE DFSDM Source Selection For DATAIN6
  639. * @{
  640. */
  641. #define HAL_DATAIN6_DFSDM2_PAD 0x00000000U
  642. #define HAL_DATAIN6_DFSDM2_DATAIN7 SYSCFG_MCHDLYCR_DFSDM2D6SEL
  643. /**
  644. * @}
  645. */
  646. /** @defgroup DFSDM1_CLKIN_SOURCE DFSDM1 Source Selection For CLKIN
  647. * @{
  648. */
  649. #define HAL_DFSDM1_CLKIN0_TIM4OC2 0x01000000U
  650. #define HAL_DFSDM1_CLKIN2_TIM4OC2 SYSCFG_MCHDLYCR_DFSDM1CK02SEL
  651. #define HAL_DFSDM1_CLKIN1_TIM4OC1 0x02000000U
  652. #define HAL_DFSDM1_CLKIN3_TIM4OC1 SYSCFG_MCHDLYCR_DFSDM1CK13SEL
  653. /**
  654. * @}
  655. */
  656. /** @defgroup DFSDM2_CLKIN_SOURCE DFSDM2 Source Selection For CLKIN
  657. * @{
  658. */
  659. #define HAL_DFSDM2_CLKIN0_TIM3OC4 0x04000000U
  660. #define HAL_DFSDM2_CLKIN4_TIM3OC4 SYSCFG_MCHDLYCR_DFSDM2CK04SEL
  661. #define HAL_DFSDM2_CLKIN1_TIM3OC3 0x08000000U
  662. #define HAL_DFSDM2_CLKIN5_TIM3OC3 SYSCFG_MCHDLYCR_DFSDM2CK15SEL
  663. #define HAL_DFSDM2_CLKIN2_TIM3OC2 0x10000000U
  664. #define HAL_DFSDM2_CLKIN6_TIM3OC2 SYSCFG_MCHDLYCR_DFSDM2CK26SEL
  665. #define HAL_DFSDM2_CLKIN3_TIM3OC1 0x00000000U
  666. #define HAL_DFSDM2_CLKIN7_TIM3OC1 SYSCFG_MCHDLYCR_DFSDM2CK37SEL
  667. /**
  668. * @}
  669. */
  670. #endif /* SYSCFG_MCHDLYCR_BSCKSEL*/
  671. /**
  672. * @}
  673. */
  674. /* End of exported constants -------------------------------------------------*/
  675. /* Exported macros -----------------------------------------------------------*/
  676. /** @defgroup DFSDM_Exported_Macros DFSDM Exported Macros
  677. * @{
  678. */
  679. /** @brief Reset DFSDM channel handle state.
  680. * @param __HANDLE__ DFSDM channel handle.
  681. * @retval None
  682. */
  683. #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
  684. #define __HAL_DFSDM_CHANNEL_RESET_HANDLE_STATE(__HANDLE__) do{ \
  685. (__HANDLE__)->State = HAL_DFSDM_CHANNEL_STATE_RESET; \
  686. (__HANDLE__)->MspInitCallback = NULL; \
  687. (__HANDLE__)->MspDeInitCallback = NULL; \
  688. } while(0)
  689. #else
  690. #define __HAL_DFSDM_CHANNEL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DFSDM_CHANNEL_STATE_RESET)
  691. #endif
  692. /** @brief Reset DFSDM filter handle state.
  693. * @param __HANDLE__ DFSDM filter handle.
  694. * @retval None
  695. */
  696. #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
  697. #define __HAL_DFSDM_FILTER_RESET_HANDLE_STATE(__HANDLE__) do{ \
  698. (__HANDLE__)->State = HAL_DFSDM_FILTER_STATE_RESET; \
  699. (__HANDLE__)->MspInitCallback = NULL; \
  700. (__HANDLE__)->MspDeInitCallback = NULL; \
  701. } while(0)
  702. #else
  703. #define __HAL_DFSDM_FILTER_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DFSDM_FILTER_STATE_RESET)
  704. #endif
  705. /**
  706. * @}
  707. */
  708. /* End of exported macros ----------------------------------------------------*/
  709. /* Exported functions --------------------------------------------------------*/
  710. /** @addtogroup DFSDM_Exported_Functions DFSDM Exported Functions
  711. * @{
  712. */
  713. /** @addtogroup DFSDM_Exported_Functions_Group1_Channel Channel initialization and de-initialization functions
  714. * @{
  715. */
  716. /* Channel initialization and de-initialization functions *********************/
  717. HAL_StatusTypeDef HAL_DFSDM_ChannelInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  718. HAL_StatusTypeDef HAL_DFSDM_ChannelDeInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  719. void HAL_DFSDM_ChannelMspInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  720. void HAL_DFSDM_ChannelMspDeInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  721. #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
  722. /* Channel callbacks register/unregister functions ****************************/
  723. HAL_StatusTypeDef HAL_DFSDM_Channel_RegisterCallback(DFSDM_Channel_HandleTypeDef *hdfsdm_channel,
  724. HAL_DFSDM_Channel_CallbackIDTypeDef CallbackID,
  725. pDFSDM_Channel_CallbackTypeDef pCallback);
  726. HAL_StatusTypeDef HAL_DFSDM_Channel_UnRegisterCallback(DFSDM_Channel_HandleTypeDef *hdfsdm_channel,
  727. HAL_DFSDM_Channel_CallbackIDTypeDef CallbackID);
  728. #endif
  729. /**
  730. * @}
  731. */
  732. /** @addtogroup DFSDM_Exported_Functions_Group2_Channel Channel operation functions
  733. * @{
  734. */
  735. /* Channel operation functions ************************************************/
  736. HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStart(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  737. HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStart_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  738. HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStop(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  739. HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStop_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  740. HAL_StatusTypeDef HAL_DFSDM_ChannelScdStart(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t Threshold, uint32_t BreakSignal);
  741. HAL_StatusTypeDef HAL_DFSDM_ChannelScdStart_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t Threshold, uint32_t BreakSignal);
  742. HAL_StatusTypeDef HAL_DFSDM_ChannelScdStop(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  743. HAL_StatusTypeDef HAL_DFSDM_ChannelScdStop_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  744. int16_t HAL_DFSDM_ChannelGetAwdValue(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  745. HAL_StatusTypeDef HAL_DFSDM_ChannelModifyOffset(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, int32_t Offset);
  746. HAL_StatusTypeDef HAL_DFSDM_ChannelPollForCkab(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t Timeout);
  747. HAL_StatusTypeDef HAL_DFSDM_ChannelPollForScd(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t Timeout);
  748. void HAL_DFSDM_ChannelCkabCallback(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  749. void HAL_DFSDM_ChannelScdCallback(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  750. /**
  751. * @}
  752. */
  753. /** @defgroup DFSDM_Exported_Functions_Group3_Channel Channel state function
  754. * @{
  755. */
  756. /* Channel state function *****************************************************/
  757. HAL_DFSDM_Channel_StateTypeDef HAL_DFSDM_ChannelGetState(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  758. /**
  759. * @}
  760. */
  761. /** @addtogroup DFSDM_Exported_Functions_Group1_Filter Filter initialization and de-initialization functions
  762. * @{
  763. */
  764. /* Filter initialization and de-initialization functions *********************/
  765. HAL_StatusTypeDef HAL_DFSDM_FilterInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  766. HAL_StatusTypeDef HAL_DFSDM_FilterDeInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  767. void HAL_DFSDM_FilterMspInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  768. void HAL_DFSDM_FilterMspDeInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  769. #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
  770. /* Filter callbacks register/unregister functions ****************************/
  771. HAL_StatusTypeDef HAL_DFSDM_Filter_RegisterCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
  772. HAL_DFSDM_Filter_CallbackIDTypeDef CallbackID,
  773. pDFSDM_Filter_CallbackTypeDef pCallback);
  774. HAL_StatusTypeDef HAL_DFSDM_Filter_UnRegisterCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
  775. HAL_DFSDM_Filter_CallbackIDTypeDef CallbackID);
  776. HAL_StatusTypeDef HAL_DFSDM_Filter_RegisterAwdCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
  777. pDFSDM_Filter_AwdCallbackTypeDef pCallback);
  778. HAL_StatusTypeDef HAL_DFSDM_Filter_UnRegisterAwdCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  779. #endif
  780. /**
  781. * @}
  782. */
  783. /** @addtogroup DFSDM_Exported_Functions_Group2_Filter Filter control functions
  784. * @{
  785. */
  786. /* Filter control functions *********************/
  787. HAL_StatusTypeDef HAL_DFSDM_FilterConfigRegChannel(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
  788. uint32_t Channel,
  789. uint32_t ContinuousMode);
  790. HAL_StatusTypeDef HAL_DFSDM_FilterConfigInjChannel(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
  791. uint32_t Channel);
  792. /**
  793. * @}
  794. */
  795. /** @addtogroup DFSDM_Exported_Functions_Group3_Filter Filter operation functions
  796. * @{
  797. */
  798. /* Filter operation functions *********************/
  799. HAL_StatusTypeDef HAL_DFSDM_FilterRegularStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  800. HAL_StatusTypeDef HAL_DFSDM_FilterRegularStart_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  801. HAL_StatusTypeDef HAL_DFSDM_FilterRegularStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, int32_t *pData, uint32_t Length);
  802. HAL_StatusTypeDef HAL_DFSDM_FilterRegularMsbStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, int16_t *pData, uint32_t Length);
  803. HAL_StatusTypeDef HAL_DFSDM_FilterRegularStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  804. HAL_StatusTypeDef HAL_DFSDM_FilterRegularStop_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  805. HAL_StatusTypeDef HAL_DFSDM_FilterRegularStop_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  806. HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  807. HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStart_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  808. HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, int32_t *pData, uint32_t Length);
  809. HAL_StatusTypeDef HAL_DFSDM_FilterInjectedMsbStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, int16_t *pData, uint32_t Length);
  810. HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  811. HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStop_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  812. HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStop_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  813. HAL_StatusTypeDef HAL_DFSDM_FilterAwdStart_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
  814. DFSDM_Filter_AwdParamTypeDef* awdParam);
  815. HAL_StatusTypeDef HAL_DFSDM_FilterAwdStop_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  816. HAL_StatusTypeDef HAL_DFSDM_FilterExdStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Channel);
  817. HAL_StatusTypeDef HAL_DFSDM_FilterExdStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  818. int32_t HAL_DFSDM_FilterGetRegularValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t* Channel);
  819. int32_t HAL_DFSDM_FilterGetInjectedValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t* Channel);
  820. int32_t HAL_DFSDM_FilterGetExdMaxValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t* Channel);
  821. int32_t HAL_DFSDM_FilterGetExdMinValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t* Channel);
  822. uint32_t HAL_DFSDM_FilterGetConvTimeValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  823. void HAL_DFSDM_IRQHandler(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  824. HAL_StatusTypeDef HAL_DFSDM_FilterPollForRegConversion(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Timeout);
  825. HAL_StatusTypeDef HAL_DFSDM_FilterPollForInjConversion(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Timeout);
  826. void HAL_DFSDM_FilterRegConvCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  827. void HAL_DFSDM_FilterRegConvHalfCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  828. void HAL_DFSDM_FilterInjConvCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  829. void HAL_DFSDM_FilterInjConvHalfCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  830. void HAL_DFSDM_FilterAwdCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Channel, uint32_t Threshold);
  831. void HAL_DFSDM_FilterErrorCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  832. /**
  833. * @}
  834. */
  835. /** @addtogroup DFSDM_Exported_Functions_Group4_Filter Filter state functions
  836. * @{
  837. */
  838. /* Filter state functions *****************************************************/
  839. HAL_DFSDM_Filter_StateTypeDef HAL_DFSDM_FilterGetState(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  840. uint32_t HAL_DFSDM_FilterGetError(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  841. /**
  842. * @}
  843. */
  844. /** @addtogroup DFSDM_Exported_Functions_Group5_Filter MultiChannel operation functions
  845. * @{
  846. */
  847. #if defined(SYSCFG_MCHDLYCR_BSCKSEL)
  848. void HAL_DFSDM_ConfigMultiChannelDelay(DFSDM_MultiChannelConfigTypeDef* mchdlystruct);
  849. void HAL_DFSDM_BitstreamClock_Start(void);
  850. void HAL_DFSDM_BitstreamClock_Stop(void);
  851. void HAL_DFSDM_DisableDelayClock(uint32_t MCHDLY);
  852. void HAL_DFSDM_EnableDelayClock(uint32_t MCHDLY);
  853. void HAL_DFSDM_ClockIn_SourceSelection(uint32_t source);
  854. void HAL_DFSDM_ClockOut_SourceSelection(uint32_t source);
  855. void HAL_DFSDM_DataIn0_SourceSelection(uint32_t source);
  856. void HAL_DFSDM_DataIn2_SourceSelection(uint32_t source);
  857. void HAL_DFSDM_DataIn4_SourceSelection(uint32_t source);
  858. void HAL_DFSDM_DataIn6_SourceSelection(uint32_t source);
  859. void HAL_DFSDM_BitStreamClkDistribution_Config(uint32_t source);
  860. #endif /* SYSCFG_MCHDLYCR_BSCKSEL */
  861. /**
  862. * @}
  863. */
  864. /**
  865. * @}
  866. */
  867. /* End of exported functions -------------------------------------------------*/
  868. /* Private macros ------------------------------------------------------------*/
  869. /** @defgroup DFSDM_Private_Macros DFSDM Private Macros
  870. * @{
  871. */
  872. #define IS_DFSDM_CHANNEL_OUTPUT_CLOCK(CLOCK) (((CLOCK) == DFSDM_CHANNEL_OUTPUT_CLOCK_SYSTEM) || \
  873. ((CLOCK) == DFSDM_CHANNEL_OUTPUT_CLOCK_AUDIO))
  874. #define IS_DFSDM_CHANNEL_OUTPUT_CLOCK_DIVIDER(DIVIDER) ((2U <= (DIVIDER)) && ((DIVIDER) <= 256U))
  875. #define IS_DFSDM_CHANNEL_INPUT(INPUT) (((INPUT) == DFSDM_CHANNEL_EXTERNAL_INPUTS) || \
  876. ((INPUT) == DFSDM_CHANNEL_INTERNAL_REGISTER))
  877. #define IS_DFSDM_CHANNEL_DATA_PACKING(MODE) (((MODE) == DFSDM_CHANNEL_STANDARD_MODE) || \
  878. ((MODE) == DFSDM_CHANNEL_INTERLEAVED_MODE) || \
  879. ((MODE) == DFSDM_CHANNEL_DUAL_MODE))
  880. #define IS_DFSDM_CHANNEL_INPUT_PINS(PINS) (((PINS) == DFSDM_CHANNEL_SAME_CHANNEL_PINS) || \
  881. ((PINS) == DFSDM_CHANNEL_FOLLOWING_CHANNEL_PINS))
  882. #define IS_DFSDM_CHANNEL_SERIAL_INTERFACE_TYPE(MODE) (((MODE) == DFSDM_CHANNEL_SPI_RISING) || \
  883. ((MODE) == DFSDM_CHANNEL_SPI_FALLING) || \
  884. ((MODE) == DFSDM_CHANNEL_MANCHESTER_RISING) || \
  885. ((MODE) == DFSDM_CHANNEL_MANCHESTER_FALLING))
  886. #define IS_DFSDM_CHANNEL_SPI_CLOCK(TYPE) (((TYPE) == DFSDM_CHANNEL_SPI_CLOCK_EXTERNAL) || \
  887. ((TYPE) == DFSDM_CHANNEL_SPI_CLOCK_INTERNAL) || \
  888. ((TYPE) == DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_FALLING) || \
  889. ((TYPE) == DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_RISING))
  890. #define IS_DFSDM_CHANNEL_FILTER_ORDER(ORDER) (((ORDER) == DFSDM_CHANNEL_FASTSINC_ORDER) || \
  891. ((ORDER) == DFSDM_CHANNEL_SINC1_ORDER) || \
  892. ((ORDER) == DFSDM_CHANNEL_SINC2_ORDER) || \
  893. ((ORDER) == DFSDM_CHANNEL_SINC3_ORDER))
  894. #define IS_DFSDM_CHANNEL_FILTER_OVS_RATIO(RATIO) ((1U <= (RATIO)) && ((RATIO) <= 32U))
  895. #define IS_DFSDM_CHANNEL_OFFSET(VALUE) ((-8388608 <= (VALUE)) && ((VALUE) <= 8388607))
  896. #define IS_DFSDM_CHANNEL_RIGHT_BIT_SHIFT(VALUE) ((VALUE) <= 0x1FU)
  897. #define IS_DFSDM_CHANNEL_SCD_THRESHOLD(VALUE) ((VALUE) <= 0xFFU)
  898. #define IS_DFSDM_FILTER_REG_TRIGGER(TRIG) (((TRIG) == DFSDM_FILTER_SW_TRIGGER) || \
  899. ((TRIG) == DFSDM_FILTER_SYNC_TRIGGER))
  900. #define IS_DFSDM_FILTER_INJ_TRIGGER(TRIG) (((TRIG) == DFSDM_FILTER_SW_TRIGGER) || \
  901. ((TRIG) == DFSDM_FILTER_SYNC_TRIGGER) || \
  902. ((TRIG) == DFSDM_FILTER_EXT_TRIGGER))
  903. #if defined (STM32F413xx) || defined (STM32F423xx)
  904. #define IS_DFSDM_FILTER_EXT_TRIG(TRIG) (((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM1_TRGO) || \
  905. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM3_TRGO) || \
  906. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM8_TRGO) || \
  907. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM10_OC1) || \
  908. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM2_TRGO) || \
  909. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM4_TRGO) || \
  910. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM11_OC1) || \
  911. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM6_TRGO) || \
  912. ((TRIG) == DFSDM_FILTER_EXT_TRIG_EXTI11) || \
  913. ((TRIG) == DFSDM_FILTER_EXT_TRIG_EXTI15))
  914. #define IS_DFSDM_DELAY_CLOCK(CLOCK) (((CLOCK) == HAL_MCHDLY_CLOCK_DFSDM2) || \
  915. ((CLOCK) == HAL_MCHDLY_CLOCK_DFSDM1))
  916. #else
  917. #define IS_DFSDM_FILTER_EXT_TRIG(TRIG) (((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM1_TRGO) || \
  918. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM3_TRGO) || \
  919. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM8_TRGO) || \
  920. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM10_OC1) || \
  921. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM4_TRGO) || \
  922. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM6_TRGO) || \
  923. ((TRIG) == DFSDM_FILTER_EXT_TRIG_EXTI11) || \
  924. ((TRIG) == DFSDM_FILTER_EXT_TRIG_EXTI15))
  925. #endif
  926. #define IS_DFSDM_FILTER_EXT_TRIG_EDGE(EDGE) (((EDGE) == DFSDM_FILTER_EXT_TRIG_RISING_EDGE) || \
  927. ((EDGE) == DFSDM_FILTER_EXT_TRIG_FALLING_EDGE) || \
  928. ((EDGE) == DFSDM_FILTER_EXT_TRIG_BOTH_EDGES))
  929. #define IS_DFSDM_FILTER_SINC_ORDER(ORDER) (((ORDER) == DFSDM_FILTER_FASTSINC_ORDER) || \
  930. ((ORDER) == DFSDM_FILTER_SINC1_ORDER) || \
  931. ((ORDER) == DFSDM_FILTER_SINC2_ORDER) || \
  932. ((ORDER) == DFSDM_FILTER_SINC3_ORDER) || \
  933. ((ORDER) == DFSDM_FILTER_SINC4_ORDER) || \
  934. ((ORDER) == DFSDM_FILTER_SINC5_ORDER))
  935. #define IS_DFSDM_FILTER_OVS_RATIO(RATIO) ((1U <= (RATIO)) && ((RATIO) <= 1024U))
  936. #define IS_DFSDM_FILTER_INTEGRATOR_OVS_RATIO(RATIO) ((1U <= (RATIO)) && ((RATIO) <= 256U))
  937. #define IS_DFSDM_FILTER_AWD_DATA_SOURCE(DATA) (((DATA) == DFSDM_FILTER_AWD_FILTER_DATA) || \
  938. ((DATA) == DFSDM_FILTER_AWD_CHANNEL_DATA))
  939. #define IS_DFSDM_FILTER_AWD_THRESHOLD(VALUE) ((-8388608 <= (VALUE)) && ((VALUE) <= 8388607))
  940. #define IS_DFSDM_BREAK_SIGNALS(VALUE) ((VALUE) <= 0x0FU)
  941. #if defined(DFSDM2_Channel0)
  942. #define IS_DFSDM_REGULAR_CHANNEL(CHANNEL) (((CHANNEL) == DFSDM_CHANNEL_0) || \
  943. ((CHANNEL) == DFSDM_CHANNEL_1) || \
  944. ((CHANNEL) == DFSDM_CHANNEL_2) || \
  945. ((CHANNEL) == DFSDM_CHANNEL_3) || \
  946. ((CHANNEL) == DFSDM_CHANNEL_4) || \
  947. ((CHANNEL) == DFSDM_CHANNEL_5) || \
  948. ((CHANNEL) == DFSDM_CHANNEL_6) || \
  949. ((CHANNEL) == DFSDM_CHANNEL_7))
  950. #define IS_DFSDM_INJECTED_CHANNEL(CHANNEL) (((CHANNEL) != 0U) && ((CHANNEL) <= 0x000F00FFU))
  951. #else
  952. #define IS_DFSDM_REGULAR_CHANNEL(CHANNEL) (((CHANNEL) == DFSDM_CHANNEL_0) || \
  953. ((CHANNEL) == DFSDM_CHANNEL_1) || \
  954. ((CHANNEL) == DFSDM_CHANNEL_2) || \
  955. ((CHANNEL) == DFSDM_CHANNEL_3))
  956. #define IS_DFSDM_INJECTED_CHANNEL(CHANNEL) (((CHANNEL) != 0U) && ((CHANNEL) <= 0x0003000FU))
  957. #endif
  958. #define IS_DFSDM_CONTINUOUS_MODE(MODE) (((MODE) == DFSDM_CONTINUOUS_CONV_OFF) || \
  959. ((MODE) == DFSDM_CONTINUOUS_CONV_ON))
  960. #if defined(DFSDM2_Channel0)
  961. #define IS_DFSDM1_CHANNEL_INSTANCE(INSTANCE) (((INSTANCE) == DFSDM1_Channel0) || \
  962. ((INSTANCE) == DFSDM1_Channel1) || \
  963. ((INSTANCE) == DFSDM1_Channel2) || \
  964. ((INSTANCE) == DFSDM1_Channel3))
  965. #define IS_DFSDM1_FILTER_INSTANCE(INSTANCE) (((INSTANCE) == DFSDM1_Filter0) || \
  966. ((INSTANCE) == DFSDM1_Filter1))
  967. #endif /* DFSDM2_Channel0 */
  968. #if defined(SYSCFG_MCHDLYCR_BSCKSEL)
  969. #define IS_DFSDM_CLOCKIN_SELECTION(SELECTION) (((SELECTION) == HAL_DFSDM2_CKIN_PAD) || \
  970. ((SELECTION) == HAL_DFSDM2_CKIN_DM) || \
  971. ((SELECTION) == HAL_DFSDM1_CKIN_PAD) || \
  972. ((SELECTION) == HAL_DFSDM1_CKIN_DM))
  973. #define IS_DFSDM_CLOCKOUT_SELECTION(SELECTION) (((SELECTION) == HAL_DFSDM2_CKOUT_DFSDM2) || \
  974. ((SELECTION) == HAL_DFSDM2_CKOUT_M27) || \
  975. ((SELECTION) == HAL_DFSDM1_CKOUT_DFSDM1) || \
  976. ((SELECTION) == HAL_DFSDM1_CKOUT_M27))
  977. #define IS_DFSDM_DATAIN0_SRC_SELECTION(SELECTION) (((SELECTION) == HAL_DATAIN0_DFSDM2_PAD) || \
  978. ((SELECTION) == HAL_DATAIN0_DFSDM2_DATAIN1) || \
  979. ((SELECTION) == HAL_DATAIN0_DFSDM1_PAD) || \
  980. ((SELECTION) == HAL_DATAIN0_DFSDM1_DATAIN1))
  981. #define IS_DFSDM_DATAIN2_SRC_SELECTION(SELECTION) (((SELECTION) == HAL_DATAIN2_DFSDM2_PAD) || \
  982. ((SELECTION) == HAL_DATAIN2_DFSDM2_DATAIN3) || \
  983. ((SELECTION) == HAL_DATAIN2_DFSDM1_PAD) || \
  984. ((SELECTION) == HAL_DATAIN2_DFSDM1_DATAIN3))
  985. #define IS_DFSDM_DATAIN4_SRC_SELECTION(SELECTION) (((SELECTION) == HAL_DATAIN4_DFSDM2_PAD) || \
  986. ((SELECTION) == HAL_DATAIN4_DFSDM2_DATAIN5))
  987. #define IS_DFSDM_DATAIN6_SRC_SELECTION(SELECTION) (((SELECTION) == HAL_DATAIN6_DFSDM2_PAD) || \
  988. ((SELECTION) == HAL_DATAIN6_DFSDM2_DATAIN7))
  989. #define IS_DFSDM_BITSTREM_CLK_DISTRIBUTION(DISTRIBUTION) (((DISTRIBUTION) == HAL_DFSDM1_CLKIN0_TIM4OC2) || \
  990. ((DISTRIBUTION) == HAL_DFSDM1_CLKIN2_TIM4OC2) || \
  991. ((DISTRIBUTION) == HAL_DFSDM1_CLKIN1_TIM4OC1) || \
  992. ((DISTRIBUTION) == HAL_DFSDM1_CLKIN3_TIM4OC1) || \
  993. ((DISTRIBUTION) == HAL_DFSDM2_CLKIN0_TIM3OC4) || \
  994. ((DISTRIBUTION) == HAL_DFSDM2_CLKIN4_TIM3OC4) || \
  995. ((DISTRIBUTION) == HAL_DFSDM2_CLKIN1_TIM3OC3)|| \
  996. ((DISTRIBUTION) == HAL_DFSDM2_CLKIN5_TIM3OC3) || \
  997. ((DISTRIBUTION) == HAL_DFSDM2_CLKIN2_TIM3OC2) || \
  998. ((DISTRIBUTION) == HAL_DFSDM2_CLKIN6_TIM3OC2) || \
  999. ((DISTRIBUTION) == HAL_DFSDM2_CLKIN3_TIM3OC1)|| \
  1000. ((DISTRIBUTION) == HAL_DFSDM2_CLKIN7_TIM3OC1))
  1001. #define IS_DFSDM_DFSDM1_CLKOUT(CLKOUT) (((CLKOUT) == DFSDM1_CKOUT_DFSDM2_CKOUT) || \
  1002. ((CLKOUT) == DFSDM1_CKOUT_DFSDM1))
  1003. #define IS_DFSDM_DFSDM2_CLKOUT(CLKOUT) (((CLKOUT) == DFSDM2_CKOUT_DFSDM2_CKOUT) || \
  1004. ((CLKOUT) == DFSDM2_CKOUT_DFSDM2))
  1005. #define IS_DFSDM_DFSDM1_CLKIN(CLKIN) (((CLKIN) == DFSDM1_CKIN_DFSDM2_CKOUT) || \
  1006. ((CLKIN) == DFSDM1_CKIN_PAD))
  1007. #define IS_DFSDM_DFSDM2_CLKIN(CLKIN) (((CLKIN) == DFSDM2_CKIN_DFSDM2_CKOUT) || \
  1008. ((CLKIN) == DFSDM2_CKIN_PAD))
  1009. #define IS_DFSDM_DFSDM1_BIT_CLK(CLK) (((CLK) == DFSDM1_T4_OC2_BITSTREAM_CKIN0) || \
  1010. ((CLK) == DFSDM1_T4_OC2_BITSTREAM_CKIN2) || \
  1011. ((CLK) == DFSDM1_T4_OC1_BITSTREAM_CKIN3) || \
  1012. ((CLK) == DFSDM1_T4_OC1_BITSTREAM_CKIN1) || \
  1013. ((CLK) <= 0x30U))
  1014. #define IS_DFSDM_DFSDM2_BIT_CLK(CLK) (((CLK) == DFSDM2_T3_OC4_BITSTREAM_CKIN0) || \
  1015. ((CLK) == DFSDM2_T3_OC4_BITSTREAM_CKIN4) || \
  1016. ((CLK) == DFSDM2_T3_OC3_BITSTREAM_CKIN5) || \
  1017. ((CLK) == DFSDM2_T3_OC3_BITSTREAM_CKIN1) || \
  1018. ((CLK) == DFSDM2_T3_OC2_BITSTREAM_CKIN6) || \
  1019. ((CLK) == DFSDM2_T3_OC2_BITSTREAM_CKIN2) || \
  1020. ((CLK) == DFSDM2_T3_OC1_BITSTREAM_CKIN3) || \
  1021. ((CLK) == DFSDM2_T3_OC1_BITSTREAM_CKIN7)|| \
  1022. ((CLK) <= 0x1E000U))
  1023. #define IS_DFSDM_DFSDM1_DATA_DISTRIBUTION(DISTRIBUTION)(((DISTRIBUTION) == DFSDM1_DATIN0_TO_DATIN0_PAD )|| \
  1024. ((DISTRIBUTION) == DFSDM1_DATIN0_TO_DATIN1_PAD) || \
  1025. ((DISTRIBUTION) == DFSDM1_DATIN2_TO_DATIN2_PAD) || \
  1026. ((DISTRIBUTION) == DFSDM1_DATIN2_TO_DATIN3_PAD)|| \
  1027. ((DISTRIBUTION) <= 0xCU))
  1028. #define IS_DFSDM_DFSDM2_DATA_DISTRIBUTION(DISTRIBUTION)(((DISTRIBUTION) == DFSDM2_DATIN0_TO_DATIN0_PAD)|| \
  1029. ((DISTRIBUTION) == DFSDM2_DATIN0_TO_DATIN1_PAD)|| \
  1030. ((DISTRIBUTION) == DFSDM2_DATIN2_TO_DATIN2_PAD)|| \
  1031. ((DISTRIBUTION) == DFSDM2_DATIN2_TO_DATIN3_PAD)|| \
  1032. ((DISTRIBUTION) == DFSDM2_DATIN4_TO_DATIN4_PAD)|| \
  1033. ((DISTRIBUTION) == DFSDM2_DATIN4_TO_DATIN5_PAD)|| \
  1034. ((DISTRIBUTION) == DFSDM2_DATIN6_TO_DATIN6_PAD)|| \
  1035. ((DISTRIBUTION) == DFSDM2_DATIN6_TO_DATIN7_PAD)|| \
  1036. ((DISTRIBUTION) <= 0x1D00U))
  1037. #endif /* (SYSCFG_MCHDLYCR_BSCKSEL) */
  1038. /**
  1039. * @}
  1040. */
  1041. /* End of private macros -----------------------------------------------------*/
  1042. /**
  1043. * @}
  1044. */
  1045. /**
  1046. * @}
  1047. */
  1048. #endif /* STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx || STM32F413xx || STM32F423xx */
  1049. #ifdef __cplusplus
  1050. }
  1051. #endif
  1052. #endif /* __STM32F4xx_HAL_DFSDM_H */