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