Back to home page

LXR

 
 

    


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

0001 /**
0002   ******************************************************************************
0003   * @file    stm32h7xx_hal_dfsdm_ex.c
0004   * @author  MCD Application Team
0005   * @brief   DFSDM Extended HAL module driver.
0006   *          This file provides firmware functions to manage the following
0007   *          functionality of the DFSDM Peripheral Controller:
0008   *           + Set and get pulses skipping on channel.
0009   *
0010   ******************************************************************************
0011   * @attention
0012   *
0013   * Copyright (c) 2017 STMicroelectronics.
0014   * All rights reserved.
0015   *
0016   * This software is licensed under terms that can be found in the LICENSE file
0017   * in the root directory of this software component.
0018   * If no LICENSE file comes with this software, it is provided AS-IS.
0019   *
0020   ******************************************************************************
0021   */
0022 
0023 /* Includes ------------------------------------------------------------------*/
0024 #include "stm32h7xx_hal.h"
0025 
0026 /** @addtogroup STM32H7xx_HAL_Driver
0027   * @{
0028   */
0029 
0030 #ifdef HAL_DFSDM_MODULE_ENABLED
0031 
0032 #if defined(DFSDM_CHDLYR_PLSSKP)
0033 
0034 /** @defgroup DFSDMEx DFSDMEx
0035   * @ingroup RTEMSBSPsARMSTM32H7
0036   * @brief DFSDM Extended HAL module driver
0037   * @{
0038   */
0039 
0040 /* Private types -------------------------------------------------------------*/
0041 /* Private variables ---------------------------------------------------------*/
0042 /* Private constants ---------------------------------------------------------*/
0043 /* Private macros ------------------------------------------------------------*/
0044 /* Private functions ---------------------------------------------------------*/
0045 /* Exported functions --------------------------------------------------------*/
0046 
0047 /** @defgroup DFSDMEx_Exported_Functions DFSDM Extended Exported Functions
0048   * @ingroup RTEMSBSPsARMSTM32H7
0049   * @{
0050   */
0051 
0052 /** @defgroup DFSDMEx_Exported_Functions_Group1_Channel Extended channel operation functions
0053   * @ingroup RTEMSBSPsARMSTM32H7
0054   * @brief    DFSDM extended channel operation functions
0055  *
0056 @verbatim
0057  ===============================================================================
0058                ##### Extended channel operation functions #####
0059  ===============================================================================
0060     [..]  This section provides functions allowing to:
0061       (+) Set and get value of pulses skipping on channel
0062 
0063 @endverbatim
0064   * @{
0065   */
0066 
0067 /**
0068   * @brief  Set value of pulses skipping.
0069   * @param  hdfsdm_channel DFSDM channel handle.
0070   * @param  PulsesValue Value of pulses to be skipped.
0071   *         This parameter must be a number between Min_Data = 0 and Max_Data = 63.
0072   * @retval HAL status.
0073   */
0074 HAL_StatusTypeDef HAL_DFDSMEx_ChannelSetPulsesSkipping(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t PulsesValue)
0075 {
0076   HAL_StatusTypeDef status = HAL_OK;
0077 
0078   /* Check pulses value */
0079   assert_param(IS_DFSDM_CHANNEL_SKIPPING_VALUE(PulsesValue));
0080 
0081   /* Check DFSDM channel state */
0082   if (hdfsdm_channel->State == HAL_DFSDM_CHANNEL_STATE_READY)
0083   {
0084     /* Set new value of pulses skipping */
0085     hdfsdm_channel->Instance->CHDLYR = (PulsesValue & DFSDM_CHDLYR_PLSSKP);
0086   }
0087   else
0088   {
0089     status = HAL_ERROR;
0090   }
0091   return status;
0092 }
0093 
0094 /**
0095   * @brief  Get value of pulses skipping.
0096   * @param  hdfsdm_channel DFSDM channel handle.
0097   * @param  PulsesValue Value of pulses to be skipped.
0098   * @retval HAL status.
0099   */
0100 HAL_StatusTypeDef HAL_DFDSMEx_ChannelGetPulsesSkipping(const DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t *PulsesValue)
0101 {
0102   HAL_StatusTypeDef status = HAL_OK;
0103 
0104   /* Check DFSDM channel state */
0105   if (hdfsdm_channel->State == HAL_DFSDM_CHANNEL_STATE_READY)
0106   {
0107     /* Get value of remaining pulses to be skipped */
0108     *PulsesValue = (hdfsdm_channel->Instance->CHDLYR & DFSDM_CHDLYR_PLSSKP);
0109   }
0110   else
0111   {
0112     status = HAL_ERROR;
0113   }
0114   return status;
0115 }
0116 
0117 /**
0118   * @}
0119   */
0120 
0121 /**
0122   * @}
0123   */
0124 
0125 /**
0126   * @}
0127   */
0128 
0129 #endif /* DFSDM_CHDLYR_PLSSKP */
0130 
0131 #endif /* HAL_DFSDM_MODULE_ENABLED */
0132 
0133 /**
0134   * @}
0135   */
0136