stm32f4xx_dfsdm.h 44 KB

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