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.
 
 
 

756 lines
40 KiB

  1. /**
  2. ******************************************************************************
  3. * @file stm32l4xx_hal_dfsdm.h
  4. * @author MCD Application Team
  5. * @version V1.7.1
  6. * @date 21-April-2017
  7. * @brief Header file of DFSDM HAL module.
  8. ******************************************************************************
  9. * @attention
  10. *
  11. * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
  12. *
  13. * Redistribution and use in source and binary forms, with or without modification,
  14. * are permitted provided that the following conditions are met:
  15. * 1. Redistributions of source code must retain the above copyright notice,
  16. * this list of conditions and the following disclaimer.
  17. * 2. Redistributions in binary form must reproduce the above copyright notice,
  18. * this list of conditions and the following disclaimer in the documentation
  19. * and/or other materials provided with the distribution.
  20. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  21. * may be used to endorse or promote products derived from this software
  22. * without specific prior written permission.
  23. *
  24. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  25. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  26. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  27. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  28. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  29. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  30. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  31. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  32. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  33. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34. *
  35. ******************************************************************************
  36. */
  37. /* Define to prevent recursive inclusion -------------------------------------*/
  38. #ifndef __STM32L4xx_HAL_DFSDM_H
  39. #define __STM32L4xx_HAL_DFSDM_H
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. #if defined(STM32L451xx) || defined(STM32L452xx) || defined(STM32L462xx) || \
  44. defined(STM32L471xx) || defined(STM32L475xx) || defined(STM32L476xx) || defined(STM32L485xx) || defined(STM32L486xx) || \
  45. defined(STM32L496xx) || defined(STM32L4A6xx)
  46. /* Includes ------------------------------------------------------------------*/
  47. #include "stm32l4xx_hal_def.h"
  48. /** @addtogroup STM32L4xx_HAL_Driver
  49. * @{
  50. */
  51. /** @addtogroup DFSDM
  52. * @{
  53. */
  54. /* Exported types ------------------------------------------------------------*/
  55. /** @defgroup DFSDM_Exported_Types DFSDM Exported Types
  56. * @{
  57. */
  58. /**
  59. * @brief HAL DFSDM Channel states definition
  60. */
  61. typedef enum
  62. {
  63. HAL_DFSDM_CHANNEL_STATE_RESET = 0x00U, /*!< DFSDM channel not initialized */
  64. HAL_DFSDM_CHANNEL_STATE_READY = 0x01U, /*!< DFSDM channel initialized and ready for use */
  65. HAL_DFSDM_CHANNEL_STATE_ERROR = 0xFFU /*!< DFSDM channel state error */
  66. }HAL_DFSDM_Channel_StateTypeDef;
  67. /**
  68. * @brief DFSDM channel output clock structure definition
  69. */
  70. typedef struct
  71. {
  72. FunctionalState Activation; /*!< Output clock enable/disable */
  73. uint32_t Selection; /*!< Output clock is system clock or audio clock.
  74. This parameter can be a value of @ref DFSDM_Channel_OuputClock */
  75. uint32_t Divider; /*!< Output clock divider.
  76. This parameter must be a number between Min_Data = 2 and Max_Data = 256 */
  77. }DFSDM_Channel_OutputClockTypeDef;
  78. /**
  79. * @brief DFSDM channel input structure definition
  80. */
  81. typedef struct
  82. {
  83. uint32_t Multiplexer; /*!< Input is external serial inputs, internal register or ADC output.
  84. ADC output is available only on STM32L451xx, STM32L452xx, STM32L462xx,
  85. STM32L496xx, STM32L4A6xx products.
  86. This parameter can be a value of @ref DFSDM_Channel_InputMultiplexer */
  87. uint32_t DataPacking; /*!< Standard, interleaved or dual mode for internal register.
  88. This parameter can be a value of @ref DFSDM_Channel_DataPacking */
  89. uint32_t Pins; /*!< Input pins are taken from same or following channel.
  90. This parameter can be a value of @ref DFSDM_Channel_InputPins */
  91. }DFSDM_Channel_InputTypeDef;
  92. /**
  93. * @brief DFSDM channel serial interface structure definition
  94. */
  95. typedef struct
  96. {
  97. uint32_t Type; /*!< SPI or Manchester modes.
  98. This parameter can be a value of @ref DFSDM_Channel_SerialInterfaceType */
  99. uint32_t SpiClock; /*!< SPI clock select (external or internal with different sampling point).
  100. This parameter can be a value of @ref DFSDM_Channel_SpiClock */
  101. }DFSDM_Channel_SerialInterfaceTypeDef;
  102. /**
  103. * @brief DFSDM channel analog watchdog structure definition
  104. */
  105. typedef struct
  106. {
  107. uint32_t FilterOrder; /*!< Analog watchdog Sinc filter order.
  108. This parameter can be a value of @ref DFSDM_Channel_AwdFilterOrder */
  109. uint32_t Oversampling; /*!< Analog watchdog filter oversampling ratio.
  110. This parameter must be a number between Min_Data = 1 and Max_Data = 32 */
  111. }DFSDM_Channel_AwdTypeDef;
  112. /**
  113. * @brief DFSDM channel init structure definition
  114. */
  115. typedef struct
  116. {
  117. DFSDM_Channel_OutputClockTypeDef OutputClock; /*!< DFSDM channel output clock parameters */
  118. DFSDM_Channel_InputTypeDef Input; /*!< DFSDM channel input parameters */
  119. DFSDM_Channel_SerialInterfaceTypeDef SerialInterface; /*!< DFSDM channel serial interface parameters */
  120. DFSDM_Channel_AwdTypeDef Awd; /*!< DFSDM channel analog watchdog parameters */
  121. int32_t Offset; /*!< DFSDM channel offset.
  122. This parameter must be a number between Min_Data = -8388608 and Max_Data = 8388607 */
  123. uint32_t RightBitShift; /*!< DFSDM channel right bit shift.
  124. This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x1F */
  125. }DFSDM_Channel_InitTypeDef;
  126. /**
  127. * @brief DFSDM channel handle structure definition
  128. */
  129. typedef struct
  130. {
  131. DFSDM_Channel_TypeDef *Instance; /*!< DFSDM channel instance */
  132. DFSDM_Channel_InitTypeDef Init; /*!< DFSDM channel init parameters */
  133. HAL_DFSDM_Channel_StateTypeDef State; /*!< DFSDM channel state */
  134. }DFSDM_Channel_HandleTypeDef;
  135. /**
  136. * @brief HAL DFSDM Filter states definition
  137. */
  138. typedef enum
  139. {
  140. HAL_DFSDM_FILTER_STATE_RESET = 0x00U, /*!< DFSDM filter not initialized */
  141. HAL_DFSDM_FILTER_STATE_READY = 0x01U, /*!< DFSDM filter initialized and ready for use */
  142. HAL_DFSDM_FILTER_STATE_REG = 0x02U, /*!< DFSDM filter regular conversion in progress */
  143. HAL_DFSDM_FILTER_STATE_INJ = 0x03U, /*!< DFSDM filter injected conversion in progress */
  144. HAL_DFSDM_FILTER_STATE_REG_INJ = 0x04U, /*!< DFSDM filter regular and injected conversions in progress */
  145. HAL_DFSDM_FILTER_STATE_ERROR = 0xFFU /*!< DFSDM filter state error */
  146. }HAL_DFSDM_Filter_StateTypeDef;
  147. /**
  148. * @brief DFSDM filter regular conversion parameters structure definition
  149. */
  150. typedef struct
  151. {
  152. uint32_t Trigger; /*!< Trigger used to start regular conversion: software or synchronous.
  153. This parameter can be a value of @ref DFSDM_Filter_Trigger */
  154. FunctionalState FastMode; /*!< Enable/disable fast mode for regular conversion */
  155. FunctionalState DmaMode; /*!< Enable/disable DMA for regular conversion */
  156. }DFSDM_Filter_RegularParamTypeDef;
  157. /**
  158. * @brief DFSDM filter injected conversion parameters structure definition
  159. */
  160. typedef struct
  161. {
  162. uint32_t Trigger; /*!< Trigger used to start injected conversion: software, external or synchronous.
  163. This parameter can be a value of @ref DFSDM_Filter_Trigger */
  164. FunctionalState ScanMode; /*!< Enable/disable scanning mode for injected conversion */
  165. FunctionalState DmaMode; /*!< Enable/disable DMA for injected conversion */
  166. uint32_t ExtTrigger; /*!< External trigger.
  167. This parameter can be a value of @ref DFSDM_Filter_ExtTrigger */
  168. uint32_t ExtTriggerEdge; /*!< External trigger edge: rising, falling or both.
  169. This parameter can be a value of @ref DFSDM_Filter_ExtTriggerEdge */
  170. }DFSDM_Filter_InjectedParamTypeDef;
  171. /**
  172. * @brief DFSDM filter parameters structure definition
  173. */
  174. typedef struct
  175. {
  176. uint32_t SincOrder; /*!< Sinc filter order.
  177. This parameter can be a value of @ref DFSDM_Filter_SincOrder */
  178. uint32_t Oversampling; /*!< Filter oversampling ratio.
  179. This parameter must be a number between Min_Data = 1 and Max_Data = 1024 */
  180. uint32_t IntOversampling; /*!< Integrator oversampling ratio.
  181. This parameter must be a number between Min_Data = 1 and Max_Data = 256 */
  182. }DFSDM_Filter_FilterParamTypeDef;
  183. /**
  184. * @brief DFSDM filter init structure definition
  185. */
  186. typedef struct
  187. {
  188. DFSDM_Filter_RegularParamTypeDef RegularParam; /*!< DFSDM regular conversion parameters */
  189. DFSDM_Filter_InjectedParamTypeDef InjectedParam; /*!< DFSDM injected conversion parameters */
  190. DFSDM_Filter_FilterParamTypeDef FilterParam; /*!< DFSDM filter parameters */
  191. }DFSDM_Filter_InitTypeDef;
  192. /**
  193. * @brief DFSDM filter handle structure definition
  194. */
  195. typedef struct
  196. {
  197. DFSDM_Filter_TypeDef *Instance; /*!< DFSDM filter instance */
  198. DFSDM_Filter_InitTypeDef Init; /*!< DFSDM filter init parameters */
  199. DMA_HandleTypeDef *hdmaReg; /*!< Pointer on DMA handler for regular conversions */
  200. DMA_HandleTypeDef *hdmaInj; /*!< Pointer on DMA handler for injected conversions */
  201. uint32_t RegularContMode; /*!< Regular conversion continuous mode */
  202. uint32_t RegularTrigger; /*!< Trigger used for regular conversion */
  203. uint32_t InjectedTrigger; /*!< Trigger used for injected conversion */
  204. uint32_t ExtTriggerEdge; /*!< Rising, falling or both edges selected */
  205. FunctionalState InjectedScanMode; /*!< Injected scanning mode */
  206. uint32_t InjectedChannelsNbr; /*!< Number of channels in injected sequence */
  207. uint32_t InjConvRemaining; /*!< Injected conversions remaining */
  208. HAL_DFSDM_Filter_StateTypeDef State; /*!< DFSDM filter state */
  209. uint32_t ErrorCode; /*!< DFSDM filter error code */
  210. }DFSDM_Filter_HandleTypeDef;
  211. /**
  212. * @brief DFSDM filter analog watchdog parameters structure definition
  213. */
  214. typedef struct
  215. {
  216. uint32_t DataSource; /*!< Values from digital filter or from channel watchdog filter.
  217. This parameter can be a value of @ref DFSDM_Filter_AwdDataSource */
  218. uint32_t Channel; /*!< Analog watchdog channel selection.
  219. This parameter can be a values combination of @ref DFSDM_Channel_Selection */
  220. int32_t HighThreshold; /*!< High threshold for the analog watchdog.
  221. This parameter must be a number between Min_Data = -8388608 and Max_Data = 8388607 */
  222. int32_t LowThreshold; /*!< Low threshold for the analog watchdog.
  223. This parameter must be a number between Min_Data = -8388608 and Max_Data = 8388607 */
  224. uint32_t HighBreakSignal; /*!< Break signal assigned to analog watchdog high threshold event.
  225. This parameter can be a values combination of @ref DFSDM_BreakSignals */
  226. uint32_t LowBreakSignal; /*!< Break signal assigned to analog watchdog low threshold event.
  227. This parameter can be a values combination of @ref DFSDM_BreakSignals */
  228. }DFSDM_Filter_AwdParamTypeDef;
  229. /**
  230. * @}
  231. */
  232. /* End of exported types -----------------------------------------------------*/
  233. /* Exported constants --------------------------------------------------------*/
  234. /** @defgroup DFSDM_Exported_Constants DFSDM Exported Constants
  235. * @{
  236. */
  237. /** @defgroup DFSDM_Channel_OuputClock DFSDM channel output clock selection
  238. * @{
  239. */
  240. #define DFSDM_CHANNEL_OUTPUT_CLOCK_SYSTEM ((uint32_t)0x00000000U) /*!< Source for ouput clock is system clock */
  241. #define DFSDM_CHANNEL_OUTPUT_CLOCK_AUDIO DFSDM_CHCFGR1_CKOUTSRC /*!< Source for ouput clock is audio clock */
  242. /**
  243. * @}
  244. */
  245. /** @defgroup DFSDM_Channel_InputMultiplexer DFSDM channel input multiplexer
  246. * @{
  247. */
  248. #define DFSDM_CHANNEL_EXTERNAL_INPUTS ((uint32_t)0x00000000U) /*!< Data are taken from external inputs */
  249. #if defined(STM32L451xx) || defined(STM32L452xx) || defined(STM32L462xx) || \
  250. defined(STM32L496xx) || defined(STM32L4A6xx)
  251. #define DFSDM_CHANNEL_ADC_OUTPUT DFSDM_CHCFGR1_DATMPX_0 /*!< Data are taken from ADC output */
  252. #endif /* STM32L451xx || STM32L452xx || STM32L462xx || STM32L496xx || STM32L4A6xx */
  253. #define DFSDM_CHANNEL_INTERNAL_REGISTER DFSDM_CHCFGR1_DATMPX_1 /*!< Data are taken from internal register */
  254. /**
  255. * @}
  256. */
  257. /** @defgroup DFSDM_Channel_DataPacking DFSDM channel input data packing
  258. * @{
  259. */
  260. #define DFSDM_CHANNEL_STANDARD_MODE ((uint32_t)0x00000000U) /*!< Standard data packing mode */
  261. #define DFSDM_CHANNEL_INTERLEAVED_MODE DFSDM_CHCFGR1_DATPACK_0 /*!< Interleaved data packing mode */
  262. #define DFSDM_CHANNEL_DUAL_MODE DFSDM_CHCFGR1_DATPACK_1 /*!< Dual data packing mode */
  263. /**
  264. * @}
  265. */
  266. /** @defgroup DFSDM_Channel_InputPins DFSDM channel input pins
  267. * @{
  268. */
  269. #define DFSDM_CHANNEL_SAME_CHANNEL_PINS ((uint32_t)0x00000000U) /*!< Input from pins on same channel */
  270. #define DFSDM_CHANNEL_FOLLOWING_CHANNEL_PINS DFSDM_CHCFGR1_CHINSEL /*!< Input from pins on following channel */
  271. /**
  272. * @}
  273. */
  274. /** @defgroup DFSDM_Channel_SerialInterfaceType DFSDM channel serial interface type
  275. * @{
  276. */
  277. #define DFSDM_CHANNEL_SPI_RISING ((uint32_t)0x00000000U) /*!< SPI with rising edge */
  278. #define DFSDM_CHANNEL_SPI_FALLING DFSDM_CHCFGR1_SITP_0 /*!< SPI with falling edge */
  279. #define DFSDM_CHANNEL_MANCHESTER_RISING DFSDM_CHCFGR1_SITP_1 /*!< Manchester with rising edge */
  280. #define DFSDM_CHANNEL_MANCHESTER_FALLING DFSDM_CHCFGR1_SITP /*!< Manchester with falling edge */
  281. /**
  282. * @}
  283. */
  284. /** @defgroup DFSDM_Channel_SpiClock DFSDM channel SPI clock selection
  285. * @{
  286. */
  287. #define DFSDM_CHANNEL_SPI_CLOCK_EXTERNAL ((uint32_t)0x00000000U) /*!< External SPI clock */
  288. #define DFSDM_CHANNEL_SPI_CLOCK_INTERNAL DFSDM_CHCFGR1_SPICKSEL_0 /*!< Internal SPI clock */
  289. #define DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_FALLING DFSDM_CHCFGR1_SPICKSEL_1 /*!< Internal SPI clock divided by 2, falling edge */
  290. #define DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_RISING DFSDM_CHCFGR1_SPICKSEL /*!< Internal SPI clock divided by 2, rising edge */
  291. /**
  292. * @}
  293. */
  294. /** @defgroup DFSDM_Channel_AwdFilterOrder DFSDM channel analog watchdog filter order
  295. * @{
  296. */
  297. #define DFSDM_CHANNEL_FASTSINC_ORDER ((uint32_t)0x00000000U) /*!< FastSinc filter type */
  298. #define DFSDM_CHANNEL_SINC1_ORDER DFSDM_CHAWSCDR_AWFORD_0 /*!< Sinc 1 filter type */
  299. #define DFSDM_CHANNEL_SINC2_ORDER DFSDM_CHAWSCDR_AWFORD_1 /*!< Sinc 2 filter type */
  300. #define DFSDM_CHANNEL_SINC3_ORDER DFSDM_CHAWSCDR_AWFORD /*!< Sinc 3 filter type */
  301. /**
  302. * @}
  303. */
  304. /** @defgroup DFSDM_Filter_Trigger DFSDM filter conversion trigger
  305. * @{
  306. */
  307. #define DFSDM_FILTER_SW_TRIGGER ((uint32_t)0x00000000U) /*!< Software trigger */
  308. #define DFSDM_FILTER_SYNC_TRIGGER ((uint32_t)0x00000001U) /*!< Synchronous with DFSDM_FLT0 */
  309. #define DFSDM_FILTER_EXT_TRIGGER ((uint32_t)0x00000002U) /*!< External trigger (only for injected conversion) */
  310. /**
  311. * @}
  312. */
  313. /** @defgroup DFSDM_Filter_ExtTrigger DFSDM filter external trigger
  314. * @{
  315. */
  316. #if defined(STM32L451xx) || defined(STM32L452xx) || defined(STM32L462xx)
  317. #define DFSDM_FILTER_EXT_TRIG_TIM1_TRGO ((uint32_t)0x00000000U) /*!< For DFSDM filter 0, 1, 2 and 3 */
  318. #define DFSDM_FILTER_EXT_TRIG_TIM1_TRGO2 DFSDM_FLTCR1_JEXTSEL_0 /*!< For DFSDM filter 0, 1, 2 and 3 */
  319. #define DFSDM_FILTER_EXT_TRIG_TIM3_TRGO DFSDM_FLTCR1_JEXTSEL_1 /*!< For DFSDM filter 0, 1, 2 and 3 */
  320. #define DFSDM_FILTER_EXT_TRIG_TIM16_OC1 (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_1) /*!< For DFSDM filter 0, 1 and 2 */
  321. #define DFSDM_FILTER_EXT_TRIG_TIM6_TRGO (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_2) /*!< For DFSDM filter 0 and 1 */
  322. #define DFSDM_FILTER_EXT_TRIG_EXTI11 (DFSDM_FLTCR1_JEXTSEL_1 | DFSDM_FLTCR1_JEXTSEL_2) /*!< For DFSDM filter 0, 1, 2 and 3 */
  323. #define DFSDM_FILTER_EXT_TRIG_EXTI15 DFSDM_FLTCR1_JEXTSEL /*!< For DFSDM filter 0, 1, 2 and 3 */
  324. #else
  325. #define DFSDM_FILTER_EXT_TRIG_TIM1_TRGO ((uint32_t)0x00000000U) /*!< For DFSDM filter 0, 1, 2 and 3 */
  326. #define DFSDM_FILTER_EXT_TRIG_TIM1_TRGO2 DFSDM_FLTCR1_JEXTSEL_0 /*!< For DFSDM filter 0, 1, 2 and 3 */
  327. #define DFSDM_FILTER_EXT_TRIG_TIM8_TRGO DFSDM_FLTCR1_JEXTSEL_1 /*!< For DFSDM filter 0, 1, 2 and 3 */
  328. #define DFSDM_FILTER_EXT_TRIG_TIM8_TRGO2 (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_1) /*!< For DFSDM filter 0, 1 and 2 */
  329. #define DFSDM_FILTER_EXT_TRIG_TIM3_TRGO (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_1) /*!< For DFSDM filter 3 */
  330. #define DFSDM_FILTER_EXT_TRIG_TIM4_TRGO DFSDM_FLTCR1_JEXTSEL_2 /*!< For DFSDM filter 0, 1 and 2 */
  331. #define DFSDM_FILTER_EXT_TRIG_TIM16_OC1 DFSDM_FLTCR1_JEXTSEL_2 /*!< For DFSDM filter 3 */
  332. #define DFSDM_FILTER_EXT_TRIG_TIM6_TRGO (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_2) /*!< For DFSDM filter 0 and 1 */
  333. #define DFSDM_FILTER_EXT_TRIG_TIM7_TRGO (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_2) /*!< For DFSDM filter 2 and 3 */
  334. #define DFSDM_FILTER_EXT_TRIG_EXTI11 (DFSDM_FLTCR1_JEXTSEL_1 | DFSDM_FLTCR1_JEXTSEL_2) /*!< For DFSDM filter 0, 1, 2 and 3 */
  335. #define DFSDM_FILTER_EXT_TRIG_EXTI15 DFSDM_FLTCR1_JEXTSEL /*!< For DFSDM filter 0, 1, 2 and 3 */
  336. #endif /* STM32L451xx || STM32L452xx || STM32L462xx */
  337. /**
  338. * @}
  339. */
  340. /** @defgroup DFSDM_Filter_ExtTriggerEdge DFSDM filter external trigger edge
  341. * @{
  342. */
  343. #define DFSDM_FILTER_EXT_TRIG_RISING_EDGE DFSDM_FLTCR1_JEXTEN_0 /*!< External rising edge */
  344. #define DFSDM_FILTER_EXT_TRIG_FALLING_EDGE DFSDM_FLTCR1_JEXTEN_1 /*!< External falling edge */
  345. #define DFSDM_FILTER_EXT_TRIG_BOTH_EDGES DFSDM_FLTCR1_JEXTEN /*!< External rising and falling edges */
  346. /**
  347. * @}
  348. */
  349. /** @defgroup DFSDM_Filter_SincOrder DFSDM filter sinc order
  350. * @{
  351. */
  352. #define DFSDM_FILTER_FASTSINC_ORDER ((uint32_t)0x00000000U) /*!< FastSinc filter type */
  353. #define DFSDM_FILTER_SINC1_ORDER DFSDM_FLTFCR_FORD_0 /*!< Sinc 1 filter type */
  354. #define DFSDM_FILTER_SINC2_ORDER DFSDM_FLTFCR_FORD_1 /*!< Sinc 2 filter type */
  355. #define DFSDM_FILTER_SINC3_ORDER (DFSDM_FLTFCR_FORD_0 | DFSDM_FLTFCR_FORD_1) /*!< Sinc 3 filter type */
  356. #define DFSDM_FILTER_SINC4_ORDER DFSDM_FLTFCR_FORD_2 /*!< Sinc 4 filter type */
  357. #define DFSDM_FILTER_SINC5_ORDER (DFSDM_FLTFCR_FORD_0 | DFSDM_FLTFCR_FORD_2) /*!< Sinc 5 filter type */
  358. /**
  359. * @}
  360. */
  361. /** @defgroup DFSDM_Filter_AwdDataSource DFSDM filter analog watchdog data source
  362. * @{
  363. */
  364. #define DFSDM_FILTER_AWD_FILTER_DATA ((uint32_t)0x00000000U) /*!< From digital filter */
  365. #define DFSDM_FILTER_AWD_CHANNEL_DATA DFSDM_FLTCR1_AWFSEL /*!< From analog watchdog channel */
  366. /**
  367. * @}
  368. */
  369. /** @defgroup DFSDM_Filter_ErrorCode DFSDM filter error code
  370. * @{
  371. */
  372. #define DFSDM_FILTER_ERROR_NONE ((uint32_t)0x00000000U) /*!< No error */
  373. #define DFSDM_FILTER_ERROR_REGULAR_OVERRUN ((uint32_t)0x00000001U) /*!< Overrun occurs during regular conversion */
  374. #define DFSDM_FILTER_ERROR_INJECTED_OVERRUN ((uint32_t)0x00000002U) /*!< Overrun occurs during injected conversion */
  375. #define DFSDM_FILTER_ERROR_DMA ((uint32_t)0x00000003U) /*!< DMA error occurs */
  376. /**
  377. * @}
  378. */
  379. /** @defgroup DFSDM_BreakSignals DFSDM break signals
  380. * @{
  381. */
  382. #define DFSDM_NO_BREAK_SIGNAL ((uint32_t)0x00000000U) /*!< No break signal */
  383. #define DFSDM_BREAK_SIGNAL_0 ((uint32_t)0x00000001U) /*!< Break signal 0 */
  384. #define DFSDM_BREAK_SIGNAL_1 ((uint32_t)0x00000002U) /*!< Break signal 1 */
  385. #define DFSDM_BREAK_SIGNAL_2 ((uint32_t)0x00000004U) /*!< Break signal 2 */
  386. #define DFSDM_BREAK_SIGNAL_3 ((uint32_t)0x00000008U) /*!< Break signal 3 */
  387. /**
  388. * @}
  389. */
  390. /** @defgroup DFSDM_Channel_Selection DFSDM Channel Selection
  391. * @{
  392. */
  393. /* DFSDM Channels ------------------------------------------------------------*/
  394. /* The DFSDM channels are defined as follows:
  395. - in 16-bit LSB the channel mask is set
  396. - in 16-bit MSB the channel number is set
  397. e.g. for channel 5 definition:
  398. - the channel mask is 0x00000020 (bit 5 is set)
  399. - the channel number 5 is 0x00050000
  400. --> Consequently, channel 5 definition is 0x00000020 | 0x00050000 = 0x00050020 */
  401. #if defined(STM32L451xx) || defined(STM32L452xx) || defined(STM32L462xx)
  402. #define DFSDM_CHANNEL_0 ((uint32_t)0x00000001U)
  403. #define DFSDM_CHANNEL_1 ((uint32_t)0x00010002U)
  404. #define DFSDM_CHANNEL_2 ((uint32_t)0x00020004U)
  405. #define DFSDM_CHANNEL_3 ((uint32_t)0x00030008U)
  406. #else /* STM32L451xx || STM32L452xx || STM32L462xx */
  407. #define DFSDM_CHANNEL_0 ((uint32_t)0x00000001U)
  408. #define DFSDM_CHANNEL_1 ((uint32_t)0x00010002U)
  409. #define DFSDM_CHANNEL_2 ((uint32_t)0x00020004U)
  410. #define DFSDM_CHANNEL_3 ((uint32_t)0x00030008U)
  411. #define DFSDM_CHANNEL_4 ((uint32_t)0x00040010U)
  412. #define DFSDM_CHANNEL_5 ((uint32_t)0x00050020U)
  413. #define DFSDM_CHANNEL_6 ((uint32_t)0x00060040U)
  414. #define DFSDM_CHANNEL_7 ((uint32_t)0x00070080U)
  415. #endif /* STM32L451xx || STM32L452xx || STM32L462xx */
  416. /**
  417. * @}
  418. */
  419. /** @defgroup DFSDM_ContinuousMode DFSDM Continuous Mode
  420. * @{
  421. */
  422. #define DFSDM_CONTINUOUS_CONV_OFF ((uint32_t)0x00000000U) /*!< Conversion are not continuous */
  423. #define DFSDM_CONTINUOUS_CONV_ON ((uint32_t)0x00000001U) /*!< Conversion are continuous */
  424. /**
  425. * @}
  426. */
  427. /** @defgroup DFSDM_AwdThreshold DFSDM analog watchdog threshold
  428. * @{
  429. */
  430. #define DFSDM_AWD_HIGH_THRESHOLD ((uint32_t)0x00000000U) /*!< Analog watchdog high threshold */
  431. #define DFSDM_AWD_LOW_THRESHOLD ((uint32_t)0x00000001U) /*!< Analog watchdog low threshold */
  432. /**
  433. * @}
  434. */
  435. /**
  436. * @}
  437. */
  438. /* End of exported constants -------------------------------------------------*/
  439. /* Exported macros -----------------------------------------------------------*/
  440. /** @defgroup DFSDM_Exported_Macros DFSDM Exported Macros
  441. * @{
  442. */
  443. /** @brief Reset DFSDM channel handle state.
  444. * @param __HANDLE__: DFSDM channel handle.
  445. * @retval None
  446. */
  447. #define __HAL_DFSDM_CHANNEL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DFSDM_CHANNEL_STATE_RESET)
  448. /** @brief Reset DFSDM filter handle state.
  449. * @param __HANDLE__: DFSDM filter handle.
  450. * @retval None
  451. */
  452. #define __HAL_DFSDM_FILTER_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DFSDM_FILTER_STATE_RESET)
  453. /**
  454. * @}
  455. */
  456. /* End of exported macros ----------------------------------------------------*/
  457. /* Exported functions --------------------------------------------------------*/
  458. /** @addtogroup DFSDM_Exported_Functions DFSDM Exported Functions
  459. * @{
  460. */
  461. /** @addtogroup DFSDM_Exported_Functions_Group1_Channel Channel initialization and de-initialization functions
  462. * @{
  463. */
  464. /* Channel initialization and de-initialization functions *********************/
  465. HAL_StatusTypeDef HAL_DFSDM_ChannelInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  466. HAL_StatusTypeDef HAL_DFSDM_ChannelDeInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  467. void HAL_DFSDM_ChannelMspInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  468. void HAL_DFSDM_ChannelMspDeInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  469. /**
  470. * @}
  471. */
  472. /** @addtogroup DFSDM_Exported_Functions_Group2_Channel Channel operation functions
  473. * @{
  474. */
  475. /* Channel operation functions ************************************************/
  476. HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStart(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  477. HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStart_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  478. HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStop(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  479. HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStop_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  480. HAL_StatusTypeDef HAL_DFSDM_ChannelScdStart(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t Threshold, uint32_t BreakSignal);
  481. HAL_StatusTypeDef HAL_DFSDM_ChannelScdStart_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t Threshold, uint32_t BreakSignal);
  482. HAL_StatusTypeDef HAL_DFSDM_ChannelScdStop(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  483. HAL_StatusTypeDef HAL_DFSDM_ChannelScdStop_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  484. int16_t HAL_DFSDM_ChannelGetAwdValue(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  485. HAL_StatusTypeDef HAL_DFSDM_ChannelModifyOffset(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, int32_t Offset);
  486. HAL_StatusTypeDef HAL_DFSDM_ChannelPollForCkab(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t Timeout);
  487. HAL_StatusTypeDef HAL_DFSDM_ChannelPollForScd(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t Timeout);
  488. void HAL_DFSDM_ChannelCkabCallback(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  489. void HAL_DFSDM_ChannelScdCallback(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  490. /**
  491. * @}
  492. */
  493. /** @defgroup DFSDM_Exported_Functions_Group3_Channel Channel state function
  494. * @{
  495. */
  496. /* Channel state function *****************************************************/
  497. HAL_DFSDM_Channel_StateTypeDef HAL_DFSDM_ChannelGetState(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
  498. /**
  499. * @}
  500. */
  501. /** @addtogroup DFSDM_Exported_Functions_Group1_Filter Filter initialization and de-initialization functions
  502. * @{
  503. */
  504. /* Filter initialization and de-initialization functions *********************/
  505. HAL_StatusTypeDef HAL_DFSDM_FilterInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  506. HAL_StatusTypeDef HAL_DFSDM_FilterDeInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  507. void HAL_DFSDM_FilterMspInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  508. void HAL_DFSDM_FilterMspDeInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  509. /**
  510. * @}
  511. */
  512. /** @addtogroup DFSDM_Exported_Functions_Group2_Filter Filter control functions
  513. * @{
  514. */
  515. /* Filter control functions *********************/
  516. HAL_StatusTypeDef HAL_DFSDM_FilterConfigRegChannel(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
  517. uint32_t Channel,
  518. uint32_t ContinuousMode);
  519. HAL_StatusTypeDef HAL_DFSDM_FilterConfigInjChannel(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
  520. uint32_t Channel);
  521. /**
  522. * @}
  523. */
  524. /** @addtogroup DFSDM_Exported_Functions_Group3_Filter Filter operation functions
  525. * @{
  526. */
  527. /* Filter operation functions *********************/
  528. HAL_StatusTypeDef HAL_DFSDM_FilterRegularStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  529. HAL_StatusTypeDef HAL_DFSDM_FilterRegularStart_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  530. HAL_StatusTypeDef HAL_DFSDM_FilterRegularStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, int32_t *pData, uint32_t Length);
  531. HAL_StatusTypeDef HAL_DFSDM_FilterRegularMsbStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, int16_t *pData, uint32_t Length);
  532. HAL_StatusTypeDef HAL_DFSDM_FilterRegularStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  533. HAL_StatusTypeDef HAL_DFSDM_FilterRegularStop_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  534. HAL_StatusTypeDef HAL_DFSDM_FilterRegularStop_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  535. HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  536. HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStart_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  537. HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, int32_t *pData, uint32_t Length);
  538. HAL_StatusTypeDef HAL_DFSDM_FilterInjectedMsbStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, int16_t *pData, uint32_t Length);
  539. HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  540. HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStop_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  541. HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStop_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  542. HAL_StatusTypeDef HAL_DFSDM_FilterAwdStart_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
  543. DFSDM_Filter_AwdParamTypeDef* awdParam);
  544. HAL_StatusTypeDef HAL_DFSDM_FilterAwdStop_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  545. HAL_StatusTypeDef HAL_DFSDM_FilterExdStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Channel);
  546. HAL_StatusTypeDef HAL_DFSDM_FilterExdStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  547. int32_t HAL_DFSDM_FilterGetRegularValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t* Channel);
  548. int32_t HAL_DFSDM_FilterGetInjectedValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t* Channel);
  549. int32_t HAL_DFSDM_FilterGetExdMaxValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t* Channel);
  550. int32_t HAL_DFSDM_FilterGetExdMinValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t* Channel);
  551. uint32_t HAL_DFSDM_FilterGetConvTimeValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  552. void HAL_DFSDM_IRQHandler(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  553. HAL_StatusTypeDef HAL_DFSDM_FilterPollForRegConversion(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Timeout);
  554. HAL_StatusTypeDef HAL_DFSDM_FilterPollForInjConversion(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Timeout);
  555. void HAL_DFSDM_FilterRegConvCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  556. void HAL_DFSDM_FilterRegConvHalfCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  557. void HAL_DFSDM_FilterInjConvCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  558. void HAL_DFSDM_FilterInjConvHalfCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  559. void HAL_DFSDM_FilterAwdCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Channel, uint32_t Threshold);
  560. void HAL_DFSDM_FilterErrorCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  561. /**
  562. * @}
  563. */
  564. /** @defgroup DFSDM_Exported_Functions_Group4_Filter Filter state functions
  565. * @{
  566. */
  567. /* Filter state functions *****************************************************/
  568. HAL_DFSDM_Filter_StateTypeDef HAL_DFSDM_FilterGetState(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  569. uint32_t HAL_DFSDM_FilterGetError(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
  570. /**
  571. * @}
  572. */
  573. /**
  574. * @}
  575. */
  576. /* End of exported functions -------------------------------------------------*/
  577. /* Private macros ------------------------------------------------------------*/
  578. /** @defgroup DFSDM_Private_Macros DFSDM Private Macros
  579. * @{
  580. */
  581. #define IS_DFSDM_CHANNEL_OUTPUT_CLOCK(CLOCK) (((CLOCK) == DFSDM_CHANNEL_OUTPUT_CLOCK_SYSTEM) || \
  582. ((CLOCK) == DFSDM_CHANNEL_OUTPUT_CLOCK_AUDIO))
  583. #define IS_DFSDM_CHANNEL_OUTPUT_CLOCK_DIVIDER(DIVIDER) ((2 <= (DIVIDER)) && ((DIVIDER) <= 256))
  584. #if defined(STM32L451xx) || defined(STM32L452xx) || defined(STM32L462xx) || \
  585. defined(STM32L496xx) || defined(STM32L4A6xx)
  586. #define IS_DFSDM_CHANNEL_INPUT(INPUT) (((INPUT) == DFSDM_CHANNEL_EXTERNAL_INPUTS) || \
  587. ((INPUT) == DFSDM_CHANNEL_ADC_OUTPUT) || \
  588. ((INPUT) == DFSDM_CHANNEL_INTERNAL_REGISTER))
  589. #else
  590. #define IS_DFSDM_CHANNEL_INPUT(INPUT) (((INPUT) == DFSDM_CHANNEL_EXTERNAL_INPUTS) || \
  591. ((INPUT) == DFSDM_CHANNEL_INTERNAL_REGISTER))
  592. #endif /* STM32L451xx || STM32L452xx || STM32L462xx || STM32L496xx || STM32L4A6xx */
  593. #define IS_DFSDM_CHANNEL_DATA_PACKING(MODE) (((MODE) == DFSDM_CHANNEL_STANDARD_MODE) || \
  594. ((MODE) == DFSDM_CHANNEL_INTERLEAVED_MODE) || \
  595. ((MODE) == DFSDM_CHANNEL_DUAL_MODE))
  596. #define IS_DFSDM_CHANNEL_INPUT_PINS(PINS) (((PINS) == DFSDM_CHANNEL_SAME_CHANNEL_PINS) || \
  597. ((PINS) == DFSDM_CHANNEL_FOLLOWING_CHANNEL_PINS))
  598. #define IS_DFSDM_CHANNEL_SERIAL_INTERFACE_TYPE(MODE) (((MODE) == DFSDM_CHANNEL_SPI_RISING) || \
  599. ((MODE) == DFSDM_CHANNEL_SPI_FALLING) || \
  600. ((MODE) == DFSDM_CHANNEL_MANCHESTER_RISING) || \
  601. ((MODE) == DFSDM_CHANNEL_MANCHESTER_FALLING))
  602. #define IS_DFSDM_CHANNEL_SPI_CLOCK(TYPE) (((TYPE) == DFSDM_CHANNEL_SPI_CLOCK_EXTERNAL) || \
  603. ((TYPE) == DFSDM_CHANNEL_SPI_CLOCK_INTERNAL) || \
  604. ((TYPE) == DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_FALLING) || \
  605. ((TYPE) == DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_RISING))
  606. #define IS_DFSDM_CHANNEL_FILTER_ORDER(ORDER) (((ORDER) == DFSDM_CHANNEL_FASTSINC_ORDER) || \
  607. ((ORDER) == DFSDM_CHANNEL_SINC1_ORDER) || \
  608. ((ORDER) == DFSDM_CHANNEL_SINC2_ORDER) || \
  609. ((ORDER) == DFSDM_CHANNEL_SINC3_ORDER))
  610. #define IS_DFSDM_CHANNEL_FILTER_OVS_RATIO(RATIO) ((1 <= (RATIO)) && ((RATIO) <= 32))
  611. #define IS_DFSDM_CHANNEL_OFFSET(VALUE) ((-8388608 <= (VALUE)) && ((VALUE) <= 8388607))
  612. #define IS_DFSDM_CHANNEL_RIGHT_BIT_SHIFT(VALUE) ((VALUE) <= 0x1F)
  613. #define IS_DFSDM_CHANNEL_SCD_THRESHOLD(VALUE) ((VALUE) <= 0xFF)
  614. #define IS_DFSDM_FILTER_REG_TRIGGER(TRIG) (((TRIG) == DFSDM_FILTER_SW_TRIGGER) || \
  615. ((TRIG) == DFSDM_FILTER_SYNC_TRIGGER))
  616. #define IS_DFSDM_FILTER_INJ_TRIGGER(TRIG) (((TRIG) == DFSDM_FILTER_SW_TRIGGER) || \
  617. ((TRIG) == DFSDM_FILTER_SYNC_TRIGGER) || \
  618. ((TRIG) == DFSDM_FILTER_EXT_TRIGGER))
  619. #if defined(STM32L451xx) || defined(STM32L452xx) || defined(STM32L462xx)
  620. #define IS_DFSDM_FILTER_EXT_TRIG(TRIG) (((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM1_TRGO) || \
  621. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM1_TRGO2) || \
  622. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM3_TRGO) || \
  623. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM16_OC1) || \
  624. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM6_TRGO) || \
  625. ((TRIG) == DFSDM_FILTER_EXT_TRIG_EXTI11) || \
  626. ((TRIG) == DFSDM_FILTER_EXT_TRIG_EXTI15))
  627. #else
  628. #define IS_DFSDM_FILTER_EXT_TRIG(TRIG) (((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM1_TRGO) || \
  629. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM1_TRGO2) || \
  630. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM8_TRGO) || \
  631. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM8_TRGO2) || \
  632. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM3_TRGO) || \
  633. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM4_TRGO) || \
  634. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM16_OC1) || \
  635. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM6_TRGO) || \
  636. ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM7_TRGO) || \
  637. ((TRIG) == DFSDM_FILTER_EXT_TRIG_EXTI11) || \
  638. ((TRIG) == DFSDM_FILTER_EXT_TRIG_EXTI15))
  639. #endif /* STM32L451xx || STM32L452xx || STM32L462xx */
  640. #define IS_DFSDM_FILTER_EXT_TRIG_EDGE(EDGE) (((EDGE) == DFSDM_FILTER_EXT_TRIG_RISING_EDGE) || \
  641. ((EDGE) == DFSDM_FILTER_EXT_TRIG_FALLING_EDGE) || \
  642. ((EDGE) == DFSDM_FILTER_EXT_TRIG_BOTH_EDGES))
  643. #define IS_DFSDM_FILTER_SINC_ORDER(ORDER) (((ORDER) == DFSDM_FILTER_FASTSINC_ORDER) || \
  644. ((ORDER) == DFSDM_FILTER_SINC1_ORDER) || \
  645. ((ORDER) == DFSDM_FILTER_SINC2_ORDER) || \
  646. ((ORDER) == DFSDM_FILTER_SINC3_ORDER) || \
  647. ((ORDER) == DFSDM_FILTER_SINC4_ORDER) || \
  648. ((ORDER) == DFSDM_FILTER_SINC5_ORDER))
  649. #define IS_DFSDM_FILTER_OVS_RATIO(RATIO) ((1 <= (RATIO)) && ((RATIO) <= 1024))
  650. #define IS_DFSDM_FILTER_INTEGRATOR_OVS_RATIO(RATIO) ((1 <= (RATIO)) && ((RATIO) <= 256))
  651. #define IS_DFSDM_FILTER_AWD_DATA_SOURCE(DATA) (((DATA) == DFSDM_FILTER_AWD_FILTER_DATA) || \
  652. ((DATA) == DFSDM_FILTER_AWD_CHANNEL_DATA))
  653. #define IS_DFSDM_FILTER_AWD_THRESHOLD(VALUE) ((-8388608 <= (VALUE)) && ((VALUE) <= 8388607))
  654. #define IS_DFSDM_BREAK_SIGNALS(VALUE) ((VALUE) <= 0xFU)
  655. #if defined(STM32L451xx) || defined(STM32L452xx) || defined(STM32L462xx)
  656. #define IS_DFSDM_REGULAR_CHANNEL(CHANNEL) (((CHANNEL) == DFSDM_CHANNEL_0) || \
  657. ((CHANNEL) == DFSDM_CHANNEL_1) || \
  658. ((CHANNEL) == DFSDM_CHANNEL_2) || \
  659. ((CHANNEL) == DFSDM_CHANNEL_3))
  660. #define IS_DFSDM_INJECTED_CHANNEL(CHANNEL) (((CHANNEL) != 0) && ((CHANNEL) <= 0x0003000FU))
  661. #else /* STM32L451xx || STM32L452xx || STM32L462xx */
  662. #define IS_DFSDM_REGULAR_CHANNEL(CHANNEL) (((CHANNEL) == DFSDM_CHANNEL_0) || \
  663. ((CHANNEL) == DFSDM_CHANNEL_1) || \
  664. ((CHANNEL) == DFSDM_CHANNEL_2) || \
  665. ((CHANNEL) == DFSDM_CHANNEL_3) || \
  666. ((CHANNEL) == DFSDM_CHANNEL_4) || \
  667. ((CHANNEL) == DFSDM_CHANNEL_5) || \
  668. ((CHANNEL) == DFSDM_CHANNEL_6) || \
  669. ((CHANNEL) == DFSDM_CHANNEL_7))
  670. #define IS_DFSDM_INJECTED_CHANNEL(CHANNEL) (((CHANNEL) != 0) && ((CHANNEL) <= 0x000F00FFU))
  671. #endif /* STM32L451xx || STM32L452xx || STM32L462xx */
  672. #define IS_DFSDM_CONTINUOUS_MODE(MODE) (((MODE) == DFSDM_CONTINUOUS_CONV_OFF) || \
  673. ((MODE) == DFSDM_CONTINUOUS_CONV_ON))
  674. /**
  675. * @}
  676. */
  677. /* End of private macros -----------------------------------------------------*/
  678. /**
  679. * @}
  680. */
  681. /**
  682. * @}
  683. */
  684. #endif /* STM32L451xx || STM32L452xx || STM32L462xx || STM32L471xx || STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx || STM32L496xx || STM32L4A6xx */
  685. #ifdef __cplusplus
  686. }
  687. #endif
  688. #endif /* __STM32L4xx_HAL_DFSDM_H */
  689. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/