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

804 lines
43 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32h7xx_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 STM32H7xx_HAL_DFSDM_H
  21. #define STM32H7xx_HAL_DFSDM_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* Includes ------------------------------------------------------------------*/
  26. #include "stm32h7xx_hal_def.h"
  27. /** @addtogroup STM32H7xx_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_OuputClock */
  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 ,internal register or ADC output.
  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. /* End of exported types -----------------------------------------------------*/
  271. /* Exported constants --------------------------------------------------------*/
  272. /** @defgroup DFSDM_Exported_Constants DFSDM Exported Constants
  273. * @{
  274. */
  275. /** @defgroup DFSDM_Channel_OuputClock DFSDM channel output clock selection
  276. * @{
  277. */
  278. #define DFSDM_CHANNEL_OUTPUT_CLOCK_SYSTEM 0x00000000U /*!< Source for ouput clock is system clock */
  279. #define DFSDM_CHANNEL_OUTPUT_CLOCK_AUDIO DFSDM_CHCFGR1_CKOUTSRC /*!< Source for ouput clock is audio clock */
  280. /**
  281. * @}
  282. */
  283. /** @defgroup DFSDM_Channel_InputMultiplexer DFSDM channel input multiplexer
  284. * @{
  285. */
  286. #define DFSDM_CHANNEL_EXTERNAL_INPUTS 0x00000000U /*!< Data are taken from external inputs */
  287. #define DFSDM_CHANNEL_ADC_OUTPUT DFSDM_CHCFGR1_DATMPX_0 /*!< Data are taken from ADC output */
  288. #define DFSDM_CHANNEL_INTERNAL_REGISTER DFSDM_CHCFGR1_DATMPX_1 /*!< Data are taken from internal register */
  289. /**
  290. * @}
  291. */
  292. /** @defgroup DFSDM_Channel_DataPacking DFSDM channel input data packing
  293. * @{
  294. */
  295. #define DFSDM_CHANNEL_STANDARD_MODE 0x00000000U /*!< Standard data packing mode */
  296. #define DFSDM_CHANNEL_INTERLEAVED_MODE DFSDM_CHCFGR1_DATPACK_0 /*!< Interleaved data packing mode */
  297. #define DFSDM_CHANNEL_DUAL_MODE DFSDM_CHCFGR1_DATPACK_1 /*!< Dual data packing mode */
  298. /**
  299. * @}
  300. */
  301. /** @defgroup DFSDM_Channel_InputPins DFSDM channel input pins
  302. * @{
  303. */
  304. #define DFSDM_CHANNEL_SAME_CHANNEL_PINS 0x00000000U /*!< Input from pins on same channel */
  305. #define DFSDM_CHANNEL_FOLLOWING_CHANNEL_PINS DFSDM_CHCFGR1_CHINSEL /*!< Input from pins on following channel */
  306. /**
  307. * @}
  308. */
  309. /** @defgroup DFSDM_Channel_SerialInterfaceType DFSDM channel serial interface type
  310. * @{
  311. */
  312. #define DFSDM_CHANNEL_SPI_RISING 0x00000000U /*!< SPI with rising edge */
  313. #define DFSDM_CHANNEL_SPI_FALLING DFSDM_CHCFGR1_SITP_0 /*!< SPI with falling edge */
  314. #define DFSDM_CHANNEL_MANCHESTER_RISING DFSDM_CHCFGR1_SITP_1 /*!< Manchester with rising edge */
  315. #define DFSDM_CHANNEL_MANCHESTER_FALLING DFSDM_CHCFGR1_SITP /*!< Manchester with falling edge */
  316. /**
  317. * @}
  318. */
  319. /** @defgroup DFSDM_Channel_SpiClock DFSDM channel SPI clock selection
  320. * @{
  321. */
  322. #define DFSDM_CHANNEL_SPI_CLOCK_EXTERNAL 0x00000000U /*!< External SPI clock */
  323. #define DFSDM_CHANNEL_SPI_CLOCK_INTERNAL DFSDM_CHCFGR1_SPICKSEL_0 /*!< Internal SPI clock */
  324. #define DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_FALLING DFSDM_CHCFGR1_SPICKSEL_1 /*!< Internal SPI clock divided by 2, falling edge */
  325. #define DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_RISING DFSDM_CHCFGR1_SPICKSEL /*!< Internal SPI clock divided by 2, rising edge */
  326. /**
  327. * @}
  328. */
  329. /** @defgroup DFSDM_Channel_AwdFilterOrder DFSDM channel analog watchdog filter order
  330. * @{
  331. */
  332. #define DFSDM_CHANNEL_FASTSINC_ORDER 0x00000000U /*!< FastSinc filter type */
  333. #define DFSDM_CHANNEL_SINC1_ORDER DFSDM_CHAWSCDR_AWFORD_0 /*!< Sinc 1 filter type */
  334. #define DFSDM_CHANNEL_SINC2_ORDER DFSDM_CHAWSCDR_AWFORD_1 /*!< Sinc 2 filter type */
  335. #define DFSDM_CHANNEL_SINC3_ORDER DFSDM_CHAWSCDR_AWFORD /*!< Sinc 3 filter type */
  336. /**
  337. * @}
  338. */
  339. /** @defgroup DFSDM_Filter_Trigger DFSDM filter conversion trigger
  340. * @{
  341. */
  342. #define DFSDM_FILTER_SW_TRIGGER 0x00000000U /*!< Software trigger */
  343. #define DFSDM_FILTER_SYNC_TRIGGER 0x00000001U /*!< Synchronous with DFSDM_FLT0 */
  344. #define DFSDM_FILTER_EXT_TRIGGER 0x00000002U /*!< External trigger (only for injected conversion) */
  345. /**
  346. * @}
  347. */
  348. /** @defgroup DFSDM_Filter_ExtTrigger DFSDM filter external trigger
  349. * @{
  350. */
  351. #define DFSDM_FILTER_EXT_TRIG_TIM1_TRGO 0x00000000U /*!< For DFSDM 0, 1, 2 and 3 */
  352. #define DFSDM_FILTER_EXT_TRIG_TIM1_TRGO2 DFSDM_FLTCR1_JEXTSEL_0 /*!< For DFSDM 0, 1, 2 and 3 */
  353. #define DFSDM_FILTER_EXT_TRIG_TIM8_TRGO DFSDM_FLTCR1_JEXTSEL_1 /*!< For DFSDM 0, 1, 2 and 3 */
  354. #define DFSDM_FILTER_EXT_TRIG_TIM8_TRGO2 (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_1) /*!< For DFSDM 0, 1 and 2 */
  355. #define DFSDM_FILTER_EXT_TRIG_TIM3_TRGO DFSDM_FLTCR1_JEXTSEL_2 /*!< For DFSDM 3 */
  356. #define DFSDM_FILTER_EXT_TRIG_TIM4_TRGO (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_2) /*!< For DFSDM 0, 1 and 2 */
  357. #define DFSDM_FILTER_EXT_TRIG_TIM16_OC1 (DFSDM_FLTCR1_JEXTSEL_2 | DFSDM_FLTCR1_JEXTSEL_1) /*!< For DFSDM 3 */
  358. #define DFSDM_FILTER_EXT_TRIG_TIM6_TRGO (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_2 | DFSDM_FLTCR1_JEXTSEL_1) /*!< For DFSDM 0 and 1 */
  359. #define DFSDM_FILTER_EXT_TRIG_TIM7_TRGO DFSDM_FLTCR1_JEXTSEL_3 /*!< For DFSDM 2 and 3 */
  360. #define DFSDM_FILTER_EXT_TRIG_HRTIM1_ADCTRG1 (DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_0)
  361. #define DFSDM_FILTER_EXT_TRIG_HRTIM1_ADCTRG3 (DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_1)
  362. #define DFSDM_FILTER_EXT_TRIG_EXTI11 (DFSDM_FLTCR1_JEXTSEL_4 | DFSDM_FLTCR1_JEXTSEL_3) /*!< For DFSDM 0, 1, 2 and 3 */
  363. #define DFSDM_FILTER_EXT_TRIG_EXTI15 (DFSDM_FLTCR1_JEXTSEL_4 | DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_0) /*!< For DFSDM 0, 1, 2 and 3 */
  364. #define DFSDM_FILTER_EXT_TRIG_LPTIM1_OUT (DFSDM_FLTCR1_JEXTSEL_4 | DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_1) /*!< For DFSDM 0, 1, 2 and 3 */
  365. #define DFSDM_FILTER_EXT_TRIG_LPTIM2_OUT (DFSDM_FLTCR1_JEXTSEL_4 | DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_1 | DFSDM_FLTCR1_JEXTSEL_0) /*!< For DFSDM 0, 1, 2 and 3 */
  366. #define DFSDM_FILTER_EXT_TRIG_LPTIM3_OUT (DFSDM_FLTCR1_JEXTSEL_4 | DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_2) /*!< For DFSDM 0, 1, 2 and 3 */
  367. /**
  368. * @}
  369. */
  370. /** @defgroup DFSDM_Filter_ExtTriggerEdge DFSDM filter external trigger edge
  371. * @{
  372. */
  373. #define DFSDM_FILTER_EXT_TRIG_RISING_EDGE DFSDM_FLTCR1_JEXTEN_0 /*!< External rising edge */
  374. #define DFSDM_FILTER_EXT_TRIG_FALLING_EDGE DFSDM_FLTCR1_JEXTEN_1 /*!< External falling edge */
  375. #define DFSDM_FILTER_EXT_TRIG_BOTH_EDGES DFSDM_FLTCR1_JEXTEN /*!< External rising and falling edges */
  376. /**
  377. * @}
  378. */
  379. /** @defgroup DFSDM_Filter_SincOrder DFSDM filter sinc order
  380. * @{
  381. */
  382. #define DFSDM_FILTER_FASTSINC_ORDER 0x00000000U /*!< FastSinc filter type */
  383. #define DFSDM_FILTER_SINC1_ORDER DFSDM_FLTFCR_FORD_0 /*!< Sinc 1 filter type */
  384. #define DFSDM_FILTER_SINC2_ORDER DFSDM_FLTFCR_FORD_1 /*!< Sinc 2 filter type */
  385. #define DFSDM_FILTER_SINC3_ORDER (DFSDM_FLTFCR_FORD_0 | DFSDM_FLTFCR_FORD_1) /*!< Sinc 3 filter type */
  386. #define DFSDM_FILTER_SINC4_ORDER DFSDM_FLTFCR_FORD_2 /*!< Sinc 4 filter type */
  387. #define DFSDM_FILTER_SINC5_ORDER (DFSDM_FLTFCR_FORD_0 | DFSDM_FLTFCR_FORD_2) /*!< Sinc 5 filter type */
  388. /**
  389. * @}
  390. */
  391. /** @defgroup DFSDM_Filter_AwdDataSource DFSDM filter analog watchdog data source
  392. * @{
  393. */
  394. #define DFSDM_FILTER_AWD_FILTER_DATA 0x00000000U /*!< From digital filter */
  395. #define DFSDM_FILTER_AWD_CHANNEL_DATA DFSDM_FLTCR1_AWFSEL /*!< From analog watchdog channel */
  396. /**
  397. * @}
  398. */
  399. /** @defgroup DFSDM_Filter_ErrorCode DFSDM filter error code
  400. * @{
  401. */
  402. #define DFSDM_FILTER_ERROR_NONE 0x00000000U /*!< No error */
  403. #define DFSDM_FILTER_ERROR_REGULAR_OVERRUN 0x00000001U /*!< Overrun occurs during regular conversion */
  404. #define DFSDM_FILTER_ERROR_INJECTED_OVERRUN 0x00000002U /*!< Overrun occurs during injected conversion */
  405. #define DFSDM_FILTER_ERROR_DMA 0x00000003U /*!< DMA error occurs */
  406. #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
  407. #define DFSDM_FILTER_ERROR_INVALID_CALLBACK 0x00000004U /*!< Invalid callback error occurs */
  408. #endif
  409. /**
  410. * @}
  411. */
  412. /** @defgroup DFSDM_BreakSignals DFSDM break signals
  413. * @{
  414. */
  415. #define DFSDM_NO_BREAK_SIGNAL 0x00000000U /*!< No break signal */
  416. #define DFSDM_BREAK_SIGNAL_0 0x00000001U /*!< Break signal 0 */
  417. #define DFSDM_BREAK_SIGNAL_1 0x00000002U /*!< Break signal 1 */
  418. #define DFSDM_BREAK_SIGNAL_2 0x00000004U /*!< Break signal 2 */
  419. #define DFSDM_BREAK_SIGNAL_3 0x00000008U /*!< Break signal 3 */
  420. /**
  421. * @}
  422. */
  423. /** @defgroup DFSDM_Channel_Selection DFSDM Channel Selection
  424. * @{
  425. */
  426. /* DFSDM Channels ------------------------------------------------------------*/
  427. /* The DFSDM channels are defined as follows:
  428. - in 16-bit LSB the channel mask is set
  429. - in 16-bit MSB the channel number is set
  430. e.g. for channel 5 definition:
  431. - the channel mask is 0x00000020 (bit 5 is set)
  432. - the channel number 5 is 0x00050000
  433. --> Consequently, channel 5 definition is 0x00000020 | 0x00050000 = 0x00050020 */
  434. #define DFSDM_CHANNEL_0 0x00000001U
  435. #define DFSDM_CHANNEL_1 0x00010002U
  436. #define DFSDM_CHANNEL_2 0x00020004U
  437. #define DFSDM_CHANNEL_3 0x00030008U
  438. #define DFSDM_CHANNEL_4 0x00040010U
  439. #define DFSDM_CHANNEL_5 0x00050020U
  440. #define DFSDM_CHANNEL_6 0x00060040U
  441. #define DFSDM_CHANNEL_7 0x00070080U
  442. /**
  443. * @}
  444. */
  445. /** @defgroup DFSDM_ContinuousMode DFSDM Continuous Mode
  446. * @{
  447. */
  448. #define DFSDM_CONTINUOUS_CONV_OFF 0x00000000U /*!< Conversion are not continuous */
  449. #define DFSDM_CONTINUOUS_CONV_ON 0x00000001U /*!< Conversion are continuous */
  450. /**
  451. * @}
  452. */
  453. /** @defgroup DFSDM_AwdThreshold DFSDM analog watchdog threshold
  454. * @{
  455. */
  456. #define DFSDM_AWD_HIGH_THRESHOLD 0x00000000U /*!< Analog watchdog high threshold */
  457. #define DFSDM_AWD_LOW_THRESHOLD 0x00000001U /*!< Analog watchdog low threshold */
  458. /**
  459. * @}
  460. */
  461. /**
  462. * @}
  463. */
  464. /* End of exported constants -------------------------------------------------*/
  465. /* Exported macros -----------------------------------------------------------*/
  466. /** @defgroup DFSDM_Exported_Macros DFSDM Exported Macros
  467. * @{
  468. */
  469. /** @brief Reset DFSDM channel handle state.
  470. * @param __HANDLE__ DFSDM channel handle.
  471. * @retval None
  472. */
  473. #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
  474. #define __HAL_DFSDM_CHANNEL_RESET_HANDLE_STATE(__HANDLE__) do{ \
  475. (__HANDLE__)->State = HAL_DFSDM_CHANNEL_STATE_RESET; \
  476. (__HANDLE__)->MspInitCallback = NULL; \
  477. (__HANDLE__)->MspDeInitCallback = NULL; \
  478. } while(0)
  479. #else
  480. #define __HAL_DFSDM_CHANNEL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DFSDM_CHANNEL_STATE_RESET)
  481. #endif
  482. /** @brief Reset DFSDM filter handle state.
  483. * @param __HANDLE__ DFSDM filter handle.
  484. * @retval None
  485. */
  486. #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
  487. #define __HAL_DFSDM_FILTER_RESET_HANDLE_STATE(__HANDLE__) do{ \
  488. (__HANDLE__)->State = HAL_DFSDM_FILTER_STATE_RESET; \
  489. (__HANDLE__)->MspInitCallback = NULL; \
  490. (__HANDLE__)->MspDeInitCallback = NULL; \
  491. } while(0)
  492. #else
  493. #define __HAL_DFSDM_FILTER_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DFSDM_FILTER_STATE_RESET)
  494. #endif
  495. /**
  496. * @}
  497. */
  498. /* End of exported macros ----------------------------------------------------*/
  499. /* Exported functions --------------------------------------------------------*/
  500. /** @addtogroup DFSDM_Exported_Functions DFSDM Exported Functions
  501. * @{
  502. */
  503. /** @addtogroup DFSDM_Exported_Functions_Group1_Channel Channel initialization and de-initialization functions
  504. * @{
  505. */
  506. /* Channel initialization and de-initialization functions *********************/
  507. HAL_StatusTypeDef HAL_DFSDM_ChannelInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  508. HAL_StatusTypeDef HAL_DFSDM_ChannelDeInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  509. void HAL_DFSDM_ChannelMspInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  510. void HAL_DFSDM_ChannelMspDeInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  511. #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
  512. /* Channel callbacks register/unregister functions ****************************/
  513. HAL_StatusTypeDef HAL_DFSDM_Channel_RegisterCallback(DFSDM_Channel_HandleTypeDef *hdfsdm_channel,
  514. HAL_DFSDM_Channel_CallbackIDTypeDef CallbackID,
  515. pDFSDM_Channel_CallbackTypeDef pCallback);
  516. HAL_StatusTypeDef HAL_DFSDM_Channel_UnRegisterCallback(DFSDM_Channel_HandleTypeDef *hdfsdm_channel,
  517. HAL_DFSDM_Channel_CallbackIDTypeDef CallbackID);
  518. #endif
  519. /**
  520. * @}
  521. */
  522. /** @addtogroup DFSDM_Exported_Functions_Group2_Channel Channel operation functions
  523. * @{
  524. */
  525. /* Channel operation functions ************************************************/
  526. HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStart(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  527. HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStart_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  528. HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStop(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  529. HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStop_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  530. HAL_StatusTypeDef HAL_DFSDM_ChannelScdStart(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t Threshold, uint32_t BreakSignal);
  531. HAL_StatusTypeDef HAL_DFSDM_ChannelScdStart_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t Threshold, uint32_t BreakSignal);
  532. HAL_StatusTypeDef HAL_DFSDM_ChannelScdStop(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  533. HAL_StatusTypeDef HAL_DFSDM_ChannelScdStop_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  534. int16_t HAL_DFSDM_ChannelGetAwdValue(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  535. HAL_StatusTypeDef HAL_DFSDM_ChannelModifyOffset(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, int32_t Offset);
  536. HAL_StatusTypeDef HAL_DFSDM_ChannelPollForCkab(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t Timeout);
  537. HAL_StatusTypeDef HAL_DFSDM_ChannelPollForScd(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t Timeout);
  538. void HAL_DFSDM_ChannelCkabCallback(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  539. void HAL_DFSDM_ChannelScdCallback(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  540. /**
  541. * @}
  542. */
  543. /** @defgroup DFSDM_Exported_Functions_Group3_Channel Channel state function
  544. * @{
  545. */
  546. /* Channel state function *****************************************************/
  547. HAL_DFSDM_Channel_StateTypeDef HAL_DFSDM_ChannelGetState(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  548. /**
  549. * @}
  550. */
  551. /** @addtogroup DFSDM_Exported_Functions_Group1_Filter Filter initialization and de-initialization functions
  552. * @{
  553. */
  554. /* Filter initialization and de-initialization functions *********************/
  555. HAL_StatusTypeDef HAL_DFSDM_FilterInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  556. HAL_StatusTypeDef HAL_DFSDM_FilterDeInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  557. void HAL_DFSDM_FilterMspInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  558. void HAL_DFSDM_FilterMspDeInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  559. #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
  560. /* Filter callbacks register/unregister functions ****************************/
  561. HAL_StatusTypeDef HAL_DFSDM_Filter_RegisterCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
  562. HAL_DFSDM_Filter_CallbackIDTypeDef CallbackID,
  563. pDFSDM_Filter_CallbackTypeDef pCallback);
  564. HAL_StatusTypeDef HAL_DFSDM_Filter_UnRegisterCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
  565. HAL_DFSDM_Filter_CallbackIDTypeDef CallbackID);
  566. HAL_StatusTypeDef HAL_DFSDM_Filter_RegisterAwdCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
  567. pDFSDM_Filter_AwdCallbackTypeDef pCallback);
  568. HAL_StatusTypeDef HAL_DFSDM_Filter_UnRegisterAwdCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  569. #endif
  570. /**
  571. * @}
  572. */
  573. /** @addtogroup DFSDM_Exported_Functions_Group2_Filter Filter control functions
  574. * @{
  575. */
  576. /* Filter control functions *********************/
  577. HAL_StatusTypeDef HAL_DFSDM_FilterConfigRegChannel(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
  578. uint32_t Channel,
  579. uint32_t ContinuousMode);
  580. HAL_StatusTypeDef HAL_DFSDM_FilterConfigInjChannel(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
  581. uint32_t Channel);
  582. /**
  583. * @}
  584. */
  585. /** @addtogroup DFSDM_Exported_Functions_Group3_Filter Filter operation functions
  586. * @{
  587. */
  588. /* Filter operation functions *********************/
  589. HAL_StatusTypeDef HAL_DFSDM_FilterRegularStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  590. HAL_StatusTypeDef HAL_DFSDM_FilterRegularStart_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  591. HAL_StatusTypeDef HAL_DFSDM_FilterRegularStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, int32_t *pData, uint32_t Length);
  592. HAL_StatusTypeDef HAL_DFSDM_FilterRegularMsbStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, int16_t *pData, uint32_t Length);
  593. HAL_StatusTypeDef HAL_DFSDM_FilterRegularStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  594. HAL_StatusTypeDef HAL_DFSDM_FilterRegularStop_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  595. HAL_StatusTypeDef HAL_DFSDM_FilterRegularStop_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  596. HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  597. HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStart_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  598. HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, int32_t *pData, uint32_t Length);
  599. HAL_StatusTypeDef HAL_DFSDM_FilterInjectedMsbStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, int16_t *pData, uint32_t Length);
  600. HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  601. HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStop_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  602. HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStop_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  603. HAL_StatusTypeDef HAL_DFSDM_FilterAwdStart_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
  604. DFSDM_Filter_AwdParamTypeDef* awdParam);
  605. HAL_StatusTypeDef HAL_DFSDM_FilterAwdStop_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  606. HAL_StatusTypeDef HAL_DFSDM_FilterExdStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Channel);
  607. HAL_StatusTypeDef HAL_DFSDM_FilterExdStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  608. int32_t HAL_DFSDM_FilterGetRegularValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t* Channel);
  609. int32_t HAL_DFSDM_FilterGetInjectedValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t* Channel);
  610. int32_t HAL_DFSDM_FilterGetExdMaxValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t* Channel);
  611. int32_t HAL_DFSDM_FilterGetExdMinValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t* Channel);
  612. uint32_t HAL_DFSDM_FilterGetConvTimeValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  613. void HAL_DFSDM_IRQHandler(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  614. HAL_StatusTypeDef HAL_DFSDM_FilterPollForRegConversion(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Timeout);
  615. HAL_StatusTypeDef HAL_DFSDM_FilterPollForInjConversion(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Timeout);
  616. void HAL_DFSDM_FilterRegConvCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  617. void HAL_DFSDM_FilterRegConvHalfCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  618. void HAL_DFSDM_FilterInjConvCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  619. void HAL_DFSDM_FilterInjConvHalfCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  620. void HAL_DFSDM_FilterAwdCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Channel, uint32_t Threshold);
  621. void HAL_DFSDM_FilterErrorCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  622. /**
  623. * @}
  624. */
  625. /** @defgroup DFSDM_Exported_Functions_Group4_Filter Filter state functions
  626. * @{
  627. */
  628. /* Filter state functions *****************************************************/
  629. HAL_DFSDM_Filter_StateTypeDef HAL_DFSDM_FilterGetState(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  630. uint32_t HAL_DFSDM_FilterGetError(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  631. /**
  632. * @}
  633. */
  634. /**
  635. * @}
  636. */
  637. /* End of exported functions -------------------------------------------------*/
  638. /* Private macros ------------------------------------------------------------*/
  639. /** @defgroup DFSDM_Private_Macros DFSDM Private Macros
  640. * @{
  641. */
  642. #define IS_DFSDM_CHANNEL_OUTPUT_CLOCK(CLOCK) (((CLOCK) == DFSDM_CHANNEL_OUTPUT_CLOCK_SYSTEM) || \
  643. ((CLOCK) == DFSDM_CHANNEL_OUTPUT_CLOCK_AUDIO))
  644. #define IS_DFSDM_CHANNEL_OUTPUT_CLOCK_DIVIDER(DIVIDER) ((2U <= (DIVIDER)) && ((DIVIDER) <= 256U))
  645. #define IS_DFSDM_CHANNEL_INPUT(INPUT) (((INPUT) == DFSDM_CHANNEL_EXTERNAL_INPUTS) || \
  646. ((INPUT) == DFSDM_CHANNEL_ADC_OUTPUT) || \
  647. ((INPUT) == DFSDM_CHANNEL_INTERNAL_REGISTER))
  648. #define IS_DFSDM_CHANNEL_DATA_PACKING(MODE) (((MODE) == DFSDM_CHANNEL_STANDARD_MODE) || \
  649. ((MODE) == DFSDM_CHANNEL_INTERLEAVED_MODE) || \
  650. ((MODE) == DFSDM_CHANNEL_DUAL_MODE))
  651. #define IS_DFSDM_CHANNEL_INPUT_PINS(PINS) (((PINS) == DFSDM_CHANNEL_SAME_CHANNEL_PINS) || \
  652. ((PINS) == DFSDM_CHANNEL_FOLLOWING_CHANNEL_PINS))
  653. #define IS_DFSDM_CHANNEL_SERIAL_INTERFACE_TYPE(MODE) (((MODE) == DFSDM_CHANNEL_SPI_RISING) || \
  654. ((MODE) == DFSDM_CHANNEL_SPI_FALLING) || \
  655. ((MODE) == DFSDM_CHANNEL_MANCHESTER_RISING) || \
  656. ((MODE) == DFSDM_CHANNEL_MANCHESTER_FALLING))
  657. #define IS_DFSDM_CHANNEL_SPI_CLOCK(TYPE) (((TYPE) == DFSDM_CHANNEL_SPI_CLOCK_EXTERNAL) || \
  658. ((TYPE) == DFSDM_CHANNEL_SPI_CLOCK_INTERNAL) || \
  659. ((TYPE) == DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_FALLING) || \
  660. ((TYPE) == DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_RISING))
  661. #define IS_DFSDM_CHANNEL_FILTER_ORDER(ORDER) (((ORDER) == DFSDM_CHANNEL_FASTSINC_ORDER) || \
  662. ((ORDER) == DFSDM_CHANNEL_SINC1_ORDER) || \
  663. ((ORDER) == DFSDM_CHANNEL_SINC2_ORDER) || \
  664. ((ORDER) == DFSDM_CHANNEL_SINC3_ORDER))
  665. #define IS_DFSDM_CHANNEL_FILTER_OVS_RATIO(RATIO) ((1U <= (RATIO)) && ((RATIO) <= 32U))
  666. #define IS_DFSDM_CHANNEL_OFFSET(VALUE) ((-8388608 <= (VALUE)) && ((VALUE) <= 8388607))
  667. #define IS_DFSDM_CHANNEL_RIGHT_BIT_SHIFT(VALUE) ((VALUE) <= 0x1FU)
  668. #define IS_DFSDM_CHANNEL_SCD_THRESHOLD(VALUE) ((VALUE) <= 0xFFU)
  669. #define IS_DFSDM_FILTER_REG_TRIGGER(TRIG) (((TRIG) == DFSDM_FILTER_SW_TRIGGER) || \
  670. ((TRIG) == DFSDM_FILTER_SYNC_TRIGGER))
  671. #define IS_DFSDM_FILTER_INJ_TRIGGER(TRIG) (((TRIG) == DFSDM_FILTER_SW_TRIGGER) || \
  672. ((TRIG) == DFSDM_FILTER_SYNC_TRIGGER) || \
  673. ((TRIG) == DFSDM_FILTER_EXT_TRIGGER))
  674. #define IS_DFSDM_FILTER_EXT_TRIG(TRIG) (((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM1_TRGO) || \
  675. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM1_TRGO2) || \
  676. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM8_TRGO) || \
  677. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM8_TRGO2) || \
  678. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM3_TRGO) || \
  679. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM4_TRGO) || \
  680. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM16_OC1) || \
  681. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM6_TRGO) || \
  682. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM7_TRGO) || \
  683. ((TRIG) == DFSDM_FILTER_EXT_TRIG_HRTIM1_ADCTRG1) || \
  684. ((TRIG) == DFSDM_FILTER_EXT_TRIG_HRTIM1_ADCTRG3) || \
  685. ((TRIG) == DFSDM_FILTER_EXT_TRIG_EXTI11) || \
  686. ((TRIG) == DFSDM_FILTER_EXT_TRIG_EXTI15) || \
  687. ((TRIG) == DFSDM_FILTER_EXT_TRIG_LPTIM1_OUT) || \
  688. ((TRIG) == DFSDM_FILTER_EXT_TRIG_LPTIM2_OUT) || \
  689. ((TRIG) == DFSDM_FILTER_EXT_TRIG_LPTIM3_OUT))
  690. #define IS_DFSDM_FILTER_EXT_TRIG_EDGE(EDGE) (((EDGE) == DFSDM_FILTER_EXT_TRIG_RISING_EDGE) || \
  691. ((EDGE) == DFSDM_FILTER_EXT_TRIG_FALLING_EDGE) || \
  692. ((EDGE) == DFSDM_FILTER_EXT_TRIG_BOTH_EDGES))
  693. #define IS_DFSDM_FILTER_SINC_ORDER(ORDER) (((ORDER) == DFSDM_FILTER_FASTSINC_ORDER) || \
  694. ((ORDER) == DFSDM_FILTER_SINC1_ORDER) || \
  695. ((ORDER) == DFSDM_FILTER_SINC2_ORDER) || \
  696. ((ORDER) == DFSDM_FILTER_SINC3_ORDER) || \
  697. ((ORDER) == DFSDM_FILTER_SINC4_ORDER) || \
  698. ((ORDER) == DFSDM_FILTER_SINC5_ORDER))
  699. #define IS_DFSDM_FILTER_OVS_RATIO(RATIO) ((1U <= (RATIO)) && ((RATIO) <= 1024U))
  700. #define IS_DFSDM_FILTER_INTEGRATOR_OVS_RATIO(RATIO) ((1U <= (RATIO)) && ((RATIO) <= 256U))
  701. #define IS_DFSDM_FILTER_AWD_DATA_SOURCE(DATA) (((DATA) == DFSDM_FILTER_AWD_FILTER_DATA) || \
  702. ((DATA) == DFSDM_FILTER_AWD_CHANNEL_DATA))
  703. #define IS_DFSDM_FILTER_AWD_THRESHOLD(VALUE) ((-8388608 <= (VALUE)) && ((VALUE) <= 8388607))
  704. #define IS_DFSDM_BREAK_SIGNALS(VALUE) ((VALUE) <= 0xFU)
  705. #define IS_DFSDM_REGULAR_CHANNEL(CHANNEL) (((CHANNEL) == DFSDM_CHANNEL_0) || \
  706. ((CHANNEL) == DFSDM_CHANNEL_1) || \
  707. ((CHANNEL) == DFSDM_CHANNEL_2) || \
  708. ((CHANNEL) == DFSDM_CHANNEL_3) || \
  709. ((CHANNEL) == DFSDM_CHANNEL_4) || \
  710. ((CHANNEL) == DFSDM_CHANNEL_5) || \
  711. ((CHANNEL) == DFSDM_CHANNEL_6) || \
  712. ((CHANNEL) == DFSDM_CHANNEL_7))
  713. #define IS_DFSDM_INJECTED_CHANNEL(CHANNEL) (((CHANNEL) != 0U) && ((CHANNEL) <= 0x000F00FFU))
  714. #define IS_DFSDM_CONTINUOUS_MODE(MODE) (((MODE) == DFSDM_CONTINUOUS_CONV_OFF) || \
  715. ((MODE) == DFSDM_CONTINUOUS_CONV_ON))
  716. /**
  717. * @}
  718. */
  719. /* End of private macros -----------------------------------------------------*/
  720. /**
  721. * @}
  722. */
  723. /**
  724. * @}
  725. */
  726. #ifdef __cplusplus
  727. }
  728. #endif
  729. #endif /* STM32H7xx_HAL_DFSDM_H */
  730. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/