STM32L486xx HAL User Manual
|
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 * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> 00014 * 00015 * Redistribution and use in source and binary forms, with or without modification, 00016 * are permitted provided that the following conditions are met: 00017 * 1. Redistributions of source code must retain the above copyright notice, 00018 * this list of conditions and the following disclaimer. 00019 * 2. Redistributions in binary form must reproduce the above copyright notice, 00020 * this list of conditions and the following disclaimer in the documentation 00021 * and/or other materials provided with the distribution. 00022 * 3. Neither the name of STMicroelectronics nor the names of its contributors 00023 * may be used to endorse or promote products derived from this software 00024 * without specific prior written permission. 00025 * 00026 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00027 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00028 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00029 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00030 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00031 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00032 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00033 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00034 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00035 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 * 00037 ****************************************************************************** 00038 */ 00039 00040 /* Includes ------------------------------------------------------------------*/ 00041 #include "stm32l4xx_hal.h" 00042 00043 /** @addtogroup STM32L4xx_HAL_Driver 00044 * @{ 00045 */ 00046 00047 #ifdef HAL_DFSDM_MODULE_ENABLED 00048 00049 #if defined(STM32L4R5xx) || defined(STM32L4R7xx) || defined(STM32L4R9xx) || defined(STM32L4S5xx) || defined(STM32L4S7xx) || defined(STM32L4S9xx) 00050 00051 /** @defgroup DFSDMEx DFSDMEx 00052 * @brief DFSDM Extended HAL module driver 00053 * @{ 00054 */ 00055 00056 /* Private types -------------------------------------------------------------*/ 00057 /* Private variables ---------------------------------------------------------*/ 00058 /* Private constants ---------------------------------------------------------*/ 00059 /* Private macros ------------------------------------------------------------*/ 00060 /* Private functions ---------------------------------------------------------*/ 00061 /* Exported functions --------------------------------------------------------*/ 00062 00063 /** @defgroup DFSDMEx_Exported_Functions DFSDM Extended Exported Functions 00064 * @{ 00065 */ 00066 00067 /** @defgroup DFSDMEx_Exported_Functions_Group1_Channel Extended channel operation functions 00068 * @brief DFSDM extended channel operation functions 00069 * 00070 @verbatim 00071 =============================================================================== 00072 ##### Extended channel operation functions ##### 00073 =============================================================================== 00074 [..] This section provides functions allowing to: 00075 (+) Set and get value of pulses skipping on channel 00076 00077 @endverbatim 00078 * @{ 00079 */ 00080 00081 /** 00082 * @brief Set value of pulses skipping. 00083 * @param hdfsdm_channel DFSDM channel handle. 00084 * @param PulsesValue Value of pulses to be skipped. 00085 * This parameter must be a number between Min_Data = 0 and Max_Data = 63. 00086 * @retval HAL status. 00087 */ 00088 HAL_StatusTypeDef HAL_DFDSMEx_ChannelSetPulsesSkipping(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t PulsesValue) 00089 { 00090 HAL_StatusTypeDef status = HAL_OK; 00091 00092 /* Check pulses value */ 00093 assert_param(IS_DFSDM_CHANNEL_SKIPPING_VALUE(PulsesValue)); 00094 00095 /* Check DFSDM channel state */ 00096 if (hdfsdm_channel->State == HAL_DFSDM_CHANNEL_STATE_READY) 00097 { 00098 /* Set new value of pulses skipping */ 00099 hdfsdm_channel->Instance->CHDLYR = (PulsesValue & DFSDM_CHDLYR_PLSSKP); 00100 } 00101 else 00102 { 00103 status = HAL_ERROR; 00104 } 00105 return status; 00106 } 00107 00108 /** 00109 * @brief Get value of pulses skipping. 00110 * @param hdfsdm_channel DFSDM channel handle. 00111 * @param PulsesValue Value of pulses to be skipped. 00112 * @retval HAL status. 00113 */ 00114 HAL_StatusTypeDef HAL_DFDSMEx_ChannelGetPulsesSkipping(DFSDM_Channel_HandleTypeDef *hdfsdm_channel, uint32_t *PulsesValue) 00115 { 00116 HAL_StatusTypeDef status = HAL_OK; 00117 00118 /* Check DFSDM channel state */ 00119 if (hdfsdm_channel->State == HAL_DFSDM_CHANNEL_STATE_READY) 00120 { 00121 /* Get value of remaining pulses to be skipped */ 00122 *PulsesValue = (hdfsdm_channel->Instance->CHDLYR & DFSDM_CHDLYR_PLSSKP); 00123 } 00124 else 00125 { 00126 status = HAL_ERROR; 00127 } 00128 return status; 00129 } 00130 00131 /** 00132 * @} 00133 */ 00134 00135 /** 00136 * @} 00137 */ 00138 00139 /** 00140 * @} 00141 */ 00142 00143 #endif /* STM32L4R5xx || STM32L4R7xx || STM32L4R9xx || STM32L4S5xx || STM32L4S7xx || STM32L4S9xx */ 00144 00145 #endif /* HAL_DFSDM_MODULE_ENABLED */ 00146 00147 /** 00148 * @} 00149 */ 00150 00151 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/