STM32H735xx HAL User Manual
stm32h7xx_hal_dfsdm_ex.c
Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32h7xx_hal_dfsdm_ex.c
00004   * @author  MCD Application Team
00005   * @brief   DFSDM Extended HAL module driver.
00006   *          This file provides firmware functions to manage the following
00007   *          functionality of the DFSDM Peripheral Controller:
00008   *           + Set and get pulses skipping on channel.
00009   *
00010   ******************************************************************************
00011   * @attention
00012   *
00013   * Copyright (c) 2017 STMicroelectronics.
00014   * All rights reserved.
00015   *
00016   * This software is licensed under terms that can be found in the LICENSE file
00017   * in the root directory of this software component.
00018   * If no LICENSE file comes with this software, it is provided AS-IS.
00019   *
00020   ******************************************************************************
00021   */
00022 
00023 /* Includes ------------------------------------------------------------------*/
00024 #include "stm32h7xx_hal.h"
00025 
00026 /** @addtogroup STM32H7xx_HAL_Driver
00027   * @{
00028   */
00029 
00030 #ifdef HAL_DFSDM_MODULE_ENABLED
00031 
00032 #if defined(DFSDM_CHDLYR_PLSSKP)
00033 
00034 /** @defgroup DFSDMEx DFSDMEx
00035   * @brief DFSDM Extended HAL module driver
00036   * @{
00037   */
00038 
00039 /* Private types -------------------------------------------------------------*/
00040 /* Private variables ---------------------------------------------------------*/
00041 /* Private constants ---------------------------------------------------------*/
00042 /* Private macros ------------------------------------------------------------*/
00043 /* Private functions ---------------------------------------------------------*/
00044 /* Exported functions --------------------------------------------------------*/
00045 
00046 /** @defgroup DFSDMEx_Exported_Functions DFSDM Extended Exported Functions
00047   * @{
00048   */
00049 
00050 /** @defgroup DFSDMEx_Exported_Functions_Group1_Channel Extended channel operation functions
00051   * @brief    DFSDM extended channel operation functions
00052  *
00053 @verbatim
00054  ===============================================================================
00055                ##### Extended channel operation functions #####
00056  ===============================================================================
00057     [..]  This section provides functions allowing to:
00058       (+) Set and get value of pulses skipping on channel
00059 
00060 @endverbatim
00061   * @{
00062   */
00063 
00064 /**
00065   * @brief  Set value of pulses skipping.
00066   * @param  hdfsdm_channel DFSDM channel handle.
00067   * @param  PulsesValue Value of pulses to be skipped.
00068   *         This parameter must be a number between Min_Data = 0 and Max_Data = 63.
00069   * @retval HAL status.
00070   */
00071 HAL_StatusTypeDef HAL_DFDSMEx_ChannelSetPulsesSkipping(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t PulsesValue)
00072 {
00073   HAL_StatusTypeDef status = HAL_OK;
00074 
00075   /* Check pulses value */
00076   assert_param(IS_DFSDM_CHANNEL_SKIPPING_VALUE(PulsesValue));
00077 
00078   /* Check DFSDM channel state */
00079   if (hdfsdm_channel->State == HAL_DFSDM_CHANNEL_STATE_READY)
00080   {
00081     /* Set new value of pulses skipping */
00082     hdfsdm_channel->Instance->CHDLYR = (PulsesValue & DFSDM_CHDLYR_PLSSKP);
00083   }
00084   else
00085   {
00086     status = HAL_ERROR;
00087   }
00088   return status;
00089 }
00090 
00091 /**
00092   * @brief  Get value of pulses skipping.
00093   * @param  hdfsdm_channel DFSDM channel handle.
00094   * @param  PulsesValue Value of pulses to be skipped.
00095   * @retval HAL status.
00096   */
00097 HAL_StatusTypeDef HAL_DFDSMEx_ChannelGetPulsesSkipping(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t *PulsesValue)
00098 {
00099   HAL_StatusTypeDef status = HAL_OK;
00100 
00101   /* Check DFSDM channel state */
00102   if (hdfsdm_channel->State == HAL_DFSDM_CHANNEL_STATE_READY)
00103   {
00104     /* Get value of remaining pulses to be skipped */
00105     *PulsesValue = (hdfsdm_channel->Instance->CHDLYR & DFSDM_CHDLYR_PLSSKP);
00106   }
00107   else
00108   {
00109     status = HAL_ERROR;
00110   }
00111   return status;
00112 }
00113 
00114 /**
00115   * @}
00116   */
00117 
00118 /**
00119   * @}
00120   */
00121 
00122 /**
00123   * @}
00124   */
00125 
00126 #endif /* DFSDM_CHDLYR_PLSSKP */
00127 
00128 #endif /* HAL_DFSDM_MODULE_ENABLED */
00129 
00130 /**
00131   * @}
00132   */
00133