STM32L443xx HAL User Manual
stm32l4xx_hal_dfsdm_ex.c
Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32l4xx_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 "stm32l4xx_hal.h"
00025 
00026 /** @addtogroup STM32L4xx_HAL_Driver
00027   * @{
00028   */
00029 
00030 #ifdef HAL_DFSDM_MODULE_ENABLED
00031 
00032 #if defined(STM32L4R5xx) || defined(STM32L4R7xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx) || \
00033     defined(STM32L4P5xx) || defined(STM32L4Q5xx)
00034 
00035 /** @defgroup DFSDMEx DFSDMEx
00036   * @brief DFSDM Extended HAL module driver
00037   * @{
00038   */
00039 
00040 /* Private types -------------------------------------------------------------*/
00041 /* Private variables ---------------------------------------------------------*/
00042 /* Private constants ---------------------------------------------------------*/
00043 /* Private macros ------------------------------------------------------------*/
00044 /* Private functions ---------------------------------------------------------*/
00045 /* Exported functions --------------------------------------------------------*/
00046 
00047 /** @defgroup DFSDMEx_Exported_Functions DFSDM Extended Exported Functions
00048   * @{
00049   */
00050 
00051 /** @defgroup DFSDMEx_Exported_Functions_Group1_Channel Extended channel operation functions
00052   * @brief    DFSDM extended channel operation functions
00053  *
00054 @verbatim
00055  ===============================================================================
00056                ##### Extended channel operation functions #####
00057  ===============================================================================
00058     [..]  This section provides functions allowing to:
00059       (+) Set and get value of pulses skipping on channel
00060 
00061 @endverbatim
00062   * @{
00063   */
00064 
00065 /**
00066   * @brief  Set value of pulses skipping.
00067   * @param  hdfsdm_channel DFSDM channel handle.
00068   * @param  PulsesValue Value of pulses to be skipped.
00069   *         This parameter must be a number between Min_Data = 0 and Max_Data = 63.
00070   * @retval HAL status.
00071   */
00072 HAL_StatusTypeDef HAL_DFDSMEx_ChannelSetPulsesSkipping(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t PulsesValue)
00073 {
00074   HAL_StatusTypeDef status = HAL_OK;
00075 
00076   /* Check pulses value */
00077   assert_param(IS_DFSDM_CHANNEL_SKIPPING_VALUE(PulsesValue));
00078 
00079   /* Check DFSDM channel state */
00080   if (hdfsdm_channel->State == HAL_DFSDM_CHANNEL_STATE_READY)
00081   {
00082     /* Set new value of pulses skipping */
00083     hdfsdm_channel->Instance->CHDLYR = (PulsesValue & DFSDM_CHDLYR_PLSSKP);
00084   }
00085   else
00086   {
00087     status = HAL_ERROR;
00088   }
00089   return status;
00090 }
00091 
00092 /**
00093   * @brief  Get value of pulses skipping.
00094   * @param  hdfsdm_channel DFSDM channel handle.
00095   * @param  PulsesValue Value of pulses to be skipped.
00096   * @retval HAL status.
00097   */
00098 HAL_StatusTypeDef HAL_DFDSMEx_ChannelGetPulsesSkipping(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t *PulsesValue)
00099 {
00100   HAL_StatusTypeDef status = HAL_OK;
00101 
00102   /* Check DFSDM channel state */
00103   if (hdfsdm_channel->State == HAL_DFSDM_CHANNEL_STATE_READY)
00104   {
00105     /* Get value of remaining pulses to be skipped */
00106     *PulsesValue = (hdfsdm_channel->Instance->CHDLYR & DFSDM_CHDLYR_PLSSKP);
00107   }
00108   else
00109   {
00110     status = HAL_ERROR;
00111   }
00112   return status;
00113 }
00114 
00115 /**
00116   * @}
00117   */
00118 
00119 /**
00120   * @}
00121   */
00122 
00123 /**
00124   * @}
00125   */
00126 
00127 #endif /* STM32L4R5xx || STM32L4R7xx || STM32L4R9xx || STM32L4S5xx || STM32L4S7xx || STM32L4S9xx || STM32L4P5xx || STM32L4Q5xx */
00128 
00129 #endif /* HAL_DFSDM_MODULE_ENABLED */
00130 
00131 /**
00132   * @}
00133   */