Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:35

0001 /**
0002   ******************************************************************************
0003   * @file    stm32h7xx_hal_dfsdm.h
0004   * @author  MCD Application Team
0005   * @brief   Header file of DFSDM HAL module.
0006   ******************************************************************************
0007   * @attention
0008   *
0009   * Copyright (c) 2017 STMicroelectronics.
0010   * All rights reserved.
0011   *
0012   * This software is licensed under terms that can be found in the LICENSE file
0013   * in the root directory of this software component.
0014   * If no LICENSE file comes with this software, it is provided AS-IS.
0015   *
0016   ******************************************************************************
0017   */
0018 
0019 /* Define to prevent recursive inclusion -------------------------------------*/
0020 #ifndef STM32H7xx_HAL_DFSDM_H
0021 #define STM32H7xx_HAL_DFSDM_H
0022 
0023 #ifdef __cplusplus
0024  extern "C" {
0025 #endif
0026 
0027 /* Includes ------------------------------------------------------------------*/
0028 #include "stm32h7xx_hal_def.h"
0029 
0030 /** @addtogroup STM32H7xx_HAL_Driver
0031   * @{
0032   */
0033 
0034 /** @addtogroup DFSDM
0035   * @{
0036   */
0037 
0038 /* Exported types ------------------------------------------------------------*/
0039 /** @defgroup DFSDM_Exported_Types DFSDM Exported Types
0040   * @ingroup RTEMSBSPsARMSTM32H7
0041   * @{
0042   */
0043 
0044 /**
0045   * @brief  HAL DFSDM Channel states definition
0046   */
0047 typedef enum
0048 {
0049   HAL_DFSDM_CHANNEL_STATE_RESET = 0x00U, /*!< DFSDM channel not initialized */
0050   HAL_DFSDM_CHANNEL_STATE_READY = 0x01U, /*!< DFSDM channel initialized and ready for use */
0051   HAL_DFSDM_CHANNEL_STATE_ERROR = 0xFFU  /*!< DFSDM channel state error */
0052 } HAL_DFSDM_Channel_StateTypeDef;
0053 
0054 /**
0055   * @brief  DFSDM channel output clock structure definition
0056   */
0057 typedef struct
0058 {
0059   FunctionalState Activation; /*!< Output clock enable/disable */
0060   uint32_t        Selection;  /*!< Output clock is system clock or audio clock.
0061                                    This parameter can be a value of @ref DFSDM_Channel_OuputClock */
0062   uint32_t        Divider;    /*!< Output clock divider.
0063                                    This parameter must be a number between Min_Data = 2 and Max_Data = 256 */
0064 } DFSDM_Channel_OutputClockTypeDef;
0065 
0066 /**
0067   * @brief  DFSDM channel input structure definition
0068   */
0069 typedef struct
0070 {
0071   uint32_t Multiplexer; /*!< Input is external serial inputs, internal register or ADC output.
0072                              This parameter can be a value of @ref DFSDM_Channel_InputMultiplexer */
0073   uint32_t DataPacking; /*!< Standard, interleaved or dual mode for internal register.
0074                              This parameter can be a value of @ref DFSDM_Channel_DataPacking */
0075   uint32_t Pins;        /*!< Input pins are taken from same or following channel.
0076                              This parameter can be a value of @ref DFSDM_Channel_InputPins */
0077 } DFSDM_Channel_InputTypeDef;
0078 
0079 /**
0080   * @brief  DFSDM channel serial interface structure definition
0081   */
0082 typedef struct
0083 {
0084   uint32_t Type;     /*!< SPI or Manchester modes.
0085                           This parameter can be a value of @ref DFSDM_Channel_SerialInterfaceType */
0086   uint32_t SpiClock; /*!< SPI clock select (external or internal with different sampling point).
0087                           This parameter can be a value of @ref DFSDM_Channel_SpiClock */
0088 } DFSDM_Channel_SerialInterfaceTypeDef;
0089 
0090 /**
0091   * @brief  DFSDM channel analog watchdog structure definition
0092   */
0093 typedef struct
0094 {
0095   uint32_t FilterOrder;  /*!< Analog watchdog Sinc filter order.
0096                               This parameter can be a value of @ref DFSDM_Channel_AwdFilterOrder */
0097   uint32_t Oversampling; /*!< Analog watchdog filter oversampling ratio.
0098                               This parameter must be a number between Min_Data = 1 and Max_Data = 32 */
0099 } DFSDM_Channel_AwdTypeDef;
0100 
0101 /**
0102   * @brief  DFSDM channel init structure definition
0103   */
0104 typedef struct
0105 {
0106   DFSDM_Channel_OutputClockTypeDef     OutputClock;     /*!< DFSDM channel output clock parameters */
0107   DFSDM_Channel_InputTypeDef           Input;           /*!< DFSDM channel input parameters */
0108   DFSDM_Channel_SerialInterfaceTypeDef SerialInterface; /*!< DFSDM channel serial interface parameters */
0109   DFSDM_Channel_AwdTypeDef             Awd;             /*!< DFSDM channel analog watchdog parameters */
0110   int32_t                              Offset;          /*!< DFSDM channel offset.
0111                                                              This parameter must be a number between Min_Data = -8388608 and Max_Data = 8388607 */
0112   uint32_t                             RightBitShift;   /*!< DFSDM channel right bit shift.
0113                                                              This parameter must be a number between Min_Data = 0x00 and Max_Data = 0x1F */
0114 } DFSDM_Channel_InitTypeDef;
0115 
0116 /**
0117   * @brief  DFSDM channel handle structure definition
0118   */
0119 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
0120 typedef struct __DFSDM_Channel_HandleTypeDef
0121 #else
0122 typedef struct
0123 #endif /* USE_HAL_DFSDM_REGISTER_CALLBACKS */
0124 {
0125   DFSDM_Channel_TypeDef          *Instance; /*!< DFSDM channel instance */
0126   DFSDM_Channel_InitTypeDef      Init;      /*!< DFSDM channel init parameters */
0127   HAL_DFSDM_Channel_StateTypeDef State;     /*!< DFSDM channel state */
0128 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
0129   void (*CkabCallback)      (struct __DFSDM_Channel_HandleTypeDef *hdfsdm_channel); /*!< DFSDM channel clock absence detection callback */
0130   void (*ScdCallback)       (struct __DFSDM_Channel_HandleTypeDef *hdfsdm_channel); /*!< DFSDM channel short circuit detection callback */
0131   void (*MspInitCallback)   (struct __DFSDM_Channel_HandleTypeDef *hdfsdm_channel); /*!< DFSDM channel MSP init callback */
0132   void (*MspDeInitCallback) (struct __DFSDM_Channel_HandleTypeDef *hdfsdm_channel); /*!< DFSDM channel MSP de-init callback */
0133 #endif
0134 } DFSDM_Channel_HandleTypeDef;
0135 
0136 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
0137 /**
0138   * @brief  DFSDM channel callback ID enumeration definition
0139   */
0140 typedef enum
0141 {
0142   HAL_DFSDM_CHANNEL_CKAB_CB_ID      = 0x00U, /*!< DFSDM channel clock absence detection callback ID */
0143   HAL_DFSDM_CHANNEL_SCD_CB_ID       = 0x01U, /*!< DFSDM channel short circuit detection callback ID */
0144   HAL_DFSDM_CHANNEL_MSPINIT_CB_ID   = 0x02U, /*!< DFSDM channel MSP init callback ID */
0145   HAL_DFSDM_CHANNEL_MSPDEINIT_CB_ID = 0x03U  /*!< DFSDM channel MSP de-init callback ID */
0146 } HAL_DFSDM_Channel_CallbackIDTypeDef;
0147 
0148 /**
0149   * @brief  DFSDM channel callback pointer definition
0150   */
0151 typedef void (*pDFSDM_Channel_CallbackTypeDef)(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
0152 #endif
0153 
0154 /**
0155   * @brief  HAL DFSDM Filter states definition
0156   */
0157 typedef enum
0158 {
0159   HAL_DFSDM_FILTER_STATE_RESET   = 0x00U, /*!< DFSDM filter not initialized */
0160   HAL_DFSDM_FILTER_STATE_READY   = 0x01U, /*!< DFSDM filter initialized and ready for use */
0161   HAL_DFSDM_FILTER_STATE_REG     = 0x02U, /*!< DFSDM filter regular conversion in progress */
0162   HAL_DFSDM_FILTER_STATE_INJ     = 0x03U, /*!< DFSDM filter injected conversion in progress */
0163   HAL_DFSDM_FILTER_STATE_REG_INJ = 0x04U, /*!< DFSDM filter regular and injected conversions in progress */
0164   HAL_DFSDM_FILTER_STATE_ERROR   = 0xFFU  /*!< DFSDM filter state error */
0165 } HAL_DFSDM_Filter_StateTypeDef;
0166 
0167 /**
0168   * @brief  DFSDM filter regular conversion parameters structure definition
0169   */
0170 typedef struct
0171 {
0172   uint32_t        Trigger;  /*!< Trigger used to start regular conversion: software or synchronous.
0173                                  This parameter can be a value of @ref DFSDM_Filter_Trigger */
0174   FunctionalState FastMode; /*!< Enable/disable fast mode for regular conversion */
0175   FunctionalState DmaMode;  /*!< Enable/disable DMA for regular conversion */
0176 } DFSDM_Filter_RegularParamTypeDef;
0177 
0178 /**
0179   * @brief  DFSDM filter injected conversion parameters structure definition
0180   */
0181 typedef struct
0182 {
0183   uint32_t        Trigger;        /*!< Trigger used to start injected conversion: software, external or synchronous.
0184                                        This parameter can be a value of @ref DFSDM_Filter_Trigger */
0185   FunctionalState ScanMode;       /*!< Enable/disable scanning mode for injected conversion */
0186   FunctionalState DmaMode;        /*!< Enable/disable DMA for injected conversion */
0187   uint32_t        ExtTrigger;     /*!< External trigger.
0188                                        This parameter can be a value of @ref DFSDM_Filter_ExtTrigger */
0189   uint32_t        ExtTriggerEdge; /*!< External trigger edge: rising, falling or both.
0190                                        This parameter can be a value of @ref DFSDM_Filter_ExtTriggerEdge */
0191 } DFSDM_Filter_InjectedParamTypeDef;
0192 
0193 /**
0194   * @brief  DFSDM filter parameters structure definition
0195   */
0196 typedef struct
0197 {
0198   uint32_t SincOrder;       /*!< Sinc filter order.
0199                                  This parameter can be a value of @ref DFSDM_Filter_SincOrder */
0200   uint32_t Oversampling;    /*!< Filter oversampling ratio.
0201                                  This parameter must be a number between Min_Data = 1 and Max_Data = 1024 */
0202   uint32_t IntOversampling; /*!< Integrator oversampling ratio.
0203                                  This parameter must be a number between Min_Data = 1 and Max_Data = 256 */
0204 } DFSDM_Filter_FilterParamTypeDef;
0205 
0206 /**
0207   * @brief  DFSDM filter init structure definition
0208   */
0209 typedef struct
0210 {
0211   DFSDM_Filter_RegularParamTypeDef  RegularParam;  /*!< DFSDM regular conversion parameters */
0212   DFSDM_Filter_InjectedParamTypeDef InjectedParam; /*!< DFSDM injected conversion parameters */
0213   DFSDM_Filter_FilterParamTypeDef   FilterParam;   /*!< DFSDM filter parameters */
0214 } DFSDM_Filter_InitTypeDef;
0215 
0216 /**
0217   * @brief  DFSDM filter handle structure definition
0218   */
0219 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
0220 typedef struct __DFSDM_Filter_HandleTypeDef
0221 #else
0222 typedef struct
0223 #endif /* USE_HAL_DFSDM_REGISTER_CALLBACKS */
0224 {
0225   DFSDM_Filter_TypeDef          *Instance;           /*!< DFSDM filter instance */
0226   DFSDM_Filter_InitTypeDef      Init;                /*!< DFSDM filter init parameters */
0227   DMA_HandleTypeDef             *hdmaReg;            /*!< Pointer on DMA handler for regular conversions */
0228   DMA_HandleTypeDef             *hdmaInj;            /*!< Pointer on DMA handler for injected conversions */
0229   uint32_t                      RegularContMode;     /*!< Regular conversion continuous mode */
0230   uint32_t                      RegularTrigger;      /*!< Trigger used for regular conversion */
0231   uint32_t                      InjectedTrigger;     /*!< Trigger used for injected conversion */
0232   uint32_t                      ExtTriggerEdge;      /*!< Rising, falling or both edges selected */
0233   FunctionalState               InjectedScanMode;    /*!< Injected scanning mode */
0234   uint32_t                      InjectedChannelsNbr; /*!< Number of channels in injected sequence */
0235   uint32_t                      InjConvRemaining;    /*!< Injected conversions remaining */
0236   HAL_DFSDM_Filter_StateTypeDef State;               /*!< DFSDM filter state */
0237   uint32_t                      ErrorCode;           /*!< DFSDM filter error code */
0238 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
0239   void (*AwdCallback)             (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
0240                       uint32_t Channel, uint32_t Threshold);                            /*!< DFSDM filter analog watchdog callback */
0241   void (*RegConvCpltCallback)     (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter); /*!< DFSDM filter regular conversion complete callback */
0242   void (*RegConvHalfCpltCallback) (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter); /*!< DFSDM filter half regular conversion complete callback */
0243   void (*InjConvCpltCallback)     (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter); /*!< DFSDM filter injected conversion complete callback */
0244   void (*InjConvHalfCpltCallback) (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter); /*!< DFSDM filter half injected conversion complete callback */
0245   void (*ErrorCallback)           (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter); /*!< DFSDM filter error callback */
0246   void (*MspInitCallback)         (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter); /*!< DFSDM filter MSP init callback */
0247   void (*MspDeInitCallback)       (struct __DFSDM_Filter_HandleTypeDef *hdfsdm_filter); /*!< DFSDM filter MSP de-init callback */
0248 #endif
0249 }DFSDM_Filter_HandleTypeDef;
0250 
0251 /**
0252   * @brief  DFSDM filter analog watchdog parameters structure definition
0253   */
0254 typedef struct
0255 {
0256   uint32_t DataSource;      /*!< Values from digital filter or from channel watchdog filter.
0257                                  This parameter can be a value of @ref DFSDM_Filter_AwdDataSource */
0258   uint32_t Channel;         /*!< Analog watchdog channel selection.
0259                                  This parameter can be a values combination of @ref DFSDM_Channel_Selection */
0260   int32_t  HighThreshold;   /*!< High threshold for the analog watchdog.
0261                                  This parameter must be a number between Min_Data = -8388608 and Max_Data = 8388607 */
0262   int32_t  LowThreshold;    /*!< Low threshold for the analog watchdog.
0263                                  This parameter must be a number between Min_Data = -8388608 and Max_Data = 8388607 */
0264   uint32_t HighBreakSignal; /*!< Break signal assigned to analog watchdog high threshold event.
0265                                  This parameter can be a values combination of @ref DFSDM_BreakSignals */
0266   uint32_t LowBreakSignal;  /*!< Break signal assigned to analog watchdog low threshold event.
0267                                  This parameter can be a values combination of @ref DFSDM_BreakSignals */
0268 } DFSDM_Filter_AwdParamTypeDef;
0269 
0270 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
0271 /**
0272   * @brief  DFSDM filter callback ID enumeration definition
0273   */
0274 typedef enum
0275 {
0276   HAL_DFSDM_FILTER_REGCONV_COMPLETE_CB_ID     = 0x00U, /*!< DFSDM filter regular conversion complete callback ID */
0277   HAL_DFSDM_FILTER_REGCONV_HALFCOMPLETE_CB_ID = 0x01U, /*!< DFSDM filter half regular conversion complete callback ID */
0278   HAL_DFSDM_FILTER_INJCONV_COMPLETE_CB_ID     = 0x02U, /*!< DFSDM filter injected conversion complete callback ID */
0279   HAL_DFSDM_FILTER_INJCONV_HALFCOMPLETE_CB_ID = 0x03U, /*!< DFSDM filter half injected conversion complete callback ID */
0280   HAL_DFSDM_FILTER_ERROR_CB_ID                = 0x04U, /*!< DFSDM filter error callback ID */
0281   HAL_DFSDM_FILTER_MSPINIT_CB_ID              = 0x05U, /*!< DFSDM filter MSP init callback ID */
0282   HAL_DFSDM_FILTER_MSPDEINIT_CB_ID            = 0x06U  /*!< DFSDM filter MSP de-init callback ID */
0283 } HAL_DFSDM_Filter_CallbackIDTypeDef;
0284 
0285 /**
0286   * @brief  DFSDM filter callback pointer definition
0287   */
0288 typedef void (*pDFSDM_Filter_CallbackTypeDef)(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
0289 typedef void (*pDFSDM_Filter_AwdCallbackTypeDef)(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Channel, uint32_t Threshold);
0290 #endif
0291 
0292 /**
0293   * @}
0294   */
0295 /* End of exported types -----------------------------------------------------*/
0296 
0297 /* Exported constants --------------------------------------------------------*/
0298 /** @defgroup DFSDM_Exported_Constants DFSDM Exported Constants
0299   * @ingroup RTEMSBSPsARMSTM32H7
0300   * @{
0301   */
0302 
0303 /** @defgroup DFSDM_Channel_OuputClock DFSDM channel output clock selection
0304   * @ingroup RTEMSBSPsARMSTM32H7
0305   * @{
0306   */
0307 #define DFSDM_CHANNEL_OUTPUT_CLOCK_SYSTEM    0x00000000U             /*!< Source for output clock is system clock */
0308 #define DFSDM_CHANNEL_OUTPUT_CLOCK_AUDIO     DFSDM_CHCFGR1_CKOUTSRC  /*!< Source for output clock is audio clock */
0309 /**
0310   * @}
0311   */
0312 
0313 /** @defgroup DFSDM_Channel_InputMultiplexer DFSDM channel input multiplexer
0314   * @ingroup RTEMSBSPsARMSTM32H7
0315   * @{
0316   */
0317 #define DFSDM_CHANNEL_EXTERNAL_INPUTS    0x00000000U             /*!< Data are taken from external inputs */
0318 #define DFSDM_CHANNEL_ADC_OUTPUT         DFSDM_CHCFGR1_DATMPX_0  /*!< Data are taken from ADC output */
0319 #define DFSDM_CHANNEL_INTERNAL_REGISTER  DFSDM_CHCFGR1_DATMPX_1  /*!< Data are taken from internal register */
0320 /**
0321   * @}
0322   */
0323 
0324 /** @defgroup DFSDM_Channel_DataPacking DFSDM channel input data packing
0325   * @ingroup RTEMSBSPsARMSTM32H7
0326   * @{
0327   */
0328 #define DFSDM_CHANNEL_STANDARD_MODE         0x00000000U             /*!< Standard data packing mode */
0329 #define DFSDM_CHANNEL_INTERLEAVED_MODE      DFSDM_CHCFGR1_DATPACK_0 /*!< Interleaved data packing mode */
0330 #define DFSDM_CHANNEL_DUAL_MODE             DFSDM_CHCFGR1_DATPACK_1 /*!< Dual data packing mode */
0331 /**
0332   * @}
0333   */
0334 
0335 /** @defgroup DFSDM_Channel_InputPins DFSDM channel input pins
0336   * @ingroup RTEMSBSPsARMSTM32H7
0337   * @{
0338   */
0339 #define DFSDM_CHANNEL_SAME_CHANNEL_PINS      0x00000000U             /*!< Input from pins on same channel */
0340 #define DFSDM_CHANNEL_FOLLOWING_CHANNEL_PINS DFSDM_CHCFGR1_CHINSEL   /*!< Input from pins on following channel */
0341 /**
0342   * @}
0343   */
0344 
0345 /** @defgroup DFSDM_Channel_SerialInterfaceType DFSDM channel serial interface type
0346   * @ingroup RTEMSBSPsARMSTM32H7
0347   * @{
0348   */
0349 #define DFSDM_CHANNEL_SPI_RISING         0x00000000U             /*!< SPI with rising edge */
0350 #define DFSDM_CHANNEL_SPI_FALLING        DFSDM_CHCFGR1_SITP_0    /*!< SPI with falling edge */
0351 #define DFSDM_CHANNEL_MANCHESTER_RISING  DFSDM_CHCFGR1_SITP_1    /*!< Manchester with rising edge */
0352 #define DFSDM_CHANNEL_MANCHESTER_FALLING DFSDM_CHCFGR1_SITP      /*!< Manchester with falling edge */
0353 /**
0354   * @}
0355   */
0356 
0357 /** @defgroup DFSDM_Channel_SpiClock DFSDM channel SPI clock selection
0358   * @ingroup RTEMSBSPsARMSTM32H7
0359   * @{
0360   */
0361 #define DFSDM_CHANNEL_SPI_CLOCK_EXTERNAL              0x00000000U              /*!< External SPI clock */
0362 #define DFSDM_CHANNEL_SPI_CLOCK_INTERNAL              DFSDM_CHCFGR1_SPICKSEL_0 /*!< Internal SPI clock */
0363 #define DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_FALLING DFSDM_CHCFGR1_SPICKSEL_1 /*!< Internal SPI clock divided by 2, falling edge */
0364 #define DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_RISING  DFSDM_CHCFGR1_SPICKSEL   /*!< Internal SPI clock divided by 2, rising edge */
0365 /**
0366   * @}
0367   */
0368 
0369 /** @defgroup DFSDM_Channel_AwdFilterOrder DFSDM channel analog watchdog filter order
0370   * @ingroup RTEMSBSPsARMSTM32H7
0371   * @{
0372   */
0373 #define DFSDM_CHANNEL_FASTSINC_ORDER 0x00000000U             /*!< FastSinc filter type */
0374 #define DFSDM_CHANNEL_SINC1_ORDER    DFSDM_CHAWSCDR_AWFORD_0 /*!< Sinc 1 filter type */
0375 #define DFSDM_CHANNEL_SINC2_ORDER    DFSDM_CHAWSCDR_AWFORD_1 /*!< Sinc 2 filter type */
0376 #define DFSDM_CHANNEL_SINC3_ORDER    DFSDM_CHAWSCDR_AWFORD   /*!< Sinc 3 filter type */
0377 /**
0378   * @}
0379   */
0380 
0381 /** @defgroup DFSDM_Filter_Trigger DFSDM filter conversion trigger
0382   * @ingroup RTEMSBSPsARMSTM32H7
0383   * @{
0384   */
0385 #define DFSDM_FILTER_SW_TRIGGER   0x00000000U /*!< Software trigger */
0386 #define DFSDM_FILTER_SYNC_TRIGGER 0x00000001U /*!< Synchronous with DFSDM_FLT0 */
0387 #define DFSDM_FILTER_EXT_TRIGGER  0x00000002U /*!< External trigger (only for injected conversion) */
0388 /**
0389   * @}
0390   */
0391 
0392 /** @defgroup DFSDM_Filter_ExtTrigger DFSDM filter external trigger
0393   * @ingroup RTEMSBSPsARMSTM32H7
0394   * @{
0395   */
0396 #define DFSDM_FILTER_EXT_TRIG_TIM1_TRGO      0x00000000U                                       /*!< For all DFSDM filters */
0397 #define DFSDM_FILTER_EXT_TRIG_TIM1_TRGO2     DFSDM_FLTCR1_JEXTSEL_0                            /*!< For all DFSDM filters */
0398 #define DFSDM_FILTER_EXT_TRIG_TIM8_TRGO      DFSDM_FLTCR1_JEXTSEL_1                            /*!< For all DFSDM filters */
0399 #define DFSDM_FILTER_EXT_TRIG_TIM8_TRGO2     (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_1) /*!< For all DFSDM filters */
0400 #define DFSDM_FILTER_EXT_TRIG_TIM3_TRGO      DFSDM_FLTCR1_JEXTSEL_2                            /*!< For all DFSDM filters */
0401 #define DFSDM_FILTER_EXT_TRIG_TIM4_TRGO      (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_2) /*!< For all DFSDM filters */
0402 #define DFSDM_FILTER_EXT_TRIG_TIM16_OC1       (DFSDM_FLTCR1_JEXTSEL_2 | DFSDM_FLTCR1_JEXTSEL_1)                        /*!< For all DFSDM filters */
0403 #define DFSDM_FILTER_EXT_TRIG_TIM6_TRGO       (DFSDM_FLTCR1_JEXTSEL_0 | DFSDM_FLTCR1_JEXTSEL_2 | DFSDM_FLTCR1_JEXTSEL_1) /*!< For all DFSDM filters */
0404 #define DFSDM_FILTER_EXT_TRIG_TIM7_TRGO      DFSDM_FLTCR1_JEXTSEL_3                            /*!< For all DFSDM filters */
0405 #define DFSDM_FILTER_EXT_TRIG_HRTIM1_ADCTRG1  (DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_0)
0406 #define DFSDM_FILTER_EXT_TRIG_HRTIM1_ADCTRG3  (DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_1)
0407 #define DFSDM_FILTER_EXT_TRIG_EXTI11          (DFSDM_FLTCR1_JEXTSEL_4 | DFSDM_FLTCR1_JEXTSEL_3) /*!< For all DFSDM filters */
0408 #define DFSDM_FILTER_EXT_TRIG_EXTI15          (DFSDM_FLTCR1_JEXTSEL_4 | DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_0)                           /*!< For all DFSDM filters */
0409 #define DFSDM_FILTER_EXT_TRIG_LPTIM1_OUT      (DFSDM_FLTCR1_JEXTSEL_4 | DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_1)                           /*!< For all DFSDM filters */
0410 #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 */
0411 #define DFSDM_FILTER_EXT_TRIG_LPTIM3_OUT      (DFSDM_FLTCR1_JEXTSEL_4 | DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_2)                           /*!< For all DFSDM filters */
0412 #if (STM32H7_DEV_ID == 0x480UL)
0413 #define DFSDM_FILTER_EXT_TRIG_COMP1_OUT      (DFSDM_FLTCR1_JEXTSEL_4 | DFSDM_FLTCR1_JEXTSEL_3 | \
0414                                               DFSDM_FLTCR1_JEXTSEL_2 | DFSDM_FLTCR1_JEXTSEL_0)
0415 #define DFSDM_FILTER_EXT_TRIG_COMP2_OUT      (DFSDM_FLTCR1_JEXTSEL_4 | DFSDM_FLTCR1_JEXTSEL_3 | \
0416                                               DFSDM_FLTCR1_JEXTSEL_2 | DFSDM_FLTCR1_JEXTSEL_1)
0417 #elif (STM32H7_DEV_ID == 0x483UL)
0418 #define DFSDM_FILTER_EXT_TRIG_TIM23_TRGO     (DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_1 | \
0419                                               DFSDM_FLTCR1_JEXTSEL_0)
0420 #define DFSDM_FILTER_EXT_TRIG_TIM24_TRGO     (DFSDM_FLTCR1_JEXTSEL_3 | DFSDM_FLTCR1_JEXTSEL_2 )
0421 #endif /* STM32H7_DEV_ID == 0x480UL */
0422 /**
0423   * @}
0424   */
0425 
0426 /** @defgroup DFSDM_Filter_ExtTriggerEdge DFSDM filter external trigger edge
0427   * @ingroup RTEMSBSPsARMSTM32H7
0428   * @{
0429   */
0430 #define DFSDM_FILTER_EXT_TRIG_RISING_EDGE  DFSDM_FLTCR1_JEXTEN_0 /*!< External rising edge */
0431 #define DFSDM_FILTER_EXT_TRIG_FALLING_EDGE DFSDM_FLTCR1_JEXTEN_1 /*!< External falling edge */
0432 #define DFSDM_FILTER_EXT_TRIG_BOTH_EDGES   DFSDM_FLTCR1_JEXTEN   /*!< External rising and falling edges */
0433 /**
0434   * @}
0435   */
0436 
0437 /** @defgroup DFSDM_Filter_SincOrder DFSDM filter sinc order
0438   * @ingroup RTEMSBSPsARMSTM32H7
0439   * @{
0440   */
0441 #define DFSDM_FILTER_FASTSINC_ORDER 0x00000000U                                 /*!< FastSinc filter type */
0442 #define DFSDM_FILTER_SINC1_ORDER    DFSDM_FLTFCR_FORD_0                         /*!< Sinc 1 filter type */
0443 #define DFSDM_FILTER_SINC2_ORDER    DFSDM_FLTFCR_FORD_1                         /*!< Sinc 2 filter type */
0444 #define DFSDM_FILTER_SINC3_ORDER    (DFSDM_FLTFCR_FORD_0 | DFSDM_FLTFCR_FORD_1) /*!< Sinc 3 filter type */
0445 #define DFSDM_FILTER_SINC4_ORDER    DFSDM_FLTFCR_FORD_2                         /*!< Sinc 4 filter type */
0446 #define DFSDM_FILTER_SINC5_ORDER    (DFSDM_FLTFCR_FORD_0 | DFSDM_FLTFCR_FORD_2) /*!< Sinc 5 filter type */
0447 /**
0448   * @}
0449   */
0450 
0451 /** @defgroup DFSDM_Filter_AwdDataSource DFSDM filter analog watchdog data source
0452   * @ingroup RTEMSBSPsARMSTM32H7
0453   * @{
0454   */
0455 #define DFSDM_FILTER_AWD_FILTER_DATA  0x00000000U             /*!< From digital filter */
0456 #define DFSDM_FILTER_AWD_CHANNEL_DATA DFSDM_FLTCR1_AWFSEL     /*!< From analog watchdog channel */
0457 /**
0458   * @}
0459   */
0460 
0461 /** @defgroup DFSDM_Filter_ErrorCode DFSDM filter error code
0462   * @ingroup RTEMSBSPsARMSTM32H7
0463   * @{
0464   */
0465 #define DFSDM_FILTER_ERROR_NONE             0x00000000U /*!< No error */
0466 #define DFSDM_FILTER_ERROR_REGULAR_OVERRUN  0x00000001U /*!< Overrun occurs during regular conversion */
0467 #define DFSDM_FILTER_ERROR_INJECTED_OVERRUN 0x00000002U /*!< Overrun occurs during injected conversion */
0468 #define DFSDM_FILTER_ERROR_DMA              0x00000003U /*!< DMA error occurs */
0469 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
0470 #define DFSDM_FILTER_ERROR_INVALID_CALLBACK 0x00000004U /*!< Invalid callback error occurs */
0471 #endif
0472 /**
0473   * @}
0474   */
0475 
0476 /** @defgroup DFSDM_BreakSignals DFSDM break signals
0477   * @ingroup RTEMSBSPsARMSTM32H7
0478   * @{
0479   */
0480 #define DFSDM_NO_BREAK_SIGNAL 0x00000000U /*!< No break signal */
0481 #define DFSDM_BREAK_SIGNAL_0  0x00000001U /*!< Break signal 0 */
0482 #define DFSDM_BREAK_SIGNAL_1  0x00000002U /*!< Break signal 1 */
0483 #define DFSDM_BREAK_SIGNAL_2  0x00000004U /*!< Break signal 2 */
0484 #define DFSDM_BREAK_SIGNAL_3  0x00000008U /*!< Break signal 3 */
0485 /**
0486   * @}
0487   */
0488 
0489 /** @defgroup DFSDM_Channel_Selection DFSDM Channel Selection
0490   * @ingroup RTEMSBSPsARMSTM32H7
0491   * @{
0492   */
0493 /* DFSDM Channels ------------------------------------------------------------*/
0494 /* The DFSDM channels are defined as follows:
0495    - in 16-bit LSB the channel mask is set
0496    - in 16-bit MSB the channel number is set
0497    e.g. for channel 5 definition:
0498         - the channel mask is 0x00000020 (bit 5 is set)
0499         - the channel number 5 is 0x00050000
0500         --> Consequently, channel 5 definition is 0x00000020 | 0x00050000 = 0x00050020 */
0501 #define DFSDM_CHANNEL_0                              0x00000001U
0502 #define DFSDM_CHANNEL_1                              0x00010002U
0503 #define DFSDM_CHANNEL_2                              0x00020004U
0504 #define DFSDM_CHANNEL_3                              0x00030008U
0505 #define DFSDM_CHANNEL_4                              0x00040010U
0506 #define DFSDM_CHANNEL_5                              0x00050020U
0507 #define DFSDM_CHANNEL_6                              0x00060040U
0508 #define DFSDM_CHANNEL_7                              0x00070080U
0509 /**
0510   * @}
0511   */
0512 
0513 /** @defgroup DFSDM_ContinuousMode DFSDM Continuous Mode
0514   * @ingroup RTEMSBSPsARMSTM32H7
0515   * @{
0516   */
0517 #define DFSDM_CONTINUOUS_CONV_OFF            0x00000000U /*!< Conversion are not continuous */
0518 #define DFSDM_CONTINUOUS_CONV_ON             0x00000001U /*!< Conversion are continuous */
0519 /**
0520   * @}
0521   */
0522 
0523 /** @defgroup DFSDM_AwdThreshold DFSDM analog watchdog threshold
0524   * @ingroup RTEMSBSPsARMSTM32H7
0525   * @{
0526   */
0527 #define DFSDM_AWD_HIGH_THRESHOLD            0x00000000U /*!< Analog watchdog high threshold */
0528 #define DFSDM_AWD_LOW_THRESHOLD             0x00000001U /*!< Analog watchdog low threshold */
0529 /**
0530   * @}
0531   */
0532 
0533 /**
0534   * @}
0535   */
0536 /* End of exported constants -------------------------------------------------*/
0537 
0538 /* Exported macros -----------------------------------------------------------*/
0539 /** @defgroup DFSDM_Exported_Macros DFSDM Exported Macros
0540   * @ingroup RTEMSBSPsARMSTM32H7
0541  * @{
0542  */
0543 
0544 /** @brief  Reset DFSDM channel handle state.
0545   * @param  __HANDLE__ DFSDM channel handle.
0546   * @retval None
0547   */
0548 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
0549 #define __HAL_DFSDM_CHANNEL_RESET_HANDLE_STATE(__HANDLE__) do{                                                      \
0550                                                                (__HANDLE__)->State = HAL_DFSDM_CHANNEL_STATE_RESET; \
0551                                                                (__HANDLE__)->MspInitCallback = NULL;                \
0552                                                                (__HANDLE__)->MspDeInitCallback = NULL;              \
0553                                                              } while(0)
0554 #else
0555 #define __HAL_DFSDM_CHANNEL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DFSDM_CHANNEL_STATE_RESET)
0556 #endif
0557 
0558 /** @brief  Reset DFSDM filter handle state.
0559   * @param  __HANDLE__ DFSDM filter handle.
0560   * @retval None
0561   */
0562 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
0563 #define __HAL_DFSDM_FILTER_RESET_HANDLE_STATE(__HANDLE__) do{                                                     \
0564                                                               (__HANDLE__)->State = HAL_DFSDM_FILTER_STATE_RESET; \
0565                                                               (__HANDLE__)->MspInitCallback = NULL;               \
0566                                                               (__HANDLE__)->MspDeInitCallback = NULL;             \
0567                                                             } while(0)
0568 #else
0569 #define __HAL_DFSDM_FILTER_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DFSDM_FILTER_STATE_RESET)
0570 #endif
0571 
0572 /**
0573   * @}
0574   */
0575 /* End of exported macros ----------------------------------------------------*/
0576 
0577 #if defined(DFSDM_CHDLYR_PLSSKP)
0578 /* Include DFSDM HAL Extension module */
0579 #include "stm32h7xx_hal_dfsdm_ex.h"
0580 #endif /* DFSDM_CHDLYR_PLSSKP */
0581 
0582 /* Exported functions --------------------------------------------------------*/
0583 /** @addtogroup DFSDM_Exported_Functions DFSDM Exported Functions
0584   * @{
0585   */
0586 
0587 /** @addtogroup DFSDM_Exported_Functions_Group1_Channel Channel initialization and de-initialization functions
0588   * @{
0589   */
0590 /* Channel initialization and de-initialization functions *********************/
0591 HAL_StatusTypeDef HAL_DFSDM_ChannelInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
0592 HAL_StatusTypeDef HAL_DFSDM_ChannelDeInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
0593 void HAL_DFSDM_ChannelMspInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
0594 void HAL_DFSDM_ChannelMspDeInit(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
0595 
0596 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
0597 /* Channel callbacks register/unregister functions ****************************/
0598 HAL_StatusTypeDef HAL_DFSDM_Channel_RegisterCallback(DFSDM_Channel_HandleTypeDef        *hdfsdm_channel,
0599                                                      HAL_DFSDM_Channel_CallbackIDTypeDef CallbackID,
0600                                                      pDFSDM_Channel_CallbackTypeDef      pCallback);
0601 HAL_StatusTypeDef HAL_DFSDM_Channel_UnRegisterCallback(DFSDM_Channel_HandleTypeDef        *hdfsdm_channel,
0602                                                        HAL_DFSDM_Channel_CallbackIDTypeDef CallbackID);
0603 #endif
0604 /**
0605   * @}
0606   */
0607 
0608 /** @addtogroup DFSDM_Exported_Functions_Group2_Channel Channel operation functions
0609   * @{
0610   */
0611 /* Channel operation functions ************************************************/
0612 HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStart(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
0613 HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStart_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
0614 HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStop(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
0615 HAL_StatusTypeDef HAL_DFSDM_ChannelCkabStop_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
0616 
0617 HAL_StatusTypeDef HAL_DFSDM_ChannelScdStart(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t Threshold, uint32_t BreakSignal);
0618 HAL_StatusTypeDef HAL_DFSDM_ChannelScdStart_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t Threshold, uint32_t BreakSignal);
0619 HAL_StatusTypeDef HAL_DFSDM_ChannelScdStop(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
0620 HAL_StatusTypeDef HAL_DFSDM_ChannelScdStop_IT(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
0621 
0622 int16_t           HAL_DFSDM_ChannelGetAwdValue(const DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
0623 HAL_StatusTypeDef HAL_DFSDM_ChannelModifyOffset(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, int32_t Offset);
0624 
0625 HAL_StatusTypeDef HAL_DFSDM_ChannelPollForCkab(const DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t Timeout);
0626 HAL_StatusTypeDef HAL_DFSDM_ChannelPollForScd(const DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t Timeout);
0627 
0628 void HAL_DFSDM_ChannelCkabCallback(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
0629 void HAL_DFSDM_ChannelScdCallback(DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
0630 /**
0631   * @}
0632   */
0633 
0634 /** @defgroup DFSDM_Exported_Functions_Group3_Channel Channel state function
0635   * @ingroup RTEMSBSPsARMSTM32H7
0636   * @{
0637   */
0638 /* Channel state function *****************************************************/
0639 HAL_DFSDM_Channel_StateTypeDef HAL_DFSDM_ChannelGetState(const DFSDM_Channel_HandleTypeDef *hdfsdm_channel);
0640 /**
0641   * @}
0642   */
0643 
0644 /** @addtogroup DFSDM_Exported_Functions_Group1_Filter Filter initialization and de-initialization functions
0645   * @{
0646   */
0647 /* Filter initialization and de-initialization functions *********************/
0648 HAL_StatusTypeDef HAL_DFSDM_FilterInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
0649 HAL_StatusTypeDef HAL_DFSDM_FilterDeInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
0650 void HAL_DFSDM_FilterMspInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
0651 void HAL_DFSDM_FilterMspDeInit(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
0652 
0653 #if (USE_HAL_DFSDM_REGISTER_CALLBACKS == 1)
0654 /* Filter callbacks register/unregister functions ****************************/
0655 HAL_StatusTypeDef HAL_DFSDM_Filter_RegisterCallback(DFSDM_Filter_HandleTypeDef        *hdfsdm_filter,
0656                                                     HAL_DFSDM_Filter_CallbackIDTypeDef CallbackID,
0657                                                     pDFSDM_Filter_CallbackTypeDef      pCallback);
0658 HAL_StatusTypeDef HAL_DFSDM_Filter_UnRegisterCallback(DFSDM_Filter_HandleTypeDef        *hdfsdm_filter,
0659                                                       HAL_DFSDM_Filter_CallbackIDTypeDef CallbackID);
0660 HAL_StatusTypeDef HAL_DFSDM_Filter_RegisterAwdCallback(DFSDM_Filter_HandleTypeDef      *hdfsdm_filter,
0661                                                        pDFSDM_Filter_AwdCallbackTypeDef pCallback);
0662 HAL_StatusTypeDef HAL_DFSDM_Filter_UnRegisterAwdCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
0663 #endif
0664 /**
0665   * @}
0666   */
0667 
0668 /** @addtogroup DFSDM_Exported_Functions_Group2_Filter Filter control functions
0669   * @{
0670   */
0671 /* Filter control functions *********************/
0672 HAL_StatusTypeDef HAL_DFSDM_FilterConfigRegChannel(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
0673                                                    uint32_t                    Channel,
0674                                                    uint32_t                    ContinuousMode);
0675 HAL_StatusTypeDef HAL_DFSDM_FilterConfigInjChannel(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
0676                                                    uint32_t                    Channel);
0677 /**
0678   * @}
0679   */
0680 
0681 /** @addtogroup DFSDM_Exported_Functions_Group3_Filter Filter operation functions
0682   * @{
0683   */
0684 /* Filter operation functions *********************/
0685 HAL_StatusTypeDef HAL_DFSDM_FilterRegularStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
0686 HAL_StatusTypeDef HAL_DFSDM_FilterRegularStart_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
0687 HAL_StatusTypeDef HAL_DFSDM_FilterRegularStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, int32_t *pData, uint32_t Length);
0688 HAL_StatusTypeDef HAL_DFSDM_FilterRegularMsbStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, int16_t *pData, uint32_t Length);
0689 HAL_StatusTypeDef HAL_DFSDM_FilterRegularStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
0690 HAL_StatusTypeDef HAL_DFSDM_FilterRegularStop_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
0691 HAL_StatusTypeDef HAL_DFSDM_FilterRegularStop_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
0692 HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
0693 HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStart_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
0694 HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, int32_t *pData, uint32_t Length);
0695 HAL_StatusTypeDef HAL_DFSDM_FilterInjectedMsbStart_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, int16_t *pData, uint32_t Length);
0696 HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
0697 HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStop_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
0698 HAL_StatusTypeDef HAL_DFSDM_FilterInjectedStop_DMA(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
0699 HAL_StatusTypeDef HAL_DFSDM_FilterAwdStart_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter,
0700                                               const DFSDM_Filter_AwdParamTypeDef *awdParam);
0701 HAL_StatusTypeDef HAL_DFSDM_FilterAwdStop_IT(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
0702 HAL_StatusTypeDef HAL_DFSDM_FilterExdStart(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Channel);
0703 HAL_StatusTypeDef HAL_DFSDM_FilterExdStop(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
0704 
0705 int32_t  HAL_DFSDM_FilterGetRegularValue(const DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t *Channel);
0706 int32_t  HAL_DFSDM_FilterGetInjectedValue(const DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t *Channel);
0707 int32_t  HAL_DFSDM_FilterGetExdMaxValue(const DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t *Channel);
0708 int32_t  HAL_DFSDM_FilterGetExdMinValue(const DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t *Channel);
0709 uint32_t HAL_DFSDM_FilterGetConvTimeValue(const DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
0710 
0711 void HAL_DFSDM_IRQHandler(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
0712 
0713 HAL_StatusTypeDef HAL_DFSDM_FilterPollForRegConversion(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Timeout);
0714 HAL_StatusTypeDef HAL_DFSDM_FilterPollForInjConversion(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Timeout);
0715 
0716 void HAL_DFSDM_FilterRegConvCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
0717 void HAL_DFSDM_FilterRegConvHalfCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
0718 void HAL_DFSDM_FilterInjConvCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
0719 void HAL_DFSDM_FilterInjConvHalfCpltCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
0720 void HAL_DFSDM_FilterAwdCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter, uint32_t Channel, uint32_t Threshold);
0721 void HAL_DFSDM_FilterErrorCallback(DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
0722 /**
0723   * @}
0724   */
0725 
0726 /** @defgroup DFSDM_Exported_Functions_Group4_Filter Filter state functions
0727   * @ingroup RTEMSBSPsARMSTM32H7
0728   * @{
0729   */
0730 /* Filter state functions *****************************************************/
0731 HAL_DFSDM_Filter_StateTypeDef HAL_DFSDM_FilterGetState(const DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
0732 uint32_t                      HAL_DFSDM_FilterGetError(const DFSDM_Filter_HandleTypeDef *hdfsdm_filter);
0733 /**
0734   * @}
0735   */
0736 
0737 /**
0738   * @}
0739   */
0740 /* End of exported functions -------------------------------------------------*/
0741 
0742 /* Private macros ------------------------------------------------------------*/
0743 /** @defgroup DFSDM_Private_Macros DFSDM Private Macros
0744   * @ingroup RTEMSBSPsARMSTM32H7
0745 * @{
0746 */
0747 #define IS_DFSDM_CHANNEL_OUTPUT_CLOCK(CLOCK)          (((CLOCK) == DFSDM_CHANNEL_OUTPUT_CLOCK_SYSTEM) || \
0748                                                        ((CLOCK) == DFSDM_CHANNEL_OUTPUT_CLOCK_AUDIO))
0749 #define IS_DFSDM_CHANNEL_OUTPUT_CLOCK_DIVIDER(DIVIDER) ((2U <= (DIVIDER)) && ((DIVIDER) <= 256U))
0750 #define IS_DFSDM_CHANNEL_INPUT(INPUT)                 (((INPUT) == DFSDM_CHANNEL_EXTERNAL_INPUTS) || \
0751                                                        ((INPUT) == DFSDM_CHANNEL_ADC_OUTPUT) || \
0752                                                        ((INPUT) == DFSDM_CHANNEL_INTERNAL_REGISTER))
0753 #define IS_DFSDM_CHANNEL_DATA_PACKING(MODE)           (((MODE) == DFSDM_CHANNEL_STANDARD_MODE) || \
0754                                                        ((MODE) == DFSDM_CHANNEL_INTERLEAVED_MODE) || \
0755                                                        ((MODE) == DFSDM_CHANNEL_DUAL_MODE))
0756 #define IS_DFSDM_CHANNEL_INPUT_PINS(PINS)             (((PINS) == DFSDM_CHANNEL_SAME_CHANNEL_PINS) || \
0757                                                        ((PINS) == DFSDM_CHANNEL_FOLLOWING_CHANNEL_PINS))
0758 #define IS_DFSDM_CHANNEL_SERIAL_INTERFACE_TYPE(MODE)  (((MODE) == DFSDM_CHANNEL_SPI_RISING) || \
0759                                                        ((MODE) == DFSDM_CHANNEL_SPI_FALLING) || \
0760                                                        ((MODE) == DFSDM_CHANNEL_MANCHESTER_RISING) || \
0761                                                        ((MODE) == DFSDM_CHANNEL_MANCHESTER_FALLING))
0762 #define IS_DFSDM_CHANNEL_SPI_CLOCK(TYPE)              (((TYPE) == DFSDM_CHANNEL_SPI_CLOCK_EXTERNAL) || \
0763                                                        ((TYPE) == DFSDM_CHANNEL_SPI_CLOCK_INTERNAL) || \
0764                                                        ((TYPE) == DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_FALLING) || \
0765                                                        ((TYPE) == DFSDM_CHANNEL_SPI_CLOCK_INTERNAL_DIV2_RISING))
0766 #define IS_DFSDM_CHANNEL_FILTER_ORDER(ORDER)          (((ORDER) == DFSDM_CHANNEL_FASTSINC_ORDER) || \
0767                                                        ((ORDER) == DFSDM_CHANNEL_SINC1_ORDER) || \
0768                                                        ((ORDER) == DFSDM_CHANNEL_SINC2_ORDER) || \
0769                                                        ((ORDER) == DFSDM_CHANNEL_SINC3_ORDER))
0770 #define IS_DFSDM_CHANNEL_FILTER_OVS_RATIO(RATIO)       ((1U <= (RATIO)) && ((RATIO) <= 32U))
0771 #define IS_DFSDM_CHANNEL_OFFSET(VALUE)                 ((-8388608 <= (VALUE)) && ((VALUE) <= 8388607))
0772 #define IS_DFSDM_CHANNEL_RIGHT_BIT_SHIFT(VALUE)        ((VALUE) <= 0x1FU)
0773 #define IS_DFSDM_CHANNEL_SCD_THRESHOLD(VALUE)          ((VALUE) <= 0xFFU)
0774 #define IS_DFSDM_FILTER_REG_TRIGGER(TRIG)             (((TRIG) == DFSDM_FILTER_SW_TRIGGER) || \
0775                                                        ((TRIG) == DFSDM_FILTER_SYNC_TRIGGER))
0776 #define IS_DFSDM_FILTER_INJ_TRIGGER(TRIG)             (((TRIG) == DFSDM_FILTER_SW_TRIGGER) || \
0777                                                        ((TRIG) == DFSDM_FILTER_SYNC_TRIGGER) || \
0778                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIGGER))
0779 #if (STM32H7_DEV_ID == 0x480UL)
0780 #define IS_DFSDM_FILTER_EXT_TRIG(TRIG)                (((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM1_TRGO) || \
0781                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM1_TRGO2) || \
0782                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM8_TRGO) || \
0783                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM8_TRGO2) || \
0784                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM3_TRGO) || \
0785                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM4_TRGO) || \
0786                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM16_OC1) || \
0787                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM6_TRGO) || \
0788                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM7_TRGO) || \
0789                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_EXTI11) || \
0790                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_EXTI15) || \
0791                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_LPTIM1_OUT) || \
0792                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_LPTIM2_OUT) || \
0793                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_LPTIM3_OUT) || \
0794                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_COMP1_OUT) || \
0795                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_COMP2_OUT))
0796 #elif (STM32H7_DEV_ID == 0x483UL)
0797 #define IS_DFSDM_FILTER_EXT_TRIG(TRIG)                (((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM1_TRGO) || \
0798                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM1_TRGO2) || \
0799                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM8_TRGO) || \
0800                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM8_TRGO2) || \
0801                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM3_TRGO) || \
0802                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM4_TRGO) || \
0803                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM16_OC1) || \
0804                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM6_TRGO) || \
0805                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM7_TRGO) || \
0806                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_EXTI11) || \
0807                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_EXTI15) || \
0808                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_LPTIM1_OUT) || \
0809                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_LPTIM2_OUT) || \
0810                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_LPTIM3_OUT) || \
0811                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM23_TRGO) || \
0812                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM24_TRGO))
0813 
0814 #else
0815 #define IS_DFSDM_FILTER_EXT_TRIG(TRIG)                (((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM1_TRGO) || \
0816                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM1_TRGO2) || \
0817                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM8_TRGO) || \
0818                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM8_TRGO2) || \
0819                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM3_TRGO) || \
0820                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM4_TRGO) || \
0821                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM16_OC1) || \
0822                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM6_TRGO) || \
0823                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_TIM7_TRGO) || \
0824                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_HRTIM1_ADCTRG1) || \
0825                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_HRTIM1_ADCTRG3) || \
0826                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_EXTI11) || \
0827                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_EXTI15) || \
0828                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_LPTIM1_OUT) || \
0829                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_LPTIM2_OUT) || \
0830                                                        ((TRIG) == DFSDM_FILTER_EXT_TRIG_LPTIM3_OUT))
0831 #endif /* STM32H7_DEV_ID == 0x480UL */
0832 #define IS_DFSDM_FILTER_EXT_TRIG_EDGE(EDGE)           (((EDGE) == DFSDM_FILTER_EXT_TRIG_RISING_EDGE)  || \
0833                                                        ((EDGE) == DFSDM_FILTER_EXT_TRIG_FALLING_EDGE)  || \
0834                                                        ((EDGE) == DFSDM_FILTER_EXT_TRIG_BOTH_EDGES))
0835 #define IS_DFSDM_FILTER_SINC_ORDER(ORDER)             (((ORDER) == DFSDM_FILTER_FASTSINC_ORDER) || \
0836                                                        ((ORDER) == DFSDM_FILTER_SINC1_ORDER) || \
0837                                                        ((ORDER) == DFSDM_FILTER_SINC2_ORDER) || \
0838                                                        ((ORDER) == DFSDM_FILTER_SINC3_ORDER) || \
0839                                                        ((ORDER) == DFSDM_FILTER_SINC4_ORDER) || \
0840                                                        ((ORDER) == DFSDM_FILTER_SINC5_ORDER))
0841 #define IS_DFSDM_FILTER_OVS_RATIO(RATIO)               ((1U <= (RATIO)) && ((RATIO) <= 1024U))
0842 #define IS_DFSDM_FILTER_INTEGRATOR_OVS_RATIO(RATIO)    ((1U <= (RATIO)) && ((RATIO) <= 256U))
0843 #define IS_DFSDM_FILTER_AWD_DATA_SOURCE(DATA)         (((DATA) == DFSDM_FILTER_AWD_FILTER_DATA)  || \
0844                                                        ((DATA) == DFSDM_FILTER_AWD_CHANNEL_DATA))
0845 #define IS_DFSDM_FILTER_AWD_THRESHOLD(VALUE)           ((-8388608 <= (VALUE)) && ((VALUE) <= 8388607))
0846 #define IS_DFSDM_BREAK_SIGNALS(VALUE)                  ((VALUE) <= 0xFU)
0847 #define IS_DFSDM_REGULAR_CHANNEL(CHANNEL)             (((CHANNEL) == DFSDM_CHANNEL_0)  || \
0848                                                        ((CHANNEL) == DFSDM_CHANNEL_1)  || \
0849                                                        ((CHANNEL) == DFSDM_CHANNEL_2)  || \
0850                                                        ((CHANNEL) == DFSDM_CHANNEL_3)  || \
0851                                                        ((CHANNEL) == DFSDM_CHANNEL_4)  || \
0852                                                        ((CHANNEL) == DFSDM_CHANNEL_5)  || \
0853                                                        ((CHANNEL) == DFSDM_CHANNEL_6)  || \
0854                                                        ((CHANNEL) == DFSDM_CHANNEL_7))
0855 #define IS_DFSDM_INJECTED_CHANNEL(CHANNEL)            (((CHANNEL) != 0U) && ((CHANNEL) <= 0x000F00FFU))
0856 #define IS_DFSDM_CONTINUOUS_MODE(MODE)                (((MODE) == DFSDM_CONTINUOUS_CONV_OFF)  || \
0857                                                        ((MODE) == DFSDM_CONTINUOUS_CONV_ON))
0858 #if defined(DFSDM2_Channel0)
0859 #define IS_DFSDM1_CHANNEL_INSTANCE(INSTANCE)          (((INSTANCE) == DFSDM1_Channel0) || \
0860                                                        ((INSTANCE) == DFSDM1_Channel1) || \
0861                                                        ((INSTANCE) == DFSDM1_Channel2) || \
0862                                                        ((INSTANCE) == DFSDM1_Channel3) || \
0863                                                        ((INSTANCE) == DFSDM1_Channel4) || \
0864                                                        ((INSTANCE) == DFSDM1_Channel5) || \
0865                                                        ((INSTANCE) == DFSDM1_Channel6) || \
0866                                                        ((INSTANCE) == DFSDM1_Channel7))
0867 #define IS_DFSDM1_FILTER_INSTANCE(INSTANCE)           (((INSTANCE) == DFSDM1_Filter0) || \
0868                                                        ((INSTANCE) == DFSDM1_Filter1) || \
0869                                                        ((INSTANCE) == DFSDM1_Filter2) || \
0870                                                        ((INSTANCE) == DFSDM1_Filter3) || \
0871                                                        ((INSTANCE) == DFSDM1_Filter4) || \
0872                                                        ((INSTANCE) == DFSDM1_Filter5) || \
0873                                                        ((INSTANCE) == DFSDM1_Filter6) || \
0874                                                        ((INSTANCE) == DFSDM1_Filter7))
0875 #endif /* DFSDM2_Channel0 */
0876 /**
0877   * @}
0878   */
0879 /* End of private macros -----------------------------------------------------*/
0880 
0881 /**
0882   * @}
0883   */
0884 
0885 /**
0886   * @}
0887   */
0888 
0889 #ifdef __cplusplus
0890 }
0891 #endif
0892 
0893 #endif /* STM32H7xx_HAL_DFSDM_H */
0894