stm32f7xx_hal_dfsdm.c File Reference

This file provides firmware functions to manage the following functionalities of the Digital Filter for Sigma-Delta Modulators (DFSDM) peripherals: More...

#include "stm32f7xx_hal.h"
Include dependency graph for stm32f7xx_hal_dfsdm.c:

Go to the source code of this file.

Detailed Description

This file provides firmware functions to manage the following functionalities of the Digital Filter for Sigma-Delta Modulators (DFSDM) peripherals:

Author
MCD Application Team
  • Initialization and configuration of channels and filters
  • Regular channels configuration
  • Injected channels configuration
  • Regular/Injected Channels DMA Configuration
  • Interrupts and flags management
  • Analog watchdog feature
  • Short-circuit detector feature
  • Extremes detector feature
  • Clock absence detector feature
  • Break generation on analog watchdog or short-circuit event
==============================================================================
                   ##### How to use this driver #####
==============================================================================
[..]
  *** Channel initialization ***
  ==============================
  [..]
    (#) User has first to initialize channels (before filters initialization).
    (#) As prerequisite, fill in the HAL_DFSDM_ChannelMspInit() :
      (++) Enable DFSDMz clock interface with __HAL_RCC_DFSDMz_CLK_ENABLE().
      (++) Enable the clocks for the DFSDMz GPIOS with __HAL_RCC_GPIOx_CLK_ENABLE().
      (++) Configure these DFSDMz pins in alternate mode using HAL_GPIO_Init().
      (++) If interrupt mode is used, enable and configure DFSDMz_FLT0 global
          interrupt with HAL_NVIC_SetPriority() and HAL_NVIC_EnableIRQ().
    (#) Configure the output clock, input, serial interface, analog watchdog,
        offset and data right bit shift parameters for this channel using the 
        HAL_DFSDM_ChannelInit() function.

  *** Channel clock absence detector ***
  ======================================
  [..]
    (#) Start clock absence detector using HAL_DFSDM_ChannelCkabStart() or
        HAL_DFSDM_ChannelCkabStart_IT().
    (#) In polling mode, use HAL_DFSDM_ChannelPollForCkab() to detect the clock
        absence.
    (#) In interrupt mode, HAL_DFSDM_ChannelCkabCallback() will be called if
        clock absence is detected.
    (#) Stop clock absence detector using HAL_DFSDM_ChannelCkabStop() or
        HAL_DFSDM_ChannelCkabStop_IT().
    (#) Please note that the same mode (polling or interrupt) has to be used 
        for all channels because the channels are sharing the same interrupt.
    (#) Please note also that in interrupt mode, if clock absence detector is
        stopped for one channel, interrupt will be disabled for all channels.

  *** Channel short circuit detector ***
  ======================================
  [..]    
    (#) Start short circuit detector using HAL_DFSDM_ChannelScdStart() or
        or HAL_DFSDM_ChannelScdStart_IT().
    (#) In polling mode, use HAL_DFSDM_ChannelPollForScd() to detect short
        circuit.
    (#) In interrupt mode, HAL_DFSDM_ChannelScdCallback() will be called if 
        short circuit is detected.
    (#) Stop short circuit detector using HAL_DFSDM_ChannelScdStop() or
        or HAL_DFSDM_ChannelScdStop_IT().
    (#) Please note that the same mode (polling or interrupt) has to be used 
        for all channels because the channels are sharing the same interrupt.
    (#) Please note also that in interrupt mode, if short circuit detector is
        stopped for one channel, interrupt will be disabled for all channels.

  *** Channel analog watchdog value ***
  =====================================
  [..]    
    (#) Get analog watchdog filter value of a channel using
        HAL_DFSDM_ChannelGetAwdValue().

  *** Channel offset value ***
  =====================================
  [..]    
    (#) Modify offset value of a channel using HAL_DFSDM_ChannelModifyOffset().

  *** Filter initialization ***
  =============================
  [..]
    (#) After channel initialization, user has to init filters.
    (#) As prerequisite, fill in the HAL_DFSDM_FilterMspInit() :
      (++) If interrupt mode is used , enable and configure DFSDMz_FLTx global
          interrupt with HAL_NVIC_SetPriority() and HAL_NVIC_EnableIRQ().
          Please note that DFSDMz_FLT0 global interrupt could be already
          enabled if interrupt is used for channel.
      (++) If DMA mode is used, configure DMA with HAL_DMA_Init() and link it
          with DFSDMz filter handle using __HAL_LINKDMA().
    (#) Configure the regular conversion, injected conversion and filter
        parameters for this filter using the HAL_DFSDM_FilterInit() function.

  *** Filter regular channel conversion ***
  =========================================
  [..]    
    (#) Select regular channel and enable/disable continuous mode using
        HAL_DFSDM_FilterConfigRegChannel().
    (#) Start regular conversion using HAL_DFSDM_FilterRegularStart(),
        HAL_DFSDM_FilterRegularStart_IT(), HAL_DFSDM_FilterRegularStart_DMA() or
        HAL_DFSDM_FilterRegularMsbStart_DMA().
    (#) In polling mode, use HAL_DFSDM_FilterPollForRegConversion() to detect 
        the end of regular conversion.
    (#) In interrupt mode, HAL_DFSDM_FilterRegConvCpltCallback() will be called
        at the end of regular conversion.
    (#) Get value of regular conversion and corresponding channel using 
        HAL_DFSDM_FilterGetRegularValue().
    (#) In DMA mode, HAL_DFSDM_FilterRegConvHalfCpltCallback() and 
        HAL_DFSDM_FilterRegConvCpltCallback() will be called respectively at the
        half transfer and at the transfer complete. Please note that 
        HAL_DFSDM_FilterRegConvHalfCpltCallback() will be called only in DMA
        circular mode.
    (#) Stop regular conversion using HAL_DFSDM_FilterRegularStop(),
        HAL_DFSDM_FilterRegularStop_IT() or HAL_DFSDM_FilterRegularStop_DMA().

  *** Filter injected channels conversion ***
  ===========================================
  [..]
    (#) Select injected channels using HAL_DFSDM_FilterConfigInjChannel().
    (#) Start injected conversion using HAL_DFSDM_FilterInjectedStart(),
        HAL_DFSDM_FilterInjectedStart_IT(), HAL_DFSDM_FilterInjectedStart_DMA() or
        HAL_DFSDM_FilterInjectedMsbStart_DMA().
    (#) In polling mode, use HAL_DFSDM_FilterPollForInjConversion() to detect 
        the end of injected conversion.
    (#) In interrupt mode, HAL_DFSDM_FilterInjConvCpltCallback() will be called
        at the end of injected conversion.
    (#) Get value of injected conversion and corresponding channel using 
        HAL_DFSDM_FilterGetInjectedValue().
    (#) In DMA mode, HAL_DFSDM_FilterInjConvHalfCpltCallback() and 
        HAL_DFSDM_FilterInjConvCpltCallback() will be called respectively at the
        half transfer and at the transfer complete. Please note that 
        HAL_DFSDM_FilterInjConvCpltCallback() will be called only in DMA
        circular mode.
    (#) Stop injected conversion using HAL_DFSDM_FilterInjectedStop(),
        HAL_DFSDM_FilterInjectedStop_IT() or HAL_DFSDM_FilterInjectedStop_DMA().

  *** Filter analog watchdog ***
  ==============================
  [..]
    (#) Start filter analog watchdog using HAL_DFSDM_FilterAwdStart_IT().
    (#) HAL_DFSDM_FilterAwdCallback() will be called if analog watchdog occurs.
    (#) Stop filter analog watchdog using HAL_DFSDM_FilterAwdStop_IT().

  *** Filter extreme detector ***
  ===============================
  [..]
    (#) Start filter extreme detector using HAL_DFSDM_FilterExdStart().
    (#) Get extreme detector maximum value using HAL_DFSDM_FilterGetExdMaxValue().
    (#) Get extreme detector minimum value using HAL_DFSDM_FilterGetExdMinValue().
    (#) Start filter extreme detector using HAL_DFSDM_FilterExdStop().

  *** Filter conversion time ***
  ==============================
  [..]
    (#) Get conversion time value using HAL_DFSDM_FilterGetConvTimeValue().

  *** Callback registration ***
  =============================
  [..]
  The compilation define USE_HAL_DFSDM_REGISTER_CALLBACKS when set to 1
  allows the user to configure dynamically the driver callbacks.
  Use functions HAL_DFSDM_Channel_RegisterCallback(),
  HAL_DFSDM_Filter_RegisterCallback() or
  HAL_DFSDM_Filter_RegisterAwdCallback() to register a user callback.

  [..]
  Function HAL_DFSDM_Channel_RegisterCallback() allows to register
  following callbacks:
    (+) CkabCallback      : DFSDM channel clock absence detection callback.
    (+) ScdCallback       : DFSDM channel short circuit detection callback.
    (+) MspInitCallback   : DFSDM channel MSP init callback.
    (+) MspDeInitCallback : DFSDM channel MSP de-init callback.
  [..]
  This function takes as parameters the HAL peripheral handle, the Callback ID
  and a pointer to the user callback function.

  [..]
  Function HAL_DFSDM_Filter_RegisterCallback() allows to register
  following callbacks:
    (+) RegConvCpltCallback     : DFSDM filter regular conversion complete callback.
    (+) RegConvHalfCpltCallback : DFSDM filter half regular conversion complete callback.
    (+) InjConvCpltCallback     : DFSDM filter injected conversion complete callback.
    (+) InjConvHalfCpltCallback : DFSDM filter half injected conversion complete callback.
    (+) ErrorCallback           : DFSDM filter error callback.
    (+) MspInitCallback         : DFSDM filter MSP init callback.
    (+) MspDeInitCallback       : DFSDM filter MSP de-init callback.
  [..]
  This function takes as parameters the HAL peripheral handle, the Callback ID
  and a pointer to the user callback function.

  [..]
  For specific DFSDM filter analog watchdog callback use dedicated register callback:   
  HAL_DFSDM_Filter_RegisterAwdCallback().

  [..]
  Use functions HAL_DFSDM_Channel_UnRegisterCallback() or
  HAL_DFSDM_Filter_UnRegisterCallback() to reset a callback to the default
  weak function.

  [..]
  HAL_DFSDM_Channel_UnRegisterCallback() takes as parameters the HAL peripheral handle,
  and the Callback ID.
  [..]
  This function allows to reset following callbacks:
    (+) CkabCallback      : DFSDM channel clock absence detection callback.
    (+) ScdCallback       : DFSDM channel short circuit detection callback.
    (+) MspInitCallback   : DFSDM channel MSP init callback.
    (+) MspDeInitCallback : DFSDM channel MSP de-init callback.

  [..]
  HAL_DFSDM_Filter_UnRegisterCallback() takes as parameters the HAL peripheral handle,
  and the Callback ID.
  [..]
  This function allows to reset following callbacks:
    (+) RegConvCpltCallback     : DFSDM filter regular conversion complete callback.
    (+) RegConvHalfCpltCallback : DFSDM filter half regular conversion complete callback.
    (+) InjConvCpltCallback     : DFSDM filter injected conversion complete callback.
    (+) InjConvHalfCpltCallback : DFSDM filter half injected conversion complete callback.
    (+) ErrorCallback           : DFSDM filter error callback.
    (+) MspInitCallback         : DFSDM filter MSP init callback.
    (+) MspDeInitCallback       : DFSDM filter MSP de-init callback.

  [..]
  For specific DFSDM filter analog watchdog callback use dedicated unregister callback:
  HAL_DFSDM_Filter_UnRegisterAwdCallback().

  [..]
  By default, after the call of init function and if the state is RESET 
  all callbacks are reset to the corresponding legacy weak functions: 
  examples HAL_DFSDM_ChannelScdCallback(), HAL_DFSDM_FilterErrorCallback().
  Exception done for MspInit and MspDeInit callbacks that are respectively
  reset to the legacy weak functions in the init and de-init only when these 
  callbacks are null (not registered beforehand).
  If not, MspInit or MspDeInit are not null, the init and de-init keep and use
  the user MspInit/MspDeInit callbacks (registered beforehand)

  [..]
  Callbacks can be registered/unregistered in READY state only.
  Exception done for MspInit/MspDeInit callbacks that can be registered/unregistered
  in READY or RESET state, thus registered (user) MspInit/DeInit callbacks can be used
  during the init/de-init.
  In that case first register the MspInit/MspDeInit user callbacks using 
  HAL_DFSDM_Channel_RegisterCallback() or
  HAL_DFSDM_Filter_RegisterCallback() before calling init or de-init function.

  [..]
  When The compilation define USE_HAL_DFSDM_REGISTER_CALLBACKS is set to 0 or
  not defined, the callback registering feature is not available 
  and weak callbacks are used.
Attention

© Copyright (c) 2017 STMicroelectronics. All rights reserved.

This software component is licensed by ST under BSD 3-Clause license, the "License"; You may not use this file except in compliance with the License. You may obtain a copy of the License at: opensource.org/licenses/BSD-3-Clause

Definition in file stm32f7xx_hal_dfsdm.c.



picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:15:02