1 /** 2 ****************************************************************************** 3 * @file stm32mp1xx_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) 2019 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 "stm32mp1xx_hal.h" 25 26 /** @addtogroup STM32MP1xx_HAL_Driver 27 * @{ 28 */ 29 30 #ifdef HAL_DFSDM_MODULE_ENABLED 31 32 /** @defgroup DFSDMEx DFSDMEx 33 * @brief DFSDM Extended HAL module driver 34 * @{ 35 */ 36 37 /* Private types -------------------------------------------------------------*/ 38 /* Private variables ---------------------------------------------------------*/ 39 /* Private constants ---------------------------------------------------------*/ 40 /* Private macros ------------------------------------------------------------*/ 41 /* Private functions ---------------------------------------------------------*/ 42 /* Exported functions --------------------------------------------------------*/ 43 44 /** @defgroup DFSDMEx_Exported_Functions DFSDM Extended Exported Functions 45 * @{ 46 */ 47 48 /** @defgroup DFSDMEx_Exported_Functions_Group1_Channel Extended channel operation functions 49 * @brief DFSDM extended channel operation functions 50 * 51 @verbatim 52 =============================================================================== 53 ##### Extended channel operation functions ##### 54 =============================================================================== 55 [..] This section provides functions allowing to: 56 (+) Set and get value of pulses skipping on channel 57 58 @endverbatim 59 * @{ 60 */ 61 62 /** 63 * @brief Set value of pulses skipping. 64 * @param hdfsdm_channel DFSDM channel handle. 65 * @param PulsesValue Value of pulses to be skipped. 66 * This parameter must be a number between Min_Data = 0 and Max_Data = 63. 67 * @retval HAL status. 68 */ HAL_DFDSMEx_ChannelSetPulsesSkipping(DFSDM_Channel_HandleTypeDef * hdfsdm_channel,uint32_t PulsesValue)69HAL_StatusTypeDef HAL_DFDSMEx_ChannelSetPulsesSkipping(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t PulsesValue) 70 { 71 HAL_StatusTypeDef status = HAL_OK; 72 73 /* Check pulses value */ 74 assert_param(IS_DFSDM_CHANNEL_SKIPPING_VALUE(PulsesValue)); 75 76 /* Check DFSDM channel state */ 77 if(hdfsdm_channel->State == HAL_DFSDM_CHANNEL_STATE_READY) 78 { 79 /* Set new value of pulses skipping */ 80 hdfsdm_channel->Instance->CHDLYR = (PulsesValue & DFSDM_CHDLYR_PLSSKP); 81 } 82 else 83 { 84 status = HAL_ERROR; 85 } 86 return status; 87 } 88 89 /** 90 * @brief Get value of pulses skipping. 91 * @param hdfsdm_channel DFSDM channel handle. 92 * @param PulsesValue Value of pulses to be skipped. 93 * @retval HAL status. 94 */ HAL_DFDSMEx_ChannelGetPulsesSkipping(DFSDM_Channel_HandleTypeDef * hdfsdm_channel,uint32_t * PulsesValue)95HAL_StatusTypeDef HAL_DFDSMEx_ChannelGetPulsesSkipping(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t *PulsesValue) 96 { 97 HAL_StatusTypeDef status = HAL_OK; 98 99 /* Check DFSDM channel state */ 100 if(hdfsdm_channel->State == HAL_DFSDM_CHANNEL_STATE_READY) 101 { 102 /* Get value of remaining pulses to be skipped */ 103 *PulsesValue = (hdfsdm_channel->Instance->CHDLYR & DFSDM_CHDLYR_PLSSKP); 104 } 105 else 106 { 107 status = HAL_ERROR; 108 } 109 return status; 110 } 111 112 /** 113 * @} 114 */ 115 116 /** 117 * @} 118 */ 119 120 /** 121 * @} 122 */ 123 124 #endif /* HAL_DFSDM_MODULE_ENABLED */ 125 126 /** 127 * @} 128 */ 129