STM32H735xx HAL User Manual
stm32h7xx_hal_dfsdm.h
Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32h7xx_hal_dfsdm.h
00004   * @author  MCD Application Team
00005   * @brief   Header file of DFSDM HAL module.
00006   ******************************************************************************
00007   * @attention
00008   *
00009   * Copyright (c) 2017 STMicroelectronics.
00010   * All rights reserved.
00011   *
00012   * This software is licensed under terms that can be found in the LICENSE file
00013   * in the root directory of this software component.
00014   * If no LICENSE file comes with this software, it is provided AS-IS.
00015   *
00016   ******************************************************************************
00017   */
00018 
00019 /* Define to prevent recursive inclusion -------------------------------------*/
00020 #ifndef STM32H7xx_HAL_DFSDM_H
00021 #define STM32H7xx_HAL_DFSDM_H
00022 
00023 #ifdef __cplusplus
00024  extern "C" {
00025 #endif
00026 
00027 /* Includes ------------------------------------------------------------------*/
00028 #include "stm32h7xx_hal_def.h"
00029 
00030 /** @addtogroup STM32H7xx_HAL_Driver
00031   * @{
00032   */
00033 
00034 /** @addtogroup DFSDM
00035   * @{
00036   */
00037 
00038 /* Exported types ------------------------------------------------------------*/
00039 /** @defgroup DFSDM_Exported_Types DFSDM Exported Types
00040   * @{
00041   */
00042 
00043 /**
00044   * @brief  HAL DFSDM Channel states definition
00045   */
00046 typedef enum
00047 {
00048   HAL_DFSDM_CHANNEL_STATE_RESET = 0x00U, /*!< DFSDM channel not initialized */
00049   HAL_DFSDM_CHANNEL_STATE_READY = 0x01U, /*!< DFSDM channel initialized and ready for use */
00050   HAL_DFSDM_CHANNEL_STATE_ERROR = 0xFFU  /*!< DFSDM channel state error */
00051 } HAL_DFSDM_Channel_StateTypeDef;
00052 
00053 /**
00054   * @brief  DFSDM channel output clock structure definition
00055   */
00056 typedef struct
00057 {
00058   FunctionalState Activation; /*!< Output clock enable/disable */
00059   uint32_t        Selection;  /*!< Output clock is system clock or audio clock.
00060                                    This parameter can be a value of @ref DFSDM_Channel_OuputClock */
00061   uint32_t        Divider;    /*!< Output clock divider.
00062                                    This parameter must be a number between Min_Data = 2 and Max_Data = 256 */
00063 } DFSDM_Channel_OutputClockTypeDef;
00064 
00065 /**
00066   * @brief  DFSDM channel input structure definition
00067   */
00068 typedef struct
00069 {
00070   uint32_t Multiplexer; /*!< Input is external serial inputs, internal register or ADC output.
00071                              This parameter can be a value of @ref DFSDM_Channel_InputMultiplexer */
00072   uint32_t DataPacking; /*!< Standard, interleaved or dual mode for internal register.
00073                              This parameter can be a value of @ref DFSDM_Channel_DataPacking */
00074   uint32_t Pins;        /*!< Input pins are taken from same or following channel.
00075                              This parameter can be a value of @ref DFSDM_Channel_InputPins */
00076 } DFSDM_Channel_InputTypeDef;
00077 
00078 /**
00079   * @brief  DFSDM channel serial interface structure definition
00080   */
00081 typedef struct
00082 {
00083   uint32_t Type;     /*!< SPI or Manchester modes.
00084                           This parameter can be a value of @ref DFSDM_Channel_SerialInterfaceType */
00085   uint32_t SpiClock; /*!< SPI clock select (external or internal with different sampling point).
00086                           This parameter can be a value of @ref DFSDM_Channel_SpiClock */
00087 } DFSDM_Channel_SerialInterfaceTypeDef;
00088 
00089 /**
00090   * @brief  DFSDM channel analog watchdog structure definition
00091   */
00092 typedef struct
00093 {
00094   uint32_t FilterOrder;  /*!< Analog watchdog Sinc filter order.
00095                               This parameter can be a value of @ref DFSDM_Channel_AwdFilterOrder */
00096   uint32_t Oversampling; /*!< Analog watchdog filter oversampling ratio.
00097                               This parameter must be a number between Min_Data = 1 and Max_Data = 32 */
00098 } DFSDM_Channel_AwdTypeDef;
00099 
00100 /**
00101   * @brief  DFSDM channel init structure definition
00102   */
00103 typedef struct
00104 {
00105   DFSDM_Channel_OutputClockTypeDef     OutputClock;     /*!< DFSDM channel output clock parameters */
00106   DFSDM_Channel_InputTypeDef           Input;           /*!< DFSDM channel input parameters */
00107   DFSDM_Channel_SerialInterfaceTypeDef SerialInterface; /*!< DFSDM channel serial interface parameters */
00108   DFSDM_Channel_AwdTypeDef             Awd;             /*!< DFSDM channel analog watchdog parameters */
00109   int32_t                              Offset;          /*!< DFSDM channel offset.
00110                                                              This parameter must be a number between Min_Data = -8388608 and Max_Data = 8388607 */
00111   uint32_t                             RightBitShift;   /*!< DFSDM channel right bit shift.
00112                                                              This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x1F */
00113 } DFSDM_Channel_InitTypeDef;
00114 
00115 /**
00116   * @brief  DFSDM channel handle structure definition
00117   */
00118 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
00119 typedef struct __DFSDM_Channel_HandleTypeDef
00120 #else
00121 typedef struct
00122 #endif /* USE_HAL_DFSDM_REGISTER_CALLBACKS */
00123 {
00124   DFSDM_Channel_TypeDef          *Instance; /*!< DFSDM channel instance */
00125   DFSDM_Channel_InitTypeDef      Init;      /*!< DFSDM channel init parameters */
00126   HAL_DFSDM_Channel_StateTypeDef State;     /*!< DFSDM channel state */
00127 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
00128   void (*CkabCallback)      (struct __DFSDM_Channel_HandleTypeDef *hdfsdm_channel); /*!< DFSDM channel clock absence detection callback */
00129   void (*ScdCallback)       (struct __DFSDM_Channel_HandleTypeDef *hdfsdm_channel); /*!< DFSDM channel short circuit detection callback */
00130   void (*MspInitCallback)   (struct __DFSDM_Channel_HandleTypeDef *hdfsdm_channel); /*!< DFSDM channel MSP init callback */
00131   void (*MspDeInitCallback) (struct __DFSDM_Channel_HandleTypeDef *hdfsdm_channel); /*!< DFSDM channel MSP de-init callback */
00132 #endif
00133 } DFSDM_Channel_HandleTypeDef;
00134 
00135 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
00136 /**
00137   * @brief  DFSDM channel callback ID enumeration definition
00138   */
00139 typedef enum
00140 {
00141   HAL_DFSDM_CHANNEL_CKAB_CB_ID      = 0x00U, /*!< DFSDM channel clock absence detection callback ID */
00142   HAL_DFSDM_CHANNEL_SCD_CB_ID       = 0x01U, /*!< DFSDM channel short circuit detection callback ID */
00143   HAL_DFSDM_CHANNEL_MSPINIT_CB_ID   = 0x02U, /*!< DFSDM channel MSP init callback ID */
00144   HAL_DFSDM_CHANNEL_MSPDEINIT_CB_ID = 0x03U  /*!< DFSDM channel MSP de-init callback ID */
00145 } HAL_DFSDM_Channel_CallbackIDTypeDef;
00146 
00147 /**
00148   * @brief  DFSDM channel callback pointer definition
00149   */
00150 typedef void (*pDFSDM_Channel_CallbackTypeDef)(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
00151 #endif
00152 
00153 /**
00154   * @brief  HAL DFSDM Filter states definition
00155   */
00156 typedef enum
00157 {
00158   HAL_DFSDM_FILTER_STATE_RESET   = 0x00U, /*!< DFSDM filter not initialized */
00159   HAL_DFSDM_FILTER_STATE_READY   = 0x01U, /*!< DFSDM filter initialized and ready for use */
00160   HAL_DFSDM_FILTER_STATE_REG     = 0x02U, /*!< DFSDM filter regular conversion in progress */
00161   HAL_DFSDM_FILTER_STATE_INJ     = 0x03U, /*!< DFSDM filter injected conversion in progress */
00162   HAL_DFSDM_FILTER_STATE_REG_INJ = 0x04U, /*!< DFSDM filter regular and injected conversions in progress */
00163   HAL_DFSDM_FILTER_STATE_ERROR   = 0xFFU  /*!< DFSDM filter state error */
00164 } HAL_DFSDM_Filter_StateTypeDef;
00165 
00166 /**
00167   * @brief  DFSDM filter regular conversion parameters structure definition
00168   */
00169 typedef struct
00170 {
00171   uint32_t        Trigger;  /*!< Trigger used to start regular conversion: software or synchronous.
00172                                  This parameter can be a value of @ref DFSDM_Filter_Trigger */
00173   FunctionalState FastMode; /*!< Enable/disable fast mode for regular conversion */
00174   FunctionalState DmaMode;  /*!< Enable/disable DMA for regular conversion */
00175 } DFSDM_Filter_RegularParamTypeDef;
00176 
00177 /**
00178   * @brief  DFSDM filter injected conversion parameters structure definition
00179   */
00180 typedef struct
00181 {
00182   uint32_t        Trigger;        /*!< Trigger used to start injected conversion: software, external or synchronous.
00183                                        This parameter can be a value of @ref DFSDM_Filter_Trigger */
00184   FunctionalState ScanMode;       /*!< Enable/disable scanning mode for injected conversion */
00185   FunctionalState DmaMode;        /*!< Enable/disable DMA for injected conversion */
00186   uint32_t        ExtTrigger;     /*!< External trigger.
00187                                        This parameter can be a value of @ref DFSDM_Filter_ExtTrigger */
00188   uint32_t        ExtTriggerEdge; /*!< External trigger edge: rising, falling or both.
00189                                        This parameter can be a value of @ref DFSDM_Filter_ExtTriggerEdge */
00190 } DFSDM_Filter_InjectedParamTypeDef;
00191 
00192 /**
00193   * @brief  DFSDM filter parameters structure definition
00194   */
00195 typedef struct
00196 {
00197   uint32_t SincOrder;       /*!< Sinc filter order.
00198                                  This parameter can be a value of @ref DFSDM_Filter_SincOrder */
00199   uint32_t Oversampling;    /*!< Filter oversampling ratio.
00200                                  This parameter must be a number between Min_Data = 1 and Max_Data = 1024 */
00201   uint32_t IntOversampling; /*!< Integrator oversampling ratio.
00202                                  This parameter must be a number between Min_Data = 1 and Max_Data = 256 */
00203 } DFSDM_Filter_FilterParamTypeDef;
00204 
00205 /**
00206   * @brief  DFSDM filter init structure definition
00207   */
00208 typedef struct
00209 {
00210   DFSDM_Filter_RegularParamTypeDef  RegularParam;  /*!< DFSDM regular conversion parameters */
00211   DFSDM_Filter_InjectedParamTypeDef InjectedParam; /*!< DFSDM injected conversion parameters */
00212   DFSDM_Filter_FilterParamTypeDef   FilterParam;   /*!< DFSDM filter parameters */
00213 } DFSDM_Filter_InitTypeDef;
00214 
00215 /**
00216   * @brief  DFSDM filter handle structure definition
00217   */
00218 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
00219 typedef struct __DFSDM_Filter_HandleTypeDef
00220 #else
00221 typedef struct
00222 #endif /* USE_HAL_DFSDM_REGISTER_CALLBACKS */
00223 {
00224   DFSDM_Filter_TypeDef          *Instance;           /*!< DFSDM filter instance */
00225   DFSDM_Filter_InitTypeDef      Init;                /*!< DFSDM filter init parameters */
00226   DMA_HandleTypeDef             *hdmaReg;            /*!< Pointer on DMA handler for regular conversions */
00227   DMA_HandleTypeDef             *hdmaInj;            /*!< Pointer on DMA handler for injected conversions */
00228   uint32_t                      RegularContMode;     /*!< Regular conversion continuous mode */
00229   uint32_t                      RegularTrigger;      /*!< Trigger used for regular conversion */
00230   uint32_t                      InjectedTrigger;     /*!< Trigger used for injected conversion */
00231   uint32_t                      ExtTriggerEdge;      /*!< Rising, falling or both edges selected */
00232   FunctionalState               InjectedScanMode;    /*!< Injected scanning mode */
00233   uint32_t                      InjectedChannelsNbr; /*!< Number of channels in injected sequence */
00234   uint32_t                      InjConvRemaining;    /*!< Injected conversions remaining */
00235   HAL_DFSDM_Filter_StateTypeDef State;               /*!< DFSDM filter state */
00236   uint32_t                      ErrorCode;           /*!< DFSDM filter error code */
00237 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
00238   void (*AwdCallback)             (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
00239                       uint32_t Channel, uint32_t Threshold);                            /*!< DFSDM filter analog watchdog callback */
00240   void (*RegConvCpltCallback)     (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter); /*!< DFSDM filter regular conversion complete callback */
00241   void (*RegConvHalfCpltCallback) (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter); /*!< DFSDM filter half regular conversion complete callback */
00242   void (*InjConvCpltCallback)     (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter); /*!< DFSDM filter injected conversion complete callback */
00243   void (*InjConvHalfCpltCallback) (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter); /*!< DFSDM filter half injected conversion complete callback */
00244   void (*ErrorCallback)           (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter); /*!< DFSDM filter error callback */
00245   void (*MspInitCallback)         (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter); /*!< DFSDM filter MSP init callback */
00246   void (*MspDeInitCallback)       (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter); /*!< DFSDM filter MSP de-init callback */
00247 #endif
00248 }DFSDM_Filter_HandleTypeDef;
00249 
00250 /**
00251   * @brief  DFSDM filter analog watchdog parameters structure definition
00252   */
00253 typedef struct
00254 {
00255   uint32_t DataSource;      /*!< Values from digital filter or from channel watchdog filter.
00256                                  This parameter can be a value of @ref DFSDM_Filter_AwdDataSource */
00257   uint32_t Channel;         /*!< Analog watchdog channel selection.
00258                                  This parameter can be a values combination of @ref DFSDM_Channel_Selection */
00259   int32_t  HighThreshold;   /*!< High threshold for the analog watchdog.
00260                                  This parameter must be a number between Min_Data = -8388608 and Max_Data = 8388607 */
00261   int32_t  LowThreshold;    /*!< Low threshold for the analog watchdog.
00262                                  This parameter must be a number between Min_Data = -8388608 and Max_Data = 8388607 */
00263   uint32_t HighBreakSignal; /*!< Break signal assigned to analog watchdog high threshold event.
00264                                  This parameter can be a values combination of @ref DFSDM_BreakSignals */
00265   uint32_t LowBreakSignal;  /*!< Break signal assigned to analog watchdog low threshold event.
00266                                  This parameter can be a values combination of @ref DFSDM_BreakSignals */
00267 } DFSDM_Filter_AwdParamTypeDef;
00268 
00269 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
00270 /**
00271   * @brief  DFSDM filter callback ID enumeration definition
00272   */
00273 typedef enum
00274 {
00275   HAL_DFSDM_FILTER_REGCONV_COMPLETE_CB_ID     = 0x00U, /*!< DFSDM filter regular conversion complete callback ID */
00276   HAL_DFSDM_FILTER_REGCONV_HALFCOMPLETE_CB_ID = 0x01U, /*!< DFSDM filter half regular conversion complete callback ID */
00277   HAL_DFSDM_FILTER_INJCONV_COMPLETE_CB_ID     = 0x02U, /*!< DFSDM filter injected conversion complete callback ID */
00278   HAL_DFSDM_FILTER_INJCONV_HALFCOMPLETE_CB_ID = 0x03U, /*!< DFSDM filter half injected conversion complete callback ID */
00279   HAL_DFSDM_FILTER_ERROR_CB_ID                = 0x04U, /*!< DFSDM filter error callback ID */
00280   HAL_DFSDM_FILTER_MSPINIT_CB_ID              = 0x05U, /*!< DFSDM filter MSP init callback ID */
00281   HAL_DFSDM_FILTER_MSPDEINIT_CB_ID            = 0x06U  /*!< DFSDM filter MSP de-init callback ID */
00282 } HAL_DFSDM_Filter_CallbackIDTypeDef;
00283 
00284 /**
00285   * @brief  DFSDM filter callback pointer definition
00286   */
00287 typedef void (*pDFSDM_Filter_CallbackTypeDef)(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
00288 typedef void (*pDFSDM_Filter_AwdCallbackTypeDef)(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Channel, uint32_t Threshold);
00289 #endif
00290 
00291 /**
00292   * @}
00293   */
00294 /* End of exported types -----------------------------------------------------*/
00295 
00296 /* Exported constants --------------------------------------------------------*/
00297 /** @defgroup DFSDM_Exported_Constants DFSDM Exported Constants
00298   * @{
00299   */
00300 
00301 /** @defgroup DFSDM_Channel_OuputClock DFSDM channel output clock selection
00302   * @{
00303   */
00304 #define DFSDM_CHANNEL_OUTPUT_CLOCK_SYSTEM    0x00000000U             /*!< Source for output clock is system clock */
00305 #define DFSDM_CHANNEL_OUTPUT_CLOCK_AUDIO     DFSDM_CHCFGR1_CKOUTSRC  /*!< Source for output clock is audio clock */
00306 /**
00307   * @}
00308   */
00309 
00310 /** @defgroup DFSDM_Channel_InputMultiplexer DFSDM channel input multiplexer
00311   * @{
00312   */
00313 #define DFSDM_CHANNEL_EXTERNAL_INPUTS    0x00000000U             /*!< Data are taken from external inputs */
00314 #define DFSDM_CHANNEL_ADC_OUTPUT         DFSDM_CHCFGR1_DATMPX_0  /*!< Data are taken from ADC output */
00315 #define DFSDM_CHANNEL_INTERNAL_REGISTER  DFSDM_CHCFGR1_DATMPX_1  /*!< Data are taken from internal register */
00316 /**
00317   * @}
00318   */
00319 
00320 /** @defgroup DFSDM_Channel_DataPacking DFSDM channel input data packing
00321   * @{
00322   */
00323 #define DFSDM_CHANNEL_STANDARD_MODE         0x00000000U             /*!< Standard data packing mode */
00324 #define DFSDM_CHANNEL_INTERLEAVED_MODE      DFSDM_CHCFGR1_DATPACK_0 /*!< Interleaved data packing mode */
00325 #define DFSDM_CHANNEL_DUAL_MODE             DFSDM_CHCFGR1_DATPACK_1 /*!< Dual data packing mode */
00326 /**
00327   * @}
00328   */
00329 
00330 /** @defgroup DFSDM_Channel_InputPins DFSDM channel input pins
00331   * @{
00332   */
00333 #define DFSDM_CHANNEL_SAME_CHANNEL_PINS      0x00000000U             /*!< Input from pins on same channel */
00334 #define DFSDM_CHANNEL_FOLLOWING_CHANNEL_PINS DFSDM_CHCFGR1_CHINSEL   /*!< Input from pins on following channel */
00335 /**
00336   * @}
00337   */
00338 
00339 /** @defgroup DFSDM_Channel_SerialInterfaceType DFSDM channel serial interface type
00340   * @{
00341   */
00342 #define DFSDM_CHANNEL_SPI_RISING         0x00000000U             /*!< SPI with rising edge */
00343 #define DFSDM_CHANNEL_SPI_FALLING        DFSDM_CHCFGR1_SITP_0    /*!< SPI with falling edge */
00344 #define DFSDM_CHANNEL_MANCHESTER_RISING  DFSDM_CHCFGR1_SITP_1    /*!< Manchester with rising edge */
00345 #define DFSDM_CHANNEL_MANCHESTER_FALLING DFSDM_CHCFGR1_SITP      /*!< Manchester with falling edge */
00346 /**
00347   * @}
00348   */
00349 
00350 /** @defgroup DFSDM_Channel_SpiClock DFSDM channel SPI clock selection
00351   * @{
00352   */
00353 #define DFSDM_CHANNEL_SPI_CLOCK_EXTERNAL              0x00000000U              /*!< External SPI clock */
00354 #define DFSDM_CHANNEL_SPI_CLOCK_INTERNAL              DFSDM_CHCFGR1_SPICKSEL_0 /*!< Internal SPI clock */
00355 #define DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_FALLING DFSDM_CHCFGR1_SPICKSEL_1 /*!< Internal SPI clock divided by 2, falling edge */
00356 #define DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_RISING  DFSDM_CHCFGR1_SPICKSEL   /*!< Internal SPI clock divided by 2, rising edge */
00357 /**
00358   * @}
00359   */
00360 
00361 /** @defgroup DFSDM_Channel_AwdFilterOrder DFSDM channel analog watchdog filter order
00362   * @{
00363   */
00364 #define DFSDM_CHANNEL_FASTSINC_ORDER 0x00000000U             /*!< FastSinc filter type */
00365 #define DFSDM_CHANNEL_SINC1_ORDER    DFSDM_CHAWSCDR_AWFORD_0 /*!< Sinc 1 filter type */
00366 #define DFSDM_CHANNEL_SINC2_ORDER    DFSDM_CHAWSCDR_AWFORD_1 /*!< Sinc 2 filter type */
00367 #define DFSDM_CHANNEL_SINC3_ORDER    DFSDM_CHAWSCDR_AWFORD   /*!< Sinc 3 filter type */
00368 /**
00369   * @}
00370   */
00371 
00372 /** @defgroup DFSDM_Filter_Trigger DFSDM filter conversion trigger
00373   * @{
00374   */
00375 #define DFSDM_FILTER_SW_TRIGGER   0x00000000U /*!< Software trigger */
00376 #define DFSDM_FILTER_SYNC_TRIGGER 0x00000001U /*!< Synchronous with DFSDM_FLT0 */
00377 #define DFSDM_FILTER_EXT_TRIGGER  0x00000002U /*!< External trigger (only for injected conversion) */
00378 /**
00379   * @}
00380   */
00381 
00382 /** @defgroup DFSDM_Filter_ExtTrigger DFSDM filter external trigger
00383   * @{
00384   */
00385 #define DFSDM_FILTER_EXT_TRIG_TIM1_TRGO      0x00000000U                                       /*!< For all DFSDM filters */
00386 #define DFSDM_FILTER_EXT_TRIG_TIM1_TRGO2     DFSDM_FLTCR1_JEXTSEL_0                            /*!< For all DFSDM filters */
00387 #define DFSDM_FILTER_EXT_TRIG_TIM8_TRGO      DFSDM_FLTCR1_JEXTSEL_1                            /*!< For all DFSDM filters */
00388 #define DFSDM_FILTER_EXT_TRIG_TIM8_TRGO2     (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_1) /*!< For all DFSDM filters */
00389 #define DFSDM_FILTER_EXT_TRIG_TIM3_TRGO      DFSDM_FLTCR1_JEXTSEL_2                            /*!< For all DFSDM filters */
00390 #define DFSDM_FILTER_EXT_TRIG_TIM4_TRGO      (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_2) /*!< For all DFSDM filters */
00391 #define DFSDM_FILTER_EXT_TRIG_TIM16_OC1       (DFSDM_FLTCR1_JEXTSEL_2 | DFSDM_FLTCR1_JEXTSEL_1)                        /*!< For all DFSDM filters */
00392 #define DFSDM_FILTER_EXT_TRIG_TIM6_TRGO       (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_2 | DFSDM_FLTCR1_JEXTSEL_1) /*!< For all DFSDM filters */
00393 #define DFSDM_FILTER_EXT_TRIG_TIM7_TRGO      DFSDM_FLTCR1_JEXTSEL_3                            /*!< For all DFSDM filters */
00394 #define DFSDM_FILTER_EXT_TRIG_HRTIM1_ADCTRG1  (DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_0)
00395 #define DFSDM_FILTER_EXT_TRIG_HRTIM1_ADCTRG3  (DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_1)
00396 #define DFSDM_FILTER_EXT_TRIG_EXTI11          (DFSDM_FLTCR1_JEXTSEL_4 | DFSDM_FLTCR1_JEXTSEL_3) /*!< For all DFSDM filters */
00397 #define DFSDM_FILTER_EXT_TRIG_EXTI15          (DFSDM_FLTCR1_JEXTSEL_4 | DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_0)                           /*!< For all DFSDM filters */
00398 #define DFSDM_FILTER_EXT_TRIG_LPTIM1_OUT      (DFSDM_FLTCR1_JEXTSEL_4 | DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_1)                           /*!< For all DFSDM filters */
00399 #define DFSDM_FILTER_EXT_TRIG_LPTIM2_OUT      (DFSDM_FLTCR1_JEXTSEL_4 | DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_1 | DFSDM_FLTCR1_JEXTSEL_0)  /*!< For all DFSDM filters */
00400 #define DFSDM_FILTER_EXT_TRIG_LPTIM3_OUT      (DFSDM_FLTCR1_JEXTSEL_4 | DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_2)                           /*!< For all DFSDM filters */
00401 #if (STM32H7_DEV_ID == 0x480UL)
00402 #define DFSDM_FILTER_EXT_TRIG_COMP1_OUT      (DFSDM_FLTCR1_JEXTSEL_4 | DFSDM_FLTCR1_JEXTSEL_3 | \
00403                                               DFSDM_FLTCR1_JEXTSEL_2 | DFSDM_FLTCR1_JEXTSEL_0)       
00404 #define DFSDM_FILTER_EXT_TRIG_COMP2_OUT      (DFSDM_FLTCR1_JEXTSEL_4 | DFSDM_FLTCR1_JEXTSEL_3 | \
00405                                               DFSDM_FLTCR1_JEXTSEL_2 | DFSDM_FLTCR1_JEXTSEL_1)
00406 #elif (STM32H7_DEV_ID == 0x483UL)
00407 #define DFSDM_FILTER_EXT_TRIG_TIM23_TRGO     (DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_1 | \
00408                                               DFSDM_FLTCR1_JEXTSEL_0) 
00409 #define DFSDM_FILTER_EXT_TRIG_TIM24_TRGO     (DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_2 )
00410 #endif /* STM32H7_DEV_ID == 0x480UL */
00411 /**
00412   * @}
00413   */
00414 
00415 /** @defgroup DFSDM_Filter_ExtTriggerEdge DFSDM filter external trigger edge
00416   * @{
00417   */
00418 #define DFSDM_FILTER_EXT_TRIG_RISING_EDGE  DFSDM_FLTCR1_JEXTEN_0 /*!< External rising edge */
00419 #define DFSDM_FILTER_EXT_TRIG_FALLING_EDGE DFSDM_FLTCR1_JEXTEN_1 /*!< External falling edge */
00420 #define DFSDM_FILTER_EXT_TRIG_BOTH_EDGES   DFSDM_FLTCR1_JEXTEN   /*!< External rising and falling edges */
00421 /**
00422   * @}
00423   */
00424 
00425 /** @defgroup DFSDM_Filter_SincOrder DFSDM filter sinc order
00426   * @{
00427   */
00428 #define DFSDM_FILTER_FASTSINC_ORDER 0x00000000U                                 /*!< FastSinc filter type */
00429 #define DFSDM_FILTER_SINC1_ORDER    DFSDM_FLTFCR_FORD_0                         /*!< Sinc 1 filter type */
00430 #define DFSDM_FILTER_SINC2_ORDER    DFSDM_FLTFCR_FORD_1                         /*!< Sinc 2 filter type */
00431 #define DFSDM_FILTER_SINC3_ORDER    (DFSDM_FLTFCR_FORD_0 | DFSDM_FLTFCR_FORD_1) /*!< Sinc 3 filter type */
00432 #define DFSDM_FILTER_SINC4_ORDER    DFSDM_FLTFCR_FORD_2                         /*!< Sinc 4 filter type */
00433 #define DFSDM_FILTER_SINC5_ORDER    (DFSDM_FLTFCR_FORD_0 | DFSDM_FLTFCR_FORD_2) /*!< Sinc 5 filter type */
00434 /**
00435   * @}
00436   */
00437 
00438 /** @defgroup DFSDM_Filter_AwdDataSource DFSDM filter analog watchdog data source
00439   * @{
00440   */
00441 #define DFSDM_FILTER_AWD_FILTER_DATA  0x00000000U             /*!< From digital filter */
00442 #define DFSDM_FILTER_AWD_CHANNEL_DATA DFSDM_FLTCR1_AWFSEL     /*!< From analog watchdog channel */
00443 /**
00444   * @}
00445   */
00446 
00447 /** @defgroup DFSDM_Filter_ErrorCode DFSDM filter error code
00448   * @{
00449   */
00450 #define DFSDM_FILTER_ERROR_NONE             0x00000000U /*!< No error */
00451 #define DFSDM_FILTER_ERROR_REGULAR_OVERRUN  0x00000001U /*!< Overrun occurs during regular conversion */
00452 #define DFSDM_FILTER_ERROR_INJECTED_OVERRUN 0x00000002U /*!< Overrun occurs during injected conversion */
00453 #define DFSDM_FILTER_ERROR_DMA              0x00000003U /*!< DMA error occurs */
00454 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
00455 #define DFSDM_FILTER_ERROR_INVALID_CALLBACK 0x00000004U /*!< Invalid callback error occurs */
00456 #endif
00457 /**
00458   * @}
00459   */
00460 
00461 /** @defgroup DFSDM_BreakSignals DFSDM break signals
00462   * @{
00463   */
00464 #define DFSDM_NO_BREAK_SIGNAL 0x00000000U /*!< No break signal */
00465 #define DFSDM_BREAK_SIGNAL_0  0x00000001U /*!< Break signal 0 */
00466 #define DFSDM_BREAK_SIGNAL_1  0x00000002U /*!< Break signal 1 */
00467 #define DFSDM_BREAK_SIGNAL_2  0x00000004U /*!< Break signal 2 */
00468 #define DFSDM_BREAK_SIGNAL_3  0x00000008U /*!< Break signal 3 */
00469 /**
00470   * @}
00471   */
00472 
00473 /** @defgroup DFSDM_Channel_Selection DFSDM Channel Selection
00474   * @{
00475   */
00476 /* DFSDM Channels ------------------------------------------------------------*/
00477 /* The DFSDM channels are defined as follows:
00478    - in 16-bit LSB the channel mask is set
00479    - in 16-bit MSB the channel number is set
00480    e.g. for channel 5 definition:
00481         - the channel mask is 0x00000020 (bit 5 is set)
00482         - the channel number 5 is 0x00050000
00483         --> Consequently, channel 5 definition is 0x00000020 | 0x00050000 = 0x00050020 */
00484 #define DFSDM_CHANNEL_0                              0x00000001U
00485 #define DFSDM_CHANNEL_1                              0x00010002U
00486 #define DFSDM_CHANNEL_2                              0x00020004U
00487 #define DFSDM_CHANNEL_3                              0x00030008U
00488 #define DFSDM_CHANNEL_4                              0x00040010U
00489 #define DFSDM_CHANNEL_5                              0x00050020U
00490 #define DFSDM_CHANNEL_6                              0x00060040U
00491 #define DFSDM_CHANNEL_7                              0x00070080U
00492 /**
00493   * @}
00494   */
00495 
00496 /** @defgroup DFSDM_ContinuousMode DFSDM Continuous Mode
00497   * @{
00498   */
00499 #define DFSDM_CONTINUOUS_CONV_OFF            0x00000000U /*!< Conversion are not continuous */
00500 #define DFSDM_CONTINUOUS_CONV_ON             0x00000001U /*!< Conversion are continuous */
00501 /**
00502   * @}
00503   */
00504 
00505 /** @defgroup DFSDM_AwdThreshold DFSDM analog watchdog threshold
00506   * @{
00507   */
00508 #define DFSDM_AWD_HIGH_THRESHOLD            0x00000000U /*!< Analog watchdog high threshold */
00509 #define DFSDM_AWD_LOW_THRESHOLD             0x00000001U /*!< Analog watchdog low threshold */
00510 /**
00511   * @}
00512   */
00513 
00514 /**
00515   * @}
00516   */
00517 /* End of exported constants -------------------------------------------------*/
00518 
00519 /* Exported macros -----------------------------------------------------------*/
00520 /** @defgroup DFSDM_Exported_Macros DFSDM Exported Macros
00521  * @{
00522  */
00523 
00524 /** @brief  Reset DFSDM channel handle state.
00525   * @param  __HANDLE__ DFSDM channel handle.
00526   * @retval None
00527   */
00528 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
00529 #define __HAL_DFSDM_CHANNEL_RESET_HANDLE_STATE(__HANDLE__) do{                                                      \
00530                                                                (__HANDLE__)->State = HAL_DFSDM_CHANNEL_STATE_RESET; \
00531                                                                (__HANDLE__)->MspInitCallback = NULL;                \
00532                                                                (__HANDLE__)->MspDeInitCallback = NULL;              \
00533                                                              } while(0)
00534 #else
00535 #define __HAL_DFSDM_CHANNEL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DFSDM_CHANNEL_STATE_RESET)
00536 #endif
00537 
00538 /** @brief  Reset DFSDM filter handle state.
00539   * @param  __HANDLE__ DFSDM filter handle.
00540   * @retval None
00541   */
00542 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
00543 #define __HAL_DFSDM_FILTER_RESET_HANDLE_STATE(__HANDLE__) do{                                                     \
00544                                                               (__HANDLE__)->State = HAL_DFSDM_FILTER_STATE_RESET; \
00545                                                               (__HANDLE__)->MspInitCallback = NULL;               \
00546                                                               (__HANDLE__)->MspDeInitCallback = NULL;             \
00547                                                             } while(0)
00548 #else
00549 #define __HAL_DFSDM_FILTER_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DFSDM_FILTER_STATE_RESET)
00550 #endif
00551 
00552 /**
00553   * @}
00554   */
00555 /* End of exported macros ----------------------------------------------------*/
00556 
00557 #if defined(DFSDM_CHDLYR_PLSSKP)
00558 /* Include DFSDM HAL Extension module */
00559 #include "stm32h7xx_hal_dfsdm_ex.h"
00560 #endif /* DFSDM_CHDLYR_PLSSKP */
00561 
00562 /* Exported functions --------------------------------------------------------*/
00563 /** @addtogroup DFSDM_Exported_Functions DFSDM Exported Functions
00564   * @{
00565   */
00566 
00567 /** @addtogroup DFSDM_Exported_Functions_Group1_Channel Channel initialization and de-initialization functions
00568   * @{
00569   */
00570 /* Channel initialization and de-initialization functions *********************/
00571 HAL_StatusTypeDef HAL_DFSDM_ChannelInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
00572 HAL_StatusTypeDef HAL_DFSDM_ChannelDeInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
00573 void HAL_DFSDM_ChannelMspInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
00574 void HAL_DFSDM_ChannelMspDeInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
00575 
00576 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
00577 /* Channel callbacks register/unregister functions ****************************/
00578 HAL_StatusTypeDef HAL_DFSDM_Channel_RegisterCallback(DFSDM_Channel_HandleTypeDef        *hdfsdm_channel,
00579                                                      HAL_DFSDM_Channel_CallbackIDTypeDef CallbackID,
00580                                                      pDFSDM_Channel_CallbackTypeDef      pCallback);
00581 HAL_StatusTypeDef HAL_DFSDM_Channel_UnRegisterCallback(DFSDM_Channel_HandleTypeDef        *hdfsdm_channel,
00582                                                        HAL_DFSDM_Channel_CallbackIDTypeDef CallbackID);
00583 #endif
00584 /**
00585   * @}
00586   */
00587 
00588 /** @addtogroup DFSDM_Exported_Functions_Group2_Channel Channel operation functions
00589   * @{
00590   */
00591 /* Channel operation functions ************************************************/
00592 HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStart(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
00593 HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStart_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
00594 HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStop(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
00595 HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStop_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
00596 
00597 HAL_StatusTypeDef HAL_DFSDM_ChannelScdStart(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t Threshold, uint32_t BreakSignal);
00598 HAL_StatusTypeDef HAL_DFSDM_ChannelScdStart_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t Threshold, uint32_t BreakSignal);
00599 HAL_StatusTypeDef HAL_DFSDM_ChannelScdStop(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
00600 HAL_StatusTypeDef HAL_DFSDM_ChannelScdStop_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
00601 
00602 int16_t           HAL_DFSDM_ChannelGetAwdValue(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
00603 HAL_StatusTypeDef HAL_DFSDM_ChannelModifyOffset(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, int32_t Offset);
00604 
00605 HAL_StatusTypeDef HAL_DFSDM_ChannelPollForCkab(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t Timeout);
00606 HAL_StatusTypeDef HAL_DFSDM_ChannelPollForScd(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t Timeout);
00607 
00608 void HAL_DFSDM_ChannelCkabCallback(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
00609 void HAL_DFSDM_ChannelScdCallback(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
00610 /**
00611   * @}
00612   */
00613 
00614 /** @defgroup DFSDM_Exported_Functions_Group3_Channel Channel state function
00615   * @{
00616   */
00617 /* Channel state function *****************************************************/
00618 HAL_DFSDM_Channel_StateTypeDef HAL_DFSDM_ChannelGetState(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
00619 /**
00620   * @}
00621   */
00622 
00623 /** @addtogroup DFSDM_Exported_Functions_Group1_Filter Filter initialization and de-initialization functions
00624   * @{
00625   */
00626 /* Filter initialization and de-initialization functions *********************/
00627 HAL_StatusTypeDef HAL_DFSDM_FilterInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
00628 HAL_StatusTypeDef HAL_DFSDM_FilterDeInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
00629 void HAL_DFSDM_FilterMspInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
00630 void HAL_DFSDM_FilterMspDeInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
00631 
00632 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
00633 /* Filter callbacks register/unregister functions ****************************/
00634 HAL_StatusTypeDef HAL_DFSDM_Filter_RegisterCallback(DFSDM_Filter_HandleTypeDef        *hdfsdm_filter,
00635                                                     HAL_DFSDM_Filter_CallbackIDTypeDef CallbackID,
00636                                                     pDFSDM_Filter_CallbackTypeDef      pCallback);
00637 HAL_StatusTypeDef HAL_DFSDM_Filter_UnRegisterCallback(DFSDM_Filter_HandleTypeDef        *hdfsdm_filter,
00638                                                       HAL_DFSDM_Filter_CallbackIDTypeDef CallbackID);
00639 HAL_StatusTypeDef HAL_DFSDM_Filter_RegisterAwdCallback(DFSDM_Filter_HandleTypeDef      *hdfsdm_filter,
00640                                                        pDFSDM_Filter_AwdCallbackTypeDef pCallback);
00641 HAL_StatusTypeDef HAL_DFSDM_Filter_UnRegisterAwdCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
00642 #endif
00643 /**
00644   * @}
00645   */
00646 
00647 /** @addtogroup DFSDM_Exported_Functions_Group2_Filter Filter control functions
00648   * @{
00649   */
00650 /* Filter control functions *********************/
00651 HAL_StatusTypeDef HAL_DFSDM_FilterConfigRegChannel(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
00652                                                    uint32_t                    Channel,
00653                                                    uint32_t                    ContinuousMode);
00654 HAL_StatusTypeDef HAL_DFSDM_FilterConfigInjChannel(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
00655                                                    uint32_t                    Channel);
00656 /**
00657   * @}
00658   */
00659 
00660 /** @addtogroup DFSDM_Exported_Functions_Group3_Filter Filter operation functions
00661   * @{
00662   */
00663 /* Filter operation functions *********************/
00664 HAL_StatusTypeDef HAL_DFSDM_FilterRegularStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
00665 HAL_StatusTypeDef HAL_DFSDM_FilterRegularStart_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
00666 HAL_StatusTypeDef HAL_DFSDM_FilterRegularStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, int32_t *pData, uint32_t Length);
00667 HAL_StatusTypeDef HAL_DFSDM_FilterRegularMsbStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, int16_t *pData, uint32_t Length);
00668 HAL_StatusTypeDef HAL_DFSDM_FilterRegularStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
00669 HAL_StatusTypeDef HAL_DFSDM_FilterRegularStop_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
00670 HAL_StatusTypeDef HAL_DFSDM_FilterRegularStop_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
00671 HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
00672 HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStart_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
00673 HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, int32_t *pData, uint32_t Length);
00674 HAL_StatusTypeDef HAL_DFSDM_FilterInjectedMsbStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, int16_t *pData, uint32_t Length);
00675 HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
00676 HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStop_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
00677 HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStop_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
00678 HAL_StatusTypeDef HAL_DFSDM_FilterAwdStart_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
00679                                               DFSDM_Filter_AwdParamTypeDef *awdParam);
00680 HAL_StatusTypeDef HAL_DFSDM_FilterAwdStop_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
00681 HAL_StatusTypeDef HAL_DFSDM_FilterExdStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Channel);
00682 HAL_StatusTypeDef HAL_DFSDM_FilterExdStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
00683 
00684 int32_t  HAL_DFSDM_FilterGetRegularValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t *Channel);
00685 int32_t  HAL_DFSDM_FilterGetInjectedValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t *Channel);
00686 int32_t  HAL_DFSDM_FilterGetExdMaxValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t *Channel);
00687 int32_t  HAL_DFSDM_FilterGetExdMinValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t *Channel);
00688 uint32_t HAL_DFSDM_FilterGetConvTimeValue(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
00689 
00690 void HAL_DFSDM_IRQHandler(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
00691 
00692 HAL_StatusTypeDef HAL_DFSDM_FilterPollForRegConversion(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Timeout);
00693 HAL_StatusTypeDef HAL_DFSDM_FilterPollForInjConversion(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Timeout);
00694 
00695 void HAL_DFSDM_FilterRegConvCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
00696 void HAL_DFSDM_FilterRegConvHalfCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
00697 void HAL_DFSDM_FilterInjConvCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
00698 void HAL_DFSDM_FilterInjConvHalfCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
00699 void HAL_DFSDM_FilterAwdCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Channel, uint32_t Threshold);
00700 void HAL_DFSDM_FilterErrorCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
00701 /**
00702   * @}
00703   */
00704 
00705 /** @defgroup DFSDM_Exported_Functions_Group4_Filter Filter state functions
00706   * @{
00707   */
00708 /* Filter state functions *****************************************************/
00709 HAL_DFSDM_Filter_StateTypeDef HAL_DFSDM_FilterGetState(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
00710 uint32_t                      HAL_DFSDM_FilterGetError(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
00711 /**
00712   * @}
00713   */
00714 
00715 /**
00716   * @}
00717   */
00718 /* End of exported functions -------------------------------------------------*/
00719 
00720 /* Private macros ------------------------------------------------------------*/
00721 /** @defgroup DFSDM_Private_Macros DFSDM Private Macros
00722 * @{
00723 */
00724 #define IS_DFSDM_CHANNEL_OUTPUT_CLOCK(CLOCK)          (((CLOCK) == DFSDM_CHANNEL_OUTPUT_CLOCK_SYSTEM) || \
00725                                                        ((CLOCK) == DFSDM_CHANNEL_OUTPUT_CLOCK_AUDIO))
00726 #define IS_DFSDM_CHANNEL_OUTPUT_CLOCK_DIVIDER(DIVIDER) ((2U <= (DIVIDER)) && ((DIVIDER) <= 256U))
00727 #define IS_DFSDM_CHANNEL_INPUT(INPUT)                 (((INPUT) == DFSDM_CHANNEL_EXTERNAL_INPUTS) || \
00728                                                        ((INPUT) == DFSDM_CHANNEL_ADC_OUTPUT) || \
00729                                                        ((INPUT) == DFSDM_CHANNEL_INTERNAL_REGISTER))
00730 #define IS_DFSDM_CHANNEL_DATA_PACKING(MODE)           (((MODE) == DFSDM_CHANNEL_STANDARD_MODE) || \
00731                                                        ((MODE) == DFSDM_CHANNEL_INTERLEAVED_MODE) || \
00732                                                        ((MODE) == DFSDM_CHANNEL_DUAL_MODE))
00733 #define IS_DFSDM_CHANNEL_INPUT_PINS(PINS)             (((PINS) == DFSDM_CHANNEL_SAME_CHANNEL_PINS) || \
00734                                                        ((PINS) == DFSDM_CHANNEL_FOLLOWING_CHANNEL_PINS))
00735 #define IS_DFSDM_CHANNEL_SERIAL_INTERFACE_TYPE(MODE)  (((MODE) == DFSDM_CHANNEL_SPI_RISING) || \
00736                                                        ((MODE) == DFSDM_CHANNEL_SPI_FALLING) || \
00737                                                        ((MODE) == DFSDM_CHANNEL_MANCHESTER_RISING) || \
00738                                                        ((MODE) == DFSDM_CHANNEL_MANCHESTER_FALLING))
00739 #define IS_DFSDM_CHANNEL_SPI_CLOCK(TYPE)              (((TYPE) == DFSDM_CHANNEL_SPI_CLOCK_EXTERNAL) || \
00740                                                        ((TYPE) == DFSDM_CHANNEL_SPI_CLOCK_INTERNAL) || \
00741                                                        ((TYPE) == DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_FALLING) || \
00742                                                        ((TYPE) == DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_RISING))
00743 #define IS_DFSDM_CHANNEL_FILTER_ORDER(ORDER)          (((ORDER) == DFSDM_CHANNEL_FASTSINC_ORDER) || \
00744                                                        ((ORDER) == DFSDM_CHANNEL_SINC1_ORDER) || \
00745                                                        ((ORDER) == DFSDM_CHANNEL_SINC2_ORDER) || \
00746                                                        ((ORDER) == DFSDM_CHANNEL_SINC3_ORDER))
00747 #define IS_DFSDM_CHANNEL_FILTER_OVS_RATIO(RATIO)       ((1U <= (RATIO)) && ((RATIO) <= 32U))
00748 #define IS_DFSDM_CHANNEL_OFFSET(VALUE)                 ((-8388608 <= (VALUE)) && ((VALUE) <= 8388607))
00749 #define IS_DFSDM_CHANNEL_RIGHT_BIT_SHIFT(VALUE)        ((VALUE) <= 0x1FU)
00750 #define IS_DFSDM_CHANNEL_SCD_THRESHOLD(VALUE)          ((VALUE) <= 0xFFU)
00751 #define IS_DFSDM_FILTER_REG_TRIGGER(TRIG)             (((TRIG) == DFSDM_FILTER_SW_TRIGGER) || \
00752                                                        ((TRIG) == DFSDM_FILTER_SYNC_TRIGGER))
00753 #define IS_DFSDM_FILTER_INJ_TRIGGER(TRIG)             (((TRIG) == DFSDM_FILTER_SW_TRIGGER) || \
00754                                                        ((TRIG) == DFSDM_FILTER_SYNC_TRIGGER) || \
00755                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIGGER))
00756 #if (STM32H7_DEV_ID == 0x480UL)
00757 #define IS_DFSDM_FILTER_EXT_TRIG(TRIG)                (((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM1_TRGO) || \
00758                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM1_TRGO2) || \
00759                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM8_TRGO) || \
00760                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM8_TRGO2) || \
00761                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM3_TRGO) || \
00762                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM4_TRGO) || \
00763                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM16_OC1) || \
00764                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM6_TRGO) || \
00765                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM7_TRGO) || \
00766                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_EXTI11) || \
00767                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_EXTI15) || \
00768                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_LPTIM1_OUT) || \
00769                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_LPTIM2_OUT) || \
00770                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_LPTIM3_OUT) || \
00771                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_COMP1_OUT) || \
00772                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_COMP2_OUT))
00773 #elif (STM32H7_DEV_ID == 0x483UL)
00774 #define IS_DFSDM_FILTER_EXT_TRIG(TRIG)                (((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM1_TRGO) || \
00775                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM1_TRGO2) || \
00776                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM8_TRGO) || \
00777                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM8_TRGO2) || \
00778                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM3_TRGO) || \
00779                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM4_TRGO) || \
00780                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM16_OC1) || \
00781                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM6_TRGO) || \
00782                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM7_TRGO) || \
00783                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_EXTI11) || \
00784                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_EXTI15) || \
00785                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_LPTIM1_OUT) || \
00786                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_LPTIM2_OUT) || \
00787                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_LPTIM3_OUT) || \
00788                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM23_TRGO) || \
00789                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM24_TRGO))
00790 
00791 #else
00792 #define IS_DFSDM_FILTER_EXT_TRIG(TRIG)                (((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM1_TRGO) || \
00793                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM1_TRGO2) || \
00794                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM8_TRGO) || \
00795                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM8_TRGO2) || \
00796                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM3_TRGO) || \
00797                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM4_TRGO) || \
00798                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM16_OC1) || \
00799                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM6_TRGO) || \
00800                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM7_TRGO) || \
00801                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_HRTIM1_ADCTRG1) || \
00802                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_HRTIM1_ADCTRG3) || \
00803                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_EXTI11) || \
00804                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_EXTI15) || \
00805                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_LPTIM1_OUT) || \
00806                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_LPTIM2_OUT) || \
00807                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_LPTIM3_OUT))
00808 #endif /* STM32H7_DEV_ID == 0x480UL */
00809 #define IS_DFSDM_FILTER_EXT_TRIG_EDGE(EDGE)           (((EDGE) == DFSDM_FILTER_EXT_TRIG_RISING_EDGE)  || \
00810                                                        ((EDGE) == DFSDM_FILTER_EXT_TRIG_FALLING_EDGE)  || \
00811                                                        ((EDGE) == DFSDM_FILTER_EXT_TRIG_BOTH_EDGES))
00812 #define IS_DFSDM_FILTER_SINC_ORDER(ORDER)             (((ORDER) == DFSDM_FILTER_FASTSINC_ORDER) || \
00813                                                        ((ORDER) == DFSDM_FILTER_SINC1_ORDER) || \
00814                                                        ((ORDER) == DFSDM_FILTER_SINC2_ORDER) || \
00815                                                        ((ORDER) == DFSDM_FILTER_SINC3_ORDER) || \
00816                                                        ((ORDER) == DFSDM_FILTER_SINC4_ORDER) || \
00817                                                        ((ORDER) == DFSDM_FILTER_SINC5_ORDER))
00818 #define IS_DFSDM_FILTER_OVS_RATIO(RATIO)               ((1U <= (RATIO)) && ((RATIO) <= 1024U))
00819 #define IS_DFSDM_FILTER_INTEGRATOR_OVS_RATIO(RATIO)    ((1U <= (RATIO)) && ((RATIO) <= 256U))
00820 #define IS_DFSDM_FILTER_AWD_DATA_SOURCE(DATA)         (((DATA) == DFSDM_FILTER_AWD_FILTER_DATA)  || \
00821                                                        ((DATA) == DFSDM_FILTER_AWD_CHANNEL_DATA))
00822 #define IS_DFSDM_FILTER_AWD_THRESHOLD(VALUE)           ((-8388608 <= (VALUE)) && ((VALUE) <= 8388607))
00823 #define IS_DFSDM_BREAK_SIGNALS(VALUE)                  ((VALUE) <= 0xFU)
00824 #define IS_DFSDM_REGULAR_CHANNEL(CHANNEL)             (((CHANNEL) == DFSDM_CHANNEL_0)  || \
00825                                                        ((CHANNEL) == DFSDM_CHANNEL_1)  || \
00826                                                        ((CHANNEL) == DFSDM_CHANNEL_2)  || \
00827                                                        ((CHANNEL) == DFSDM_CHANNEL_3)  || \
00828                                                        ((CHANNEL) == DFSDM_CHANNEL_4)  || \
00829                                                        ((CHANNEL) == DFSDM_CHANNEL_5)  || \
00830                                                        ((CHANNEL) == DFSDM_CHANNEL_6)  || \
00831                                                        ((CHANNEL) == DFSDM_CHANNEL_7))
00832 #define IS_DFSDM_INJECTED_CHANNEL(CHANNEL)            (((CHANNEL) != 0U) && ((CHANNEL) <= 0x000F00FFU))
00833 #define IS_DFSDM_CONTINUOUS_MODE(MODE)                (((MODE) == DFSDM_CONTINUOUS_CONV_OFF)  || \
00834                                                        ((MODE) == DFSDM_CONTINUOUS_CONV_ON))
00835 #if defined(DFSDM2_Channel0)
00836 #define IS_DFSDM1_CHANNEL_INSTANCE(INSTANCE)          (((INSTANCE) == DFSDM1_Channel0) || \
00837                                                        ((INSTANCE) == DFSDM1_Channel1) || \
00838                                                        ((INSTANCE) == DFSDM1_Channel2) || \
00839                                                        ((INSTANCE) == DFSDM1_Channel3) || \
00840                                                        ((INSTANCE) == DFSDM1_Channel4) || \
00841                                                        ((INSTANCE) == DFSDM1_Channel5) || \
00842                                                        ((INSTANCE) == DFSDM1_Channel6) || \
00843                                                        ((INSTANCE) == DFSDM1_Channel7))
00844 #define IS_DFSDM1_FILTER_INSTANCE(INSTANCE)           (((INSTANCE) == DFSDM1_Filter0) || \
00845                                                        ((INSTANCE) == DFSDM1_Filter1) || \
00846                                                        ((INSTANCE) == DFSDM1_Filter2) || \
00847                                                        ((INSTANCE) == DFSDM1_Filter3) || \
00848                                                        ((INSTANCE) == DFSDM1_Filter4) || \
00849                                                        ((INSTANCE) == DFSDM1_Filter5) || \
00850                                                        ((INSTANCE) == DFSDM1_Filter6) || \
00851                                                        ((INSTANCE) == DFSDM1_Filter7))
00852 #endif /* DFSDM2_Channel0 */
00853 /**
00854   * @}
00855   */
00856 /* End of private macros -----------------------------------------------------*/
00857 
00858 /**
00859   * @}
00860   */
00861 
00862 /**
00863   * @}
00864   */
00865 
00866 #ifdef __cplusplus
00867 }
00868 #endif
00869 
00870 #endif /* STM32H7xx_HAL_DFSDM_H */
00871