stm32f4xx_dfsdm.h 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821
  1. /**
  2. ******************************************************************************
  3. * @file stm32f4xx_dfsdm.h
  4. * @author MCD Application Team
  5. * @version V1.8.1
  6. * @date 27-January-2022
  7. * @brief This file contains all the functions prototypes for the DFSDM
  8. * firmware library
  9. ******************************************************************************
  10. * @attention
  11. *
  12. * Copyright (c) 2016 STMicroelectronics.
  13. * All rights reserved.
  14. *
  15. * This software is licensed under terms that can be found in the LICENSE file
  16. * in the root directory of this software component.
  17. * If no LICENSE file comes with this software, it is provided AS-IS.
  18. *
  19. ******************************************************************************
  20. */
  21. /* Define to prevent recursive inclusion -------------------------------------*/
  22. #ifndef __STM32F4XX_DFSDM_H
  23. #define __STM32F4XX_DFSDM_H
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. #if defined(STM32F412xG) || defined(STM32F413_423xx)
  28. /* Includes ------------------------------------------------------------------*/
  29. #include "stm32f4xx.h"
  30. /** @addtogroup STM32F4xx_StdPeriph_Driver
  31. * @{
  32. */
  33. /** @addtogroup DFSDM
  34. * @{
  35. */
  36. /* Exported types ------------------------------------------------------------*/
  37. /**
  38. * @brief DFSDM Transceiver init structure definition
  39. */
  40. typedef struct
  41. {
  42. uint32_t DFSDM_Interface; /*!< Selects the serial interface type and input clock phase.
  43. This parameter can be a value of @ref DFSDM_Interface_Selection */
  44. uint32_t DFSDM_Clock; /*!< Specifies the clock source for the serial interface transceiver.
  45. This parameter can be a value of @ref DFSDM_Clock_Selection */
  46. uint32_t DFSDM_Input; /*!< Specifies the Input mode for the serial interface transceiver.
  47. This parameter can be a value of @ref DFSDM_Input_Selection */
  48. uint32_t DFSDM_Redirection; /*!< Specifies if the channel input is redirected from channel channel (y+1).
  49. This parameter can be a value of @ref DFSDM_Redirection_Selection */
  50. uint32_t DFSDM_PackingMode; /*!< Specifies the packing mode for the serial interface transceiver.
  51. This parameter can be a value of @ref DFSDM_Pack_Selection */
  52. uint32_t DFSDM_DataRightShift; /*!< Defines the final data right bit shift.
  53. This parameter can be a value between 0 and 31 */
  54. uint32_t DFSDM_Offset; /*!< Sets the calibration offset.
  55. This parameter can be a value between 0 and 0xFFFFFF */
  56. uint32_t DFSDM_CLKAbsenceDetector; /*!< Enables or disables the Clock Absence Detector.
  57. This parameter can be a value of @ref DFSDM_Clock_Absence_Detector_state */
  58. uint32_t DFSDM_ShortCircuitDetector; /*!< Enables or disables the Short Circuit Detector.
  59. This parameter can be a value of @ref DFSDM_Short_Circuit_Detector_state */
  60. }DFSDM_TransceiverInitTypeDef;
  61. /**
  62. * @brief DFSDM filter analog parameters structure definition
  63. */
  64. typedef struct
  65. {
  66. uint32_t DFSDM_SincOrder; /*!< Sets the Sinc Filter Order .
  67. This parameter can be a value of @ref DFSDM_Sinc_Order */
  68. uint32_t DFSDM_FilterOversamplingRatio; /*!< Sets the Sinc Filter Oversampling Ratio.
  69. This parameter can be a value between 1 and 1024 */
  70. uint32_t DFSDM_IntegratorOversamplingRatio;/*!< Sets the Integrator Oversampling Ratio.
  71. This parameter can be a value between 1 and 256 */
  72. }DFSDM_FilterInitTypeDef;
  73. /* Exported constants --------------------------------------------------------*/
  74. /** @defgroup DFSDM_Interface_Selection
  75. * @{
  76. */
  77. #define DFSDM_Interface_SPI_RisingEdge ((uint32_t)0x00000000) /*!< DFSDM SPI interface with rising edge to strobe data */
  78. #define DFSDM_Interface_SPI_FallingEdge ((uint32_t)0x00000001) /*!< DFSDM SPI interface with falling edge to strobe data */
  79. #define DFSDM_Interface_Manchester1 ((uint32_t)0x00000002) /*!< DFSDM Manchester coded input, rising edge = logic 0, falling edge = logic 1 */
  80. #define DFSDM_Interface_Manchester2 ((uint32_t)0x00000003) /*!< DFSDM Manchester coded input, rising edge = logic 1, falling edge = logic 0 */
  81. #define IS_DFSDM_INTERFACE(INTERFACE) (((INTERFACE) == DFSDM_Interface_SPI_RisingEdge) || \
  82. ((INTERFACE) == DFSDM_Interface_SPI_FallingEdge) || \
  83. ((INTERFACE) == DFSDM_Interface_Manchester1) || \
  84. ((INTERFACE) == DFSDM_Interface_Manchester2))
  85. /**
  86. * @}
  87. */
  88. /** @defgroup DFSDM_Clock_Selection
  89. * @{
  90. */
  91. #define DFSDM_Clock_External ((uint32_t)0x00000000) /*!< DFSDM clock coming from external DFSDM_CKINy input */
  92. #define DFSDM_Clock_Internal ((uint32_t)0x00000004) /*!< DFSDM clock coming from internal DFSDM_CKOUT output */
  93. #define DFSDM_Clock_InternalDiv2_Mode1 ((uint32_t)0x00000008) /*!< DFSDM clock coming from internal DFSDM_CKOUT output divided by 2
  94. and clock change is on every rising edge of DFSDM_CKOUT output signal */
  95. #define DFSDM_Clock_InternalDiv2_Mode2 ((uint32_t)0x0000000C) /*!< DFSDM clock coming from internal DFSDM_CKOUT output divided by 2
  96. and clock change is on every falling edge of DFSDM_CKOUT output signal */
  97. #define IS_DFSDM_CLOCK(CLOCK) (((CLOCK) == DFSDM_Clock_External) || \
  98. ((CLOCK) == DFSDM_Clock_Internal) || \
  99. ((CLOCK) == DFSDM_Clock_InternalDiv2_Mode1) || \
  100. ((CLOCK) == DFSDM_Clock_InternalDiv2_Mode2))
  101. /**
  102. * @}
  103. */
  104. /** @defgroup DFSDM_Input_Selection
  105. * @{
  106. */
  107. #define DFSDM_Input_External ((uint32_t)0x00000000) /*!< DFSDM clock coming from external DFSDM_CKINy input */
  108. #define DFSDM_Input_ADC ((uint32_t)0x00001000) /*!< DFSDM clock coming from internal DFSDM_CKOUT output */
  109. #define DFSDM_Input_Internal ((uint32_t)0x00002000) /*!< DFSDM clock coming from internal DFSDM_CKOUT output divided by 2
  110. and clock change is on every rising edge of DFSDM_CKOUT output signal */
  111. #define IS_DFSDM_Input_MODE(INPUT) (((INPUT) == DFSDM_Input_External) || \
  112. ((INPUT) == DFSDM_Input_ADC) || \
  113. ((INPUT) == DFSDM_Input_Internal))
  114. /**
  115. * @}
  116. */
  117. /** @defgroup DFSDM_Redirection_Selection
  118. * @{
  119. */
  120. #define DFSDM_Redirection_Disabled ((uint32_t)0x00000000) /*!< DFSDM Channel serial inputs are taken from pins of the same channel y */
  121. #define DFSDM_Redirection_Enabled DFSDM_CHCFGR1_CHINSEL /*!< DFSDM Channel serial inputs are taken from pins of the channel (y+1) modulo 8 */
  122. #define IS_DFSDM_Redirection_STATE(STATE) (((STATE) == DFSDM_Redirection_Disabled) || \
  123. ((STATE) == DFSDM_Redirection_Enabled))
  124. /**
  125. * @}
  126. */
  127. /** @defgroup DFSDM_Pack_Selection
  128. * @{
  129. */
  130. #define DFSDM_PackingMode_Standard ((uint32_t)0x00000000) /*!< DFSDM Input data in DFSDM_CHDATINyR register are stored only in INDAT0[15:0] */
  131. #define DFSDM_PackingMode_Interleaved ((uint32_t)0x00004000) /*!< DFSDM Input data in DFSDM_CHDATINyR register are stored as two samples:
  132. - first sample in INDAT0[15:0] - assigned to channel y
  133. - second sample INDAT1[15:0] - assigned to channel y */
  134. #define DFSDM_PackingMode_Dual ((uint32_t)0x00008000) /*!< DFSDM Input data in DFSDM_CHDATINyR register are stored as two samples:
  135. - first sample INDAT0[15:0] - assigned to channel y
  136. - second sample INDAT1[15:0] - assigned to channel (y+1) */
  137. #define IS_DFSDM_PACK_MODE(MODE) (((MODE) == DFSDM_PackingMode_Standard) || \
  138. ((MODE) == DFSDM_PackingMode_Interleaved) || \
  139. ((MODE) == DFSDM_PackingMode_Dual))
  140. /**
  141. * @}
  142. */
  143. /** @defgroup DFSDM_Clock_Absence_Detector_state
  144. * @{
  145. */
  146. #define DFSDM_CLKAbsenceDetector_Enable DFSDM_CHCFGR1_CKABEN /*!< DFSDM Clock Absence Detector is Enabled */
  147. #define DFSDM_CLKAbsenceDetector_Disable ((uint32_t)0x00000000) /*!< DFSDM Clock Absence Detector is Disabled */
  148. #define IS_DFSDM_CLK_DETECTOR_STATE(STATE) (((STATE) == DFSDM_CLKAbsenceDetector_Enable) || \
  149. ((STATE) == DFSDM_CLKAbsenceDetector_Disable))
  150. /**
  151. * @}
  152. */
  153. /** @defgroup DFSDM_Short_Circuit_Detector_state
  154. * @{
  155. */
  156. #define DFSDM_ShortCircuitDetector_Enable DFSDM_CHCFGR1_SCDEN /*!< DFSDM Short Circuit Detector is Enabled */
  157. #define DFSDM_ShortCircuitDetector_Disable ((uint32_t)0x00000000) /*!< DFSDM Short Circuit Detector is Disabled */
  158. #define IS_DFSDM_SC_DETECTOR_STATE(STATE) (((STATE) == DFSDM_ShortCircuitDetector_Enable) || \
  159. ((STATE) == DFSDM_ShortCircuitDetector_Disable))
  160. /**
  161. * @}
  162. */
  163. /** @defgroup DFSDM_Sinc_Order
  164. * @{
  165. */
  166. #define DFSDM_SincOrder_FastSinc ((uint32_t)0x00000000) /*!< DFSDM Sinc filter order = Fast sinc */
  167. #define DFSDM_SincOrder_Sinc1 ((uint32_t)0x20000000) /*!< DFSDM Sinc filter order = 1 */
  168. #define DFSDM_SincOrder_Sinc2 ((uint32_t)0x40000000) /*!< DFSDM Sinc filter order = 2 */
  169. #define DFSDM_SincOrder_Sinc3 ((uint32_t)0x60000000) /*!< DFSDM Sinc filter order = 3 */
  170. #define DFSDM_SincOrder_Sinc4 ((uint32_t)0x80000000) /*!< DFSDM Sinc filter order = 4 */
  171. #define DFSDM_SincOrder_Sinc5 ((uint32_t)0xA0000000) /*!< DFSDM Sinc filter order = 5 */
  172. #define IS_DFSDM_SINC_ORDER(ORDER) (((ORDER) == DFSDM_SincOrder_FastSinc) || \
  173. ((ORDER) == DFSDM_SincOrder_Sinc1) || \
  174. ((ORDER) == DFSDM_SincOrder_Sinc2) || \
  175. ((ORDER) == DFSDM_SincOrder_Sinc3) || \
  176. ((ORDER) == DFSDM_SincOrder_Sinc4) || \
  177. ((ORDER) == DFSDM_SincOrder_Sinc5))
  178. /**
  179. * @}
  180. */
  181. /** @defgroup DFSDM_Break_Signal_Assignment
  182. * @{
  183. */
  184. #define DFSDM_SCDBreak_0 ((uint32_t)0x00001000) /*!< DFSDM Break 0 signal assigned to short circuit detector */
  185. #define DFSDM_SCDBreak_1 ((uint32_t)0x00002000) /*!< DFSDM Break 1 signal assigned to short circuit detector */
  186. #define DFSDM_SCDBreak_2 ((uint32_t)0x00004000) /*!< DFSDM Break 2 signal assigned to short circuit detector */
  187. #define DFSDM_SCDBreak_3 ((uint32_t)0x00008000) /*!< DFSDM Break 3 signal assigned to short circuit detector */
  188. #define IS_DFSDM_SCD_BREAK_SIGNAL(RANK) (((RANK) == DFSDM_SCDBreak_0) || \
  189. ((RANK) == DFSDM_SCDBreak_1) || \
  190. ((RANK) == DFSDM_SCDBreak_2) || \
  191. ((RANK) == DFSDM_SCDBreak_3))
  192. /**
  193. * @}
  194. */
  195. /** @defgroup DFSDM_AWD_Sinc_Order
  196. * @{
  197. */
  198. #define DFSDM_AWDSincOrder_Fast ((uint32_t)0x00000000) /*!< DFSDM Fast sinc filter */
  199. #define DFSDM_AWDSincOrder_Sinc1 ((uint32_t)0x00400000) /*!< DFSDM sinc1 filter */
  200. #define DFSDM_AWDSincOrder_Sinc2 ((uint32_t)0x00800000) /*!< DFSDM sinc2 filter */
  201. #define DFSDM_AWDSincOrder_Sinc3 ((uint32_t)0x00C00000) /*!< DFSDM sinc3 filter */
  202. #define IS_DFSDM_AWD_SINC_ORDER(ORDER) (((ORDER) == DFSDM_AWDSincOrder_Fast) || \
  203. ((ORDER) == DFSDM_AWDSincOrder_Sinc1) || \
  204. ((ORDER) == DFSDM_AWDSincOrder_Sinc2) || \
  205. ((ORDER) == DFSDM_AWDSincOrder_Sinc3))
  206. /**
  207. * @}
  208. */
  209. /** @defgroup DFSDM_AWD_CHANNEL
  210. * @{
  211. */
  212. #define DFSDM_AWDChannel0 ((uint32_t)0x00010000) /*!< DFSDM AWDx guard channel 0 */
  213. #define DFSDM_AWDChannel1 ((uint32_t)0x00020000) /*!< DFSDM AWDx guard channel 1 */
  214. #define DFSDM_AWDChannel2 ((uint32_t)0x00040000) /*!< DFSDM AWDx guard channel 2 */
  215. #define DFSDM_AWDChannel3 ((uint32_t)0x00080000) /*!< DFSDM AWDx guard channel 3 */
  216. #define DFSDM_AWDChannel4 ((uint32_t)0x00100000) /*!< DFSDM AWDx guard channel 4 */
  217. #define DFSDM_AWDChannel5 ((uint32_t)0x00200000) /*!< DFSDM AWDx guard channel 5 */
  218. #define DFSDM_AWDChannel6 ((uint32_t)0x00400000) /*!< DFSDM AWDx guard channel 6 */
  219. #define DFSDM_AWDChannel7 ((uint32_t)0x00800000) /*!< DFSDM AWDx guard channel 7 */
  220. #define IS_DFSDM_AWD_CHANNEL(CHANNEL) (((CHANNEL) == DFSDM_AWDChannel0) || \
  221. ((CHANNEL) == DFSDM_AWDChannel1) || \
  222. ((CHANNEL) == DFSDM_AWDChannel2) || \
  223. ((CHANNEL) == DFSDM_AWDChannel3) || \
  224. ((CHANNEL) == DFSDM_AWDChannel4) || \
  225. ((CHANNEL) == DFSDM_AWDChannel5) || \
  226. ((CHANNEL) == DFSDM_AWDChannel6) || \
  227. ((CHANNEL) == DFSDM_AWDChannel7))
  228. /**
  229. * @}
  230. */
  231. /** @defgroup DFSDM_Threshold_Selection
  232. * @{
  233. */
  234. #define DFSDM_Threshold_Low ((uint8_t)0x00) /*!< DFSDM Low threshold */
  235. #define DFSDM_Threshold_High ((uint8_t)0x08) /*!< DFSDM High threshold */
  236. #define IS_DFSDM_Threshold(THR) (((THR) == DFSDM_Threshold_Low) || \
  237. ((THR) == DFSDM_Threshold_High))
  238. /**
  239. * @}
  240. */
  241. /** @defgroup DFSDM_AWD_Fast_Mode_Selection
  242. * @{
  243. */
  244. #define DFSDM_AWDFastMode_Disable ((uint32_t)0x00000000) /*!< DFSDM Fast mode for AWD is disabled */
  245. #define DFSDM_AWDFastMode_Enable ((uint32_t)0x40000000) /*!< DFSDM Fast mode for AWD is enabled */
  246. #define IS_DFSDM_AWD_MODE(MODE) (((MODE) == DFSDM_AWDFastMode_Disable) || \
  247. ((MODE) == DFSDM_AWDFastMode_Enable))
  248. /**
  249. * @}
  250. */
  251. /** @defgroup DFSDM_Clock_Output_Source_Selection
  252. * @{
  253. */
  254. #define DFSDM_ClkOutSource_SysClock ((uint32_t)0x00000000) /*!< DFSDM Source for output clock is comming from system clock */
  255. #define DFSDM_ClkOutSource_AudioClock DFSDM_CHCFGR1_CKOUTSRC /*!< DFSDM Source for output clock is comming from audio clock */
  256. #define IS_DFSDM_CLOCK_OUT_SOURCE(SRC) (((SRC) == DFSDM_ClkOutSource_SysClock) || \
  257. ((SRC) == DFSDM_ClkOutSource_AudioClock))
  258. /**
  259. * @}
  260. */
  261. /** @defgroup DFSDM_Conversion_Mode
  262. * @{
  263. */
  264. #define DFSDM_DMAConversionMode_Regular ((uint32_t)0x00000010) /*!< DFSDM Regular mode */
  265. #define DFSDM_DMAConversionMode_Injected ((uint32_t)0x00000000) /*!< DFSDM Injected mode */
  266. #define IS_DFSDM_CONVERSION_MODE(MODE) (((MODE) == DFSDM_DMAConversionMode_Regular) || \
  267. ((MODE) == DFSDM_DMAConversionMode_Injected))
  268. /**
  269. * @}
  270. */
  271. /** @defgroup DFSDM_Extremes_Channel_Selection
  272. * @{
  273. */
  274. #define DFSDM_ExtremChannel0 ((uint32_t)0x00000100) /*!< DFSDM Extreme detector guard channel 0 */
  275. #define DFSDM_ExtremChannel1 ((uint32_t)0x00000200) /*!< DFSDM Extreme detector guard channel 1 */
  276. #define DFSDM_ExtremChannel2 ((uint32_t)0x00000400) /*!< DFSDM Extreme detector guard channel 2 */
  277. #define DFSDM_ExtremChannel3 ((uint32_t)0x00000800) /*!< DFSDM Extreme detector guard channel 3 */
  278. #define DFSDM_ExtremChannel4 ((uint32_t)0x00001000) /*!< DFSDM Extreme detector guard channel 4 */
  279. #define DFSDM_ExtremChannel5 ((uint32_t)0x00002000) /*!< DFSDM Extreme detector guard channel 5 */
  280. #define DFSDM_ExtremChannel6 ((uint32_t)0x00004000) /*!< DFSDM Extreme detector guard channel 6 */
  281. #define DFSDM_ExtremChannel7 ((uint32_t)0x00008000) /*!< DFSDM Extreme detector guard channel 7 */
  282. #define IS_DFSDM_EXTREM_CHANNEL(CHANNEL) (((CHANNEL) == DFSDM_ExtremChannel0) || \
  283. ((CHANNEL) == DFSDM_ExtremChannel1) || \
  284. ((CHANNEL) == DFSDM_ExtremChannel2) || \
  285. ((CHANNEL) == DFSDM_ExtremChannel3) || \
  286. ((CHANNEL) == DFSDM_ExtremChannel4) || \
  287. ((CHANNEL) == DFSDM_ExtremChannel5) || \
  288. ((CHANNEL) == DFSDM_ExtremChannel6) || \
  289. ((CHANNEL) == DFSDM_ExtremChannel7))
  290. /**
  291. * @}
  292. */
  293. /** @defgroup DFSDM_Injected_Channel_Selection
  294. * @{
  295. */
  296. #define DFSDM_InjectedChannel0 ((uint32_t)0x00000001) /*!< DFSDM channel 0 is selected as injected channel */
  297. #define DFSDM_InjectedChannel1 ((uint32_t)0x00000002) /*!< DFSDM channel 1 is selected as injected channel */
  298. #define DFSDM_InjectedChannel2 ((uint32_t)0x00000004) /*!< DFSDM channel 2 is selected as injected channel */
  299. #define DFSDM_InjectedChannel3 ((uint32_t)0x00000008) /*!< DFSDM channel 3 is selected as injected channel */
  300. #define DFSDM_InjectedChannel4 ((uint32_t)0x00000010) /*!< DFSDM channel 4 is selected as injected channel */
  301. #define DFSDM_InjectedChannel5 ((uint32_t)0x00000020) /*!< DFSDM channel 5 is selected as injected channel */
  302. #define DFSDM_InjectedChannel6 ((uint32_t)0x00000040) /*!< DFSDM channel 6 is selected as injected channel */
  303. #define DFSDM_InjectedChannel7 ((uint32_t)0x00000080) /*!< DFSDM channel 7 is selected as injected channel */
  304. #define IS_DFSDM_INJECT_CHANNEL(CHANNEL) (((CHANNEL) == DFSDM_InjectedChannel0) || \
  305. ((CHANNEL) == DFSDM_InjectedChannel1) || \
  306. ((CHANNEL) == DFSDM_InjectedChannel2) || \
  307. ((CHANNEL) == DFSDM_InjectedChannel3) || \
  308. ((CHANNEL) == DFSDM_InjectedChannel4) || \
  309. ((CHANNEL) == DFSDM_InjectedChannel5) || \
  310. ((CHANNEL) == DFSDM_InjectedChannel6) || \
  311. ((CHANNEL) == DFSDM_InjectedChannel7))
  312. /**
  313. * @}
  314. */
  315. /** @defgroup DFSDM_Regular_Channel_Selection
  316. * @{
  317. */
  318. #define DFSDM_RegularChannel0 ((uint32_t)0x00000000) /*!< DFSDM channel 0 is selected as regular channel */
  319. #define DFSDM_RegularChannel1 ((uint32_t)0x01000000) /*!< DFSDM channel 1 is selected as regular channel */
  320. #define DFSDM_RegularChannel2 ((uint32_t)0x02000000) /*!< DFSDM channel 2 is selected as regular channel */
  321. #define DFSDM_RegularChannel3 ((uint32_t)0x03000000) /*!< DFSDM channel 3 is selected as regular channel */
  322. #define DFSDM_RegularChannel4 ((uint32_t)0x04000000) /*!< DFSDM channel 4 is selected as regular channel */
  323. #define DFSDM_RegularChannel5 ((uint32_t)0x05000000) /*!< DFSDM channel 5 is selected as regular channel */
  324. #define DFSDM_RegularChannel6 ((uint32_t)0x06000000) /*!< DFSDM channel 6 is selected as regular channel */
  325. #define DFSDM_RegularChannel7 ((uint32_t)0x07000000) /*!< DFSDM channel 7 is selected as regular channel */
  326. #define IS_DFSDM_REGULAR_CHANNEL(CHANNEL) (((CHANNEL) == DFSDM_RegularChannel0) || \
  327. ((CHANNEL) == DFSDM_RegularChannel1) || \
  328. ((CHANNEL) == DFSDM_RegularChannel2) || \
  329. ((CHANNEL) == DFSDM_RegularChannel3) || \
  330. ((CHANNEL) == DFSDM_RegularChannel4) || \
  331. ((CHANNEL) == DFSDM_RegularChannel5) || \
  332. ((CHANNEL) == DFSDM_RegularChannel6) || \
  333. ((CHANNEL) == DFSDM_RegularChannel7))
  334. /**
  335. * @}
  336. */
  337. /** @defgroup DFSDM_Injected_Trigger_signal
  338. * @{
  339. */
  340. #define DFSDM_Trigger_TIM1_TRGO ((uint32_t)0x00000000) /*!< DFSDM Internal trigger 0 */
  341. #define DFSDM_Trigger_TIM1_TRGO2 ((uint32_t)0x00000100) /*!< DFSDM Internal trigger 1 */
  342. #define DFSDM_Trigger_TIM8_TRGO ((uint32_t)0x00000200) /*!< DFSDM Internal trigger 2 */
  343. #define DFSDM_Trigger_TIM8_TRGO2 ((uint32_t)0x00000300) /*!< DFSDM Internal trigger 3 */
  344. #define DFSDM_Trigger_TIM3_TRGO ((uint32_t)0x00000300) /*!< DFSDM Internal trigger 4 */
  345. #define DFSDM_Trigger_TIM4_TRGO ((uint32_t)0x00000400) /*!< DFSDM Internal trigger 5 */
  346. #define DFSDM_Trigger_TIM16_OC1 ((uint32_t)0x00000400) /*!< DFSDM Internal trigger 6 */
  347. #define DFSDM_Trigger_TIM6_TRGO ((uint32_t)0x00000500) /*!< DFSDM Internal trigger 7 */
  348. #define DFSDM_Trigger_TIM7_TRGO ((uint32_t)0x00000500) /*!< DFSDM Internal trigger 8 */
  349. #define DFSDM_Trigger_EXTI11 ((uint32_t)0x00000600) /*!< DFSDM External trigger 0 */
  350. #define DFSDM_Trigger_EXTI15 ((uint32_t)0x00000700) /*!< DFSDM External trigger 1 */
  351. #define IS_DFSDM0_INJ_TRIGGER(TRIG) (((TRIG) == DFSDM_Trigger_TIM1_TRGO) || \
  352. ((TRIG) == DFSDM_Trigger_TIM1_TRGO2) || \
  353. ((TRIG) == DFSDM_Trigger_TIM8_TRGO) || \
  354. ((TRIG) == DFSDM_Trigger_TIM8_TRGO2) || \
  355. ((TRIG) == DFSDM_Trigger_TIM4_TRGO) || \
  356. ((TRIG) == DFSDM_Trigger_TIM6_TRGO) || \
  357. ((TRIG) == DFSDM_Trigger_TIM7_TRGO) || \
  358. ((TRIG) == DFSDM_Trigger_EXTI15) || \
  359. ((TRIG) == DFSDM_Trigger_TIM3_TRGO) || \
  360. ((TRIG) == DFSDM_Trigger_TIM16_OC1) || \
  361. ((TRIG) == DFSDM_Trigger_EXTI11))
  362. #define IS_DFSDM1_INJ_TRIGGER(TRIG) IS_DFSDM0_INJ_TRIGGER(TRIG)
  363. /**
  364. * @}
  365. */
  366. /** @defgroup DFSDM_Trigger_Edge_selection
  367. * @{
  368. */
  369. #define DFSDM_TriggerEdge_Disabled ((uint32_t)0x00000000) /*!< DFSDM Trigger detection disabled */
  370. #define DFSDM_TriggerEdge_Rising ((uint32_t)0x00002000) /*!< DFSDM Each rising edge makes a request to launch an injected conversion */
  371. #define DFSDM_TriggerEdge_Falling ((uint32_t)0x00004000) /*!< DFSDM Each falling edge makes a request to launch an injected conversion */
  372. #define DFSDM_TriggerEdge_BothEdges ((uint32_t)0x00006000) /*!< DFSDM Both edges make a request to launch an injected conversion */
  373. #define IS_DFSDM_TRIGGER_EDGE(EDGE) (((EDGE) == DFSDM_TriggerEdge_Disabled) || \
  374. ((EDGE) == DFSDM_TriggerEdge_Rising) || \
  375. ((EDGE) == DFSDM_TriggerEdge_Falling) || \
  376. ((EDGE) == DFSDM_TriggerEdge_BothEdges))
  377. /**
  378. * @}
  379. */
  380. /** @defgroup DFSDM_Injected_Conversion_Mode_Selection
  381. * @{
  382. */
  383. #define DFSDM_InjectConvMode_Single ((uint32_t)0x00000000) /*!< DFSDM Trigger detection disabled */
  384. #define DFSDM_InjectConvMode_Scan ((uint32_t)0x00000010) /*!< DFSDM Each rising edge makes a request to launch an injected conversion */
  385. #define IS_DFSDM_INJ_CONV_MODE(MODE) (((MODE) == DFSDM_InjectConvMode_Single) || \
  386. ((MODE) == DFSDM_InjectConvMode_Scan))
  387. /**
  388. * @}
  389. */
  390. /** @defgroup DFSDM_Interrupts_Definition
  391. * @{
  392. */
  393. #define DFSDM_IT_JEOC DFSDM_FLTCR2_JEOCIE
  394. #define DFSDM_IT_REOC DFSDM_FLTCR2_REOCIE
  395. #define DFSDM_IT_JOVR DFSDM_FLTCR2_JOVRIE
  396. #define DFSDM_IT_ROVR DFSDM_FLTCR2_ROVRIE
  397. #define DFSDM_IT_AWD DFSDM_FLTCR2_AWDIE
  398. #define DFSDM_IT_SCD DFSDM_FLTCR2_SCDIE
  399. #define DFSDM_IT_CKAB DFSDM_FLTCR2_CKABIE
  400. #define IS_DFSDM_IT(IT) (((IT) == DFSDM_IT_JEOC) || \
  401. ((IT) == DFSDM_IT_REOC) || \
  402. ((IT) == DFSDM_IT_JOVR) || \
  403. ((IT) == DFSDM_IT_ROVR) || \
  404. ((IT) == DFSDM_IT_AWD) || \
  405. ((IT) == DFSDM_IT_SCD) || \
  406. ((IT) == DFSDM_IT_CKAB))
  407. /**
  408. * @}
  409. */
  410. /** @defgroup DFSDM_Flag_Definition
  411. * @{
  412. */
  413. #define DFSDM_FLAG_JEOC DFSDM_FLTISR_JEOCF
  414. #define DFSDM_FLAG_REOC DFSDM_FLTISR_REOCF
  415. #define DFSDM_FLAG_JOVR DFSDM_FLTISR_JOVRF
  416. #define DFSDM_FLAG_ROVR DFSDM_FLTISR_ROVRF
  417. #define DFSDM_FLAG_AWD DFSDM_FLTISR_AWDF
  418. #define DFSDM_FLAG_JCIP DFSDM_FLTISR_JCIP
  419. #define DFSDM_FLAG_RCIP DFSDM_FLTISR_RCIP
  420. #define IS_DFSDM_FLAG(FLAG) (((FLAG) == DFSDM_FLAG_JEOC) || \
  421. ((FLAG) == DFSDM_FLAG_REOC) || \
  422. ((FLAG) == DFSDM_FLAG_JOVR) || \
  423. ((FLAG) == DFSDM_FLAG_ROVR) || \
  424. ((FLAG) == DFSDM_FLAG_AWD) || \
  425. ((FLAG) == DFSDM_FLAG_JCIP) || \
  426. ((FLAG) == DFSDM_FLAG_RCIP))
  427. /**
  428. * @}
  429. */
  430. /** @defgroup DFSDM_Clock_Absence_Flag_Definition
  431. * @{
  432. */
  433. #define DFSDM_FLAG_CLKAbsence_Channel0 ((uint32_t)0x00010000)
  434. #define DFSDM_FLAG_CLKAbsence_Channel1 ((uint32_t)0x00020000)
  435. #define DFSDM_FLAG_CLKAbsence_Channel2 ((uint32_t)0x00040000)
  436. #define DFSDM_FLAG_CLKAbsence_Channel3 ((uint32_t)0x00080000)
  437. #define DFSDM_FLAG_CLKAbsence_Channel4 ((uint32_t)0x00100000)
  438. #define DFSDM_FLAG_CLKAbsence_Channel5 ((uint32_t)0x00200000)
  439. #define DFSDM_FLAG_CLKAbsence_Channel6 ((uint32_t)0x00400000)
  440. #define DFSDM_FLAG_CLKAbsence_Channel7 ((uint32_t)0x00800000)
  441. #define IS_DFSDM_CLK_ABS_FLAG(FLAG) (((FLAG) == DFSDM_FLAG_CLKAbsence_Channel0) || \
  442. ((FLAG) == DFSDM_FLAG_CLKAbsence_Channel1) || \
  443. ((FLAG) == DFSDM_FLAG_CLKAbsence_Channel2) || \
  444. ((FLAG) == DFSDM_FLAG_CLKAbsence_Channel3) || \
  445. ((FLAG) == DFSDM_FLAG_CLKAbsence_Channel4) || \
  446. ((FLAG) == DFSDM_FLAG_CLKAbsence_Channel5) || \
  447. ((FLAG) == DFSDM_FLAG_CLKAbsence_Channel6) || \
  448. ((FLAG) == DFSDM_FLAG_CLKAbsence_Channel7))
  449. /**
  450. * @}
  451. */
  452. /** @defgroup DFSDM_SCD_Flag_Definition
  453. * @{
  454. */
  455. #define DFSDM_FLAG_SCD_Channel0 ((uint32_t)0x01000000)
  456. #define DFSDM_FLAG_SCD_Channel1 ((uint32_t)0x02000000)
  457. #define DFSDM_FLAG_SCD_Channel2 ((uint32_t)0x04000000)
  458. #define DFSDM_FLAG_SCD_Channel3 ((uint32_t)0x08000000)
  459. #define DFSDM_FLAG_SCD_Channel4 ((uint32_t)0x10000000)
  460. #define DFSDM_FLAG_SCD_Channel5 ((uint32_t)0x20000000)
  461. #define DFSDM_FLAG_SCD_Channel6 ((uint32_t)0x40000000)
  462. #define DFSDM_FLAG_SCD_Channel7 ((uint32_t)0x80000000)
  463. #define IS_DFSDM_SCD_FLAG(FLAG) (((FLAG) == DFSDM_FLAG_SCD_Channel0) || \
  464. ((FLAG) == DFSDM_FLAG_SCD_Channel1) || \
  465. ((FLAG) == DFSDM_FLAG_SCD_Channel2) || \
  466. ((FLAG) == DFSDM_FLAG_SCD_Channel3) || \
  467. ((FLAG) == DFSDM_FLAG_SCD_Channel4) || \
  468. ((FLAG) == DFSDM_FLAG_SCD_Channel5) || \
  469. ((FLAG) == DFSDM_FLAG_SCD_Channel6) || \
  470. ((FLAG) == DFSDM_FLAG_SCD_Channel7))
  471. /**
  472. * @}
  473. */
  474. /** @defgroup DFSDM_Clear_Flag_Definition
  475. * @{
  476. */
  477. #define DFSDM_CLEARF_JOVR DFSDM_FLTICR_CLRJOVRF
  478. #define DFSDM_CLEARF_ROVR DFSDM_FLTICR_CLRROVRF
  479. #define IS_DFSDM_CLEAR_FLAG(FLAG) (((FLAG) == DFSDM_CLEARF_JOVR) || \
  480. ((FLAG) == DFSDM_CLEARF_ROVR))
  481. /**
  482. * @}
  483. */
  484. /** @defgroup DFSDM_Clear_ClockAbs_Flag_Definition
  485. * @{
  486. */
  487. #define DFSDM_CLEARF_CLKAbsence_Channel0 ((uint32_t)0x00010000)
  488. #define DFSDM_CLEARF_CLKAbsence_Channel1 ((uint32_t)0x00020000)
  489. #define DFSDM_CLEARF_CLKAbsence_Channel2 ((uint32_t)0x00040000)
  490. #define DFSDM_CLEARF_CLKAbsence_Channel3 ((uint32_t)0x00080000)
  491. #define DFSDM_CLEARF_CLKAbsence_Channel4 ((uint32_t)0x00100000)
  492. #define DFSDM_CLEARF_CLKAbsence_Channel5 ((uint32_t)0x00200000)
  493. #define DFSDM_CLEARF_CLKAbsence_Channel6 ((uint32_t)0x00400000)
  494. #define DFSDM_CLEARF_CLKAbsence_Channel7 ((uint32_t)0x00800000)
  495. #define IS_DFSDM_CLK_ABS_CLEARF(FLAG) (((FLAG) == DFSDM_CLEARF_CLKAbsence_Channel0) || \
  496. ((FLAG) == DFSDM_CLEARF_CLKAbsence_Channel1) || \
  497. ((FLAG) == DFSDM_CLEARF_CLKAbsence_Channel2) || \
  498. ((FLAG) == DFSDM_CLEARF_CLKAbsence_Channel3) || \
  499. ((FLAG) == DFSDM_CLEARF_CLKAbsence_Channel4) || \
  500. ((FLAG) == DFSDM_CLEARF_CLKAbsence_Channel5) || \
  501. ((FLAG) == DFSDM_CLEARF_CLKAbsence_Channel6) || \
  502. ((FLAG) == DFSDM_CLEARF_CLKAbsence_Channel7))
  503. /**
  504. * @}
  505. */
  506. /** @defgroup DFSDM_Clear_Short_Circuit_Flag_Definition
  507. * @{
  508. */
  509. #define DFSDM_CLEARF_SCD_Channel0 ((uint32_t)0x01000000)
  510. #define DFSDM_CLEARF_SCD_Channel1 ((uint32_t)0x02000000)
  511. #define DFSDM_CLEARF_SCD_Channel2 ((uint32_t)0x04000000)
  512. #define DFSDM_CLEARF_SCD_Channel3 ((uint32_t)0x08000000)
  513. #define DFSDM_CLEARF_SCD_Channel4 ((uint32_t)0x10000000)
  514. #define DFSDM_CLEARF_SCD_Channel5 ((uint32_t)0x20000000)
  515. #define DFSDM_CLEARF_SCD_Channel6 ((uint32_t)0x40000000)
  516. #define DFSDM_CLEARF_SCD_Channel7 ((uint32_t)0x80000000)
  517. #define IS_DFSDM_SCD_CHANNEL_FLAG(FLAG) (((FLAG) == DFSDM_CLEARF_SCD_Channel0) || \
  518. ((FLAG) == DFSDM_CLEARF_SCD_Channel1) || \
  519. ((FLAG) == DFSDM_CLEARF_SCD_Channel2) || \
  520. ((FLAG) == DFSDM_CLEARF_SCD_Channel3) || \
  521. ((FLAG) == DFSDM_CLEARF_SCD_Channel4) || \
  522. ((FLAG) == DFSDM_CLEARF_SCD_Channel5) || \
  523. ((FLAG) == DFSDM_CLEARF_SCD_Channel6) || \
  524. ((FLAG) == DFSDM_CLEARF_SCD_Channel7))
  525. /**
  526. * @}
  527. */
  528. /** @defgroup DFSDM_Clock_Absence_Interrupt_Definition
  529. * @{
  530. */
  531. #define DFSDM_IT_CLKAbsence_Channel0 ((uint32_t)0x00010000)
  532. #define DFSDM_IT_CLKAbsence_Channel1 ((uint32_t)0x00020000)
  533. #define DFSDM_IT_CLKAbsence_Channel2 ((uint32_t)0x00040000)
  534. #define DFSDM_IT_CLKAbsence_Channel3 ((uint32_t)0x00080000)
  535. #define DFSDM_IT_CLKAbsence_Channel4 ((uint32_t)0x00100000)
  536. #define DFSDM_IT_CLKAbsence_Channel5 ((uint32_t)0x00200000)
  537. #define DFSDM_IT_CLKAbsence_Channel6 ((uint32_t)0x00400000)
  538. #define DFSDM_IT_CLKAbsence_Channel7 ((uint32_t)0x00800000)
  539. #define IS_DFSDM_CLK_ABS_IT(IT) (((IT) == DFSDM_IT_CLKAbsence_Channel0) || \
  540. ((IT) == DFSDM_IT_CLKAbsence_Channel1) || \
  541. ((IT) == DFSDM_IT_CLKAbsence_Channel2) || \
  542. ((IT) == DFSDM_IT_CLKAbsence_Channel3) || \
  543. ((IT) == DFSDM_IT_CLKAbsence_Channel4) || \
  544. ((IT) == DFSDM_IT_CLKAbsence_Channel5) || \
  545. ((IT) == DFSDM_IT_CLKAbsence_Channel6) || \
  546. ((IT) == DFSDM_IT_CLKAbsence_Channel7))
  547. /**
  548. * @}
  549. */
  550. /** @defgroup DFSDM_SCD_Interrupt_Definition
  551. * @{
  552. */
  553. #define DFSDM_IT_SCD_Channel0 ((uint32_t)0x01000000)
  554. #define DFSDM_IT_SCD_Channel1 ((uint32_t)0x02000000)
  555. #define DFSDM_IT_SCD_Channel2 ((uint32_t)0x04000000)
  556. #define DFSDM_IT_SCD_Channel3 ((uint32_t)0x08000000)
  557. #define DFSDM_IT_SCD_Channel4 ((uint32_t)0x10000000)
  558. #define DFSDM_IT_SCD_Channel5 ((uint32_t)0x20000000)
  559. #define DFSDM_IT_SCD_Channel6 ((uint32_t)0x40000000)
  560. #define DFSDM_IT_SCD_Channel7 ((uint32_t)0x80000000)
  561. #define IS_DFSDM_SCD_IT(IT) (((IT) == DFSDM_IT_SCD_Channel0) || \
  562. ((IT) == DFSDM_IT_SCD_Channel1) || \
  563. ((IT) == DFSDM_IT_SCD_Channel2) || \
  564. ((IT) == DFSDM_IT_SCD_Channel3) || \
  565. ((IT) == DFSDM_IT_SCD_Channel4) || \
  566. ((IT) == DFSDM_IT_SCD_Channel5) || \
  567. ((IT) == DFSDM_IT_SCD_Channel6) || \
  568. ((IT) == DFSDM_IT_SCD_Channel7))
  569. /**
  570. * @}
  571. */
  572. #define IS_DFSDM_DATA_RIGHT_BIT_SHIFT(SHIFT) ((SHIFT) < 0x20 )
  573. #define IS_DFSDM_OFFSET(OFFSET) ((OFFSET) < 0x01000000 )
  574. #if defined(STM32F413_423xx)
  575. #define IS_DFSDM_ALL_CHANNEL(CHANNEL) (((CHANNEL) == DFSDM1_Channel0) || \
  576. ((CHANNEL) == DFSDM1_Channel1) || \
  577. ((CHANNEL) == DFSDM1_Channel2) || \
  578. ((CHANNEL) == DFSDM1_Channel3) || \
  579. ((CHANNEL) == DFSDM2_Channel0) || \
  580. ((CHANNEL) == DFSDM2_Channel1) || \
  581. ((CHANNEL) == DFSDM2_Channel2) || \
  582. ((CHANNEL) == DFSDM2_Channel3) || \
  583. ((CHANNEL) == DFSDM2_Channel4) || \
  584. ((CHANNEL) == DFSDM2_Channel5) || \
  585. ((CHANNEL) == DFSDM2_Channel6) || \
  586. ((CHANNEL) == DFSDM2_Channel7))
  587. #define IS_DFSDM_ALL_FILTER(FILTER) (((FILTER) == DFSDM1_0) || \
  588. ((FILTER) == DFSDM1_1) || \
  589. ((FILTER) == DFSDM2_0) || \
  590. ((FILTER) == DFSDM2_1) || \
  591. ((FILTER) == DFSDM2_2) || \
  592. ((FILTER) == DFSDM2_3))
  593. #define IS_DFSDM_SYNC_FILTER(FILTER) (((FILTER) == DFSDM1_0) || \
  594. ((FILTER) == DFSDM1_1) || \
  595. ((FILTER) == DFSDM2_0) || \
  596. ((FILTER) == DFSDM2_1) || \
  597. ((FILTER) == DFSDM2_2) || \
  598. ((FILTER) == DFSDM2_3))
  599. #else
  600. #define IS_DFSDM_ALL_CHANNEL(CHANNEL) (((CHANNEL) == DFSDM1_Channel0) || \
  601. ((CHANNEL) == DFSDM1_Channel1) || \
  602. ((CHANNEL) == DFSDM1_Channel2) || \
  603. ((CHANNEL) == DFSDM1_Channel3))
  604. #define IS_DFSDM_ALL_FILTER(FILTER) (((FILTER) == DFSDM1_0) || \
  605. ((FILTER) == DFSDM1_1))
  606. #define IS_DFSDM_SYNC_FILTER(FILTER) (((FILTER) == DFSDM1_0) || \
  607. ((FILTER) == DFSDM1_1))
  608. #endif /* STM32F413_423xx */
  609. #define IS_DFSDM_SINC_OVRSMPL_RATIO(RATIO) (((RATIO) < 0x401) && ((RATIO) >= 0x001))
  610. #define IS_DFSDM_INTG_OVRSMPL_RATIO(RATIO) (((RATIO) < 0x101 ) && ((RATIO) >= 0x001))
  611. #define IS_DFSDM_CLOCK_OUT_DIVIDER(DIVIDER) ((DIVIDER) < 0x101 )
  612. #define IS_DFSDM_CSD_THRESHOLD_VALUE(VALUE) ((VALUE) < 256)
  613. #define IS_DFSDM_AWD_OVRSMPL_RATIO(RATIO) ((RATIO) < 33) && ((RATIO) >= 0x001)
  614. #define IS_DFSDM_HIGH_THRESHOLD(VALUE) ((VALUE) < 0x1000000)
  615. #define IS_DFSDM_LOW_THRESHOLD(VALUE) ((VALUE) < 0x1000000)
  616. /**
  617. * @}
  618. */
  619. /* Exported macro ------------------------------------------------------------*/
  620. /* Exported functions ------------------------------------------------------- */
  621. /* Initialization functions ***************************************************/
  622. void DFSDM_DeInit(void);
  623. void DFSDM_TransceiverInit(DFSDM_Channel_TypeDef* DFSDM_Channelx, DFSDM_TransceiverInitTypeDef* DFSDM_TransceiverInitStruct);
  624. void DFSDM_TransceiverStructInit(DFSDM_TransceiverInitTypeDef* DFSDM_TransceiverInitStruct);
  625. void DFSDM_FilterInit(DFSDM_Filter_TypeDef* DFSDMx, DFSDM_FilterInitTypeDef* DFSDM_FilterInitStruct);
  626. void DFSDM_FilterStructInit(DFSDM_FilterInitTypeDef* DFSDM_FilterInitStruct);
  627. /* Configuration functions ****************************************************/
  628. #if defined(STM32F412xG)
  629. void DFSDM_Command(FunctionalState NewState);
  630. #else /* STM32F413_423xx */
  631. void DFSDM_Cmd(uint32_t Instance, FunctionalState NewState);
  632. #endif /* STM32F412xG */
  633. void DFSDM_ChannelCmd(DFSDM_Channel_TypeDef* DFSDM_Channelx, FunctionalState NewState);
  634. void DFSDM_FilterCmd(DFSDM_Filter_TypeDef* DFSDMx, FunctionalState NewState);
  635. #if defined(STM32F412xG)
  636. void DFSDM_ConfigClkOutputDivider(uint32_t DFSDM_ClkOutDivision);
  637. void DFSDM_ConfigClkOutputSource(uint32_t DFSDM_ClkOutSource);
  638. #else
  639. void DFSDM_ConfigClkOutputDivider(uint32_t Instance, uint32_t DFSDM_ClkOutDivision);
  640. void DFSDM_ConfigClkOutputSource(uint32_t Instance, uint32_t DFSDM_ClkOutSource);
  641. #endif /* STM32F412xG */
  642. void DFSDM_SelectInjectedConversionMode(DFSDM_Filter_TypeDef* DFSDMx, uint32_t DFSDM_InjectConvMode);
  643. void DFSDM_SelectInjectedChannel(DFSDM_Filter_TypeDef* DFSDMx, uint32_t DFSDM_InjectedChannelx);
  644. void DFSDM_SelectRegularChannel(DFSDM_Filter_TypeDef* DFSDMx, uint32_t DFSDM_RegularChannelx);
  645. void DFSDM_StartSoftwareInjectedConversion(DFSDM_Filter_TypeDef* DFSDMx);
  646. void DFSDM_StartSoftwareRegularConversion(DFSDM_Filter_TypeDef* DFSDMx);
  647. void DFSDM_SynchronousFilter0InjectedStart(DFSDM_Filter_TypeDef* DFSDMx);
  648. void DFSDM_SynchronousFilter0RegularStart(DFSDM_Filter_TypeDef* DFSDMx);
  649. void DFSDM_RegularContinuousModeCmd(DFSDM_Filter_TypeDef* DFSDMx, FunctionalState NewState);
  650. void DFSDM_InjectedContinuousModeCmd(DFSDM_Filter_TypeDef* DFSDMx, FunctionalState NewState);
  651. void DFSDM_FastModeCmd(DFSDM_Filter_TypeDef* DFSDMx, FunctionalState NewState);
  652. void DFSDM_ConfigInjectedTrigger(DFSDM_Filter_TypeDef* DFSDMx, uint32_t DFSDM_Trigger, uint32_t DFSDM_TriggerEdge);
  653. void DFSDM_ConfigBRKShortCircuitDetector(DFSDM_Channel_TypeDef* DFSDM_Channelx, uint32_t DFSDM_SCDBreak_i, FunctionalState NewState);
  654. void DFSDM_ConfigBRKAnalogWatchDog(DFSDM_Channel_TypeDef* DFSDM_Channelx, uint32_t DFSDM_SCDBreak_i, FunctionalState NewState);
  655. void DFSDM_ConfigShortCircuitThreshold(DFSDM_Channel_TypeDef* DFSDM_Channelx, uint32_t DFSDM_SCDThreshold);
  656. void DFSDM_ConfigAnalogWatchdog(DFSDM_Filter_TypeDef* DFSDMx, uint32_t DFSDM_AWDChannelx, uint32_t DFSDM_AWDFastMode);
  657. void DFSDM_ConfigAWDFilter(DFSDM_Channel_TypeDef* DFSDM_Channelx, uint32_t DFSDM_AWDSincOrder, uint32_t DFSDM_AWDSincOverSampleRatio);
  658. uint32_t DFSDM_GetAWDConversionValue(DFSDM_Channel_TypeDef* DFSDM_Channelx);
  659. void DFSDM_SetAWDThreshold(DFSDM_Filter_TypeDef* DFSDMx, uint32_t DFSDM_HighThreshold, uint32_t DFSDM_LowThreshold);
  660. void DFSDM_SelectExtremesDetectorChannel(DFSDM_Filter_TypeDef* DFSDMx, uint32_t DFSDM_ExtremChannelx);
  661. int32_t DFSDM_GetRegularConversionData(DFSDM_Filter_TypeDef* DFSDMx);
  662. int32_t DFSDM_GetInjectedConversionData(DFSDM_Filter_TypeDef* DFSDMx);
  663. int32_t DFSDM_GetMaxValue(DFSDM_Filter_TypeDef* DFSDMx);
  664. int32_t DFSDM_GetMinValue(DFSDM_Filter_TypeDef* DFSDMx);
  665. int32_t DFSDM_GetMaxValueChannel(DFSDM_Filter_TypeDef* DFSDMx);
  666. int32_t DFSDM_GetMinValueChannel(DFSDM_Filter_TypeDef* DFSDMx);
  667. uint32_t DFSDM_GetConversionTime(DFSDM_Filter_TypeDef* DFSDMx);
  668. void DFSDM_DMATransferConfig(DFSDM_Filter_TypeDef* DFSDMx, uint32_t DFSDM_DMAConversionMode, FunctionalState NewState);
  669. /* Interrupts and flags management functions **********************************/
  670. void DFSDM_ITConfig(DFSDM_Filter_TypeDef* DFSDMx, uint32_t DFSDM_IT, FunctionalState NewState);
  671. #if defined(STM32F412xG)
  672. void DFSDM_ITClockAbsenceCmd(FunctionalState NewState);
  673. void DFSDM_ITShortCircuitDetectorCmd(FunctionalState NewState);
  674. #else /* STM32F413_423xx */
  675. void DFSDM_ITClockAbsenceCmd(uint32_t Instance, FunctionalState NewState);
  676. void DFSDM_ITShortCircuitDetectorCmd(uint32_t Instance, FunctionalState NewState);
  677. #endif /* STM32F412xG */
  678. FlagStatus DFSDM_GetFlagStatus(DFSDM_Filter_TypeDef* DFSDMx, uint32_t DFSDM_FLAG);
  679. #if defined(STM32F412xG)
  680. FlagStatus DFSDM_GetClockAbsenceFlagStatus(uint32_t DFSDM_FLAG_CLKAbsence);
  681. FlagStatus DFSDM_GetShortCircuitFlagStatus(uint32_t DFSDM_FLAG_SCD);
  682. #else /* STM32F413_423xx */
  683. FlagStatus DFSDM_GetClockAbsenceFlagStatus(uint32_t Instance, uint32_t DFSDM_FLAG_CLKAbsence);
  684. FlagStatus DFSDM_GetShortCircuitFlagStatus(uint32_t Instance, uint32_t DFSDM_FLAG_SCD);
  685. #endif /* STM32F412xG */
  686. FlagStatus DFSDM_GetWatchdogFlagStatus(DFSDM_Filter_TypeDef* DFSDMx, uint32_t DFSDM_AWDChannelx, uint8_t DFSDM_Threshold);
  687. void DFSDM_ClearFlag(DFSDM_Filter_TypeDef* DFSDMx, uint32_t DFSDM_CLEARF);
  688. #if defined(STM32F412xG)
  689. void DFSDM_ClearClockAbsenceFlag(uint32_t DFSDM_CLEARF_CLKAbsence);
  690. void DFSDM_ClearShortCircuitFlag(uint32_t DFSDM_CLEARF_SCD);
  691. #else /* STM32F413_423xx */
  692. void DFSDM_ClearClockAbsenceFlag(uint32_t Instance, uint32_t DFSDM_CLEARF_CLKAbsence);
  693. void DFSDM_ClearShortCircuitFlag(uint32_t Instance, uint32_t DFSDM_CLEARF_SCD);
  694. #endif /* STM32F412xG */
  695. void DFSDM_ClearAnalogWatchdogFlag(DFSDM_Filter_TypeDef* DFSDMx, uint32_t DFSDM_AWDChannelx, uint8_t DFSDM_Threshold);
  696. ITStatus DFSDM_GetITStatus(DFSDM_Filter_TypeDef* DFSDMx, uint32_t DFSDM_IT);
  697. #if defined(STM32F412xG)
  698. ITStatus DFSDM_GetClockAbsenceITStatus(uint32_t DFSDM_IT_CLKAbsence);
  699. ITStatus DFSDM_GetShortCircuitITStatus(uint32_t DFSDM_IT_SCR);
  700. #else /* STM32F413_423xx */
  701. ITStatus DFSDM_GetClockAbsenceITStatus(uint32_t Instance, uint32_t DFSDM_IT_CLKAbsence);
  702. ITStatus DFSDM_GetShortCircuitITStatus(uint32_t Instance, uint32_t DFSDM_IT_SCR);
  703. #endif /* STM32F412xG */
  704. #endif /* STM32F412xG || STM32F413_423xx */
  705. #ifdef __cplusplus
  706. }
  707. #endif
  708. #endif /*__STM32F4XX_DFSDM_H */
  709. /**
  710. * @}
  711. */
  712. /**
  713. * @}
  714. */