stm32f4xx_hal_dfsdm.h 62 KB

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