1 /** 2 ****************************************************************************** 3 * @file stm32h7xx_hal_dfsdm_ex.c 4 * @author MCD Application Team 5 * @brief DFSDM Extended HAL module driver. 6 * This file provides firmware functions to manage the following 7 * functionality of the DFSDM Peripheral Controller: 8 * + Set and get pulses skipping on channel. 9 * 10 ****************************************************************************** 11 * @attention 12 * 13 * Copyright (c) 2017 STMicroelectronics. 14 * All rights reserved. 15 * 16 * This software is licensed under terms that can be found in the LICENSE file 17 * in the root directory of this software component. 18 * If no LICENSE file comes with this software, it is provided AS-IS. 19 * 20 ****************************************************************************** 21 */ 22 23 /* Includes ------------------------------------------------------------------*/ 24 #include "stm32h7xx_hal.h" 25 26 /** @addtogroup STM32H7xx_HAL_Driver 27 * @{ 28 */ 29 30 #ifdef HAL_DFSDM_MODULE_ENABLED 31 32 #if defined(DFSDM_CHDLYR_PLSSKP) 33 34 /** @defgroup DFSDMEx DFSDMEx 35 * @brief DFSDM Extended HAL module driver 36 * @{ 37 */ 38 39 /* Private types -------------------------------------------------------------*/ 40 /* Private variables ---------------------------------------------------------*/ 41 /* Private constants ---------------------------------------------------------*/ 42 /* Private macros ------------------------------------------------------------*/ 43 /* Private functions ---------------------------------------------------------*/ 44 /* Exported functions --------------------------------------------------------*/ 45 46 /** @defgroup DFSDMEx_Exported_Functions DFSDM Extended Exported Functions 47 * @{ 48 */ 49 50 /** @defgroup DFSDMEx_Exported_Functions_Group1_Channel Extended channel operation functions 51 * @brief DFSDM extended channel operation functions 52 * 53 @verbatim 54 =============================================================================== 55 ##### Extended channel operation functions ##### 56 =============================================================================== 57 [..] This section provides functions allowing to: 58 (+) Set and get value of pulses skipping on channel 59 60 @endverbatim 61 * @{ 62 */ 63 64 /** 65 * @brief Set value of pulses skipping. 66 * @param hdfsdm_channel DFSDM channel handle. 67 * @param PulsesValue Value of pulses to be skipped. 68 * This parameter must be a number between Min_Data = 0 and Max_Data = 63. 69 * @retval HAL status. 70 */ HAL_DFDSMEx_ChannelSetPulsesSkipping(DFSDM_Channel_HandleTypeDef * hdfsdm_channel,uint32_t PulsesValue)71HAL_StatusTypeDef HAL_DFDSMEx_ChannelSetPulsesSkipping(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t PulsesValue) 72 { 73 HAL_StatusTypeDef status = HAL_OK; 74 75 /* Check pulses value */ 76 assert_param(IS_DFSDM_CHANNEL_SKIPPING_VALUE(PulsesValue)); 77 78 /* Check DFSDM channel state */ 79 if (hdfsdm_channel->State == HAL_DFSDM_CHANNEL_STATE_READY) 80 { 81 /* Set new value of pulses skipping */ 82 hdfsdm_channel->Instance->CHDLYR = (PulsesValue & DFSDM_CHDLYR_PLSSKP); 83 } 84 else 85 { 86 status = HAL_ERROR; 87 } 88 return status; 89 } 90 91 /** 92 * @brief Get value of pulses skipping. 93 * @param hdfsdm_channel DFSDM channel handle. 94 * @param PulsesValue Value of pulses to be skipped. 95 * @retval HAL status. 96 */ HAL_DFDSMEx_ChannelGetPulsesSkipping(const DFSDM_Channel_HandleTypeDef * hdfsdm_channel,uint32_t * PulsesValue)97HAL_StatusTypeDef HAL_DFDSMEx_ChannelGetPulsesSkipping(const DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t *PulsesValue) 98 { 99 HAL_StatusTypeDef status = HAL_OK; 100 101 /* Check DFSDM channel state */ 102 if (hdfsdm_channel->State == HAL_DFSDM_CHANNEL_STATE_READY) 103 { 104 /* Get value of remaining pulses to be skipped */ 105 *PulsesValue = (hdfsdm_channel->Instance->CHDLYR & DFSDM_CHDLYR_PLSSKP); 106 } 107 else 108 { 109 status = HAL_ERROR; 110 } 111 return status; 112 } 113 114 /** 115 * @} 116 */ 117 118 /** 119 * @} 120 */ 121 122 /** 123 * @} 124 */ 125 126 #endif /* DFSDM_CHDLYR_PLSSKP */ 127 128 #endif /* HAL_DFSDM_MODULE_ENABLED */ 129 130 /** 131 * @} 132 */ 133 134