inport from local

Dependents:   Hobbyking_Cheetah_0511

Committer:
NYX
Date:
Mon Mar 16 06:35:48 2020 +0000
Revision:
0:85b3fd62ea1a
reinport to mbed;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
NYX 0:85b3fd62ea1a 1 /**
NYX 0:85b3fd62ea1a 2 ******************************************************************************
NYX 0:85b3fd62ea1a 3 * @file stm32f4xx_ll_dac.c
NYX 0:85b3fd62ea1a 4 * @author MCD Application Team
NYX 0:85b3fd62ea1a 5 * @version V1.7.1
NYX 0:85b3fd62ea1a 6 * @date 14-April-2017
NYX 0:85b3fd62ea1a 7 * @brief DAC LL module driver
NYX 0:85b3fd62ea1a 8 ******************************************************************************
NYX 0:85b3fd62ea1a 9 * @attention
NYX 0:85b3fd62ea1a 10 *
NYX 0:85b3fd62ea1a 11 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
NYX 0:85b3fd62ea1a 12 *
NYX 0:85b3fd62ea1a 13 * Redistribution and use in source and binary forms, with or without modification,
NYX 0:85b3fd62ea1a 14 * are permitted provided that the following conditions are met:
NYX 0:85b3fd62ea1a 15 * 1. Redistributions of source code must retain the above copyright notice,
NYX 0:85b3fd62ea1a 16 * this list of conditions and the following disclaimer.
NYX 0:85b3fd62ea1a 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
NYX 0:85b3fd62ea1a 18 * this list of conditions and the following disclaimer in the documentation
NYX 0:85b3fd62ea1a 19 * and/or other materials provided with the distribution.
NYX 0:85b3fd62ea1a 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
NYX 0:85b3fd62ea1a 21 * may be used to endorse or promote products derived from this software
NYX 0:85b3fd62ea1a 22 * without specific prior written permission.
NYX 0:85b3fd62ea1a 23 *
NYX 0:85b3fd62ea1a 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
NYX 0:85b3fd62ea1a 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
NYX 0:85b3fd62ea1a 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
NYX 0:85b3fd62ea1a 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
NYX 0:85b3fd62ea1a 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
NYX 0:85b3fd62ea1a 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
NYX 0:85b3fd62ea1a 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
NYX 0:85b3fd62ea1a 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
NYX 0:85b3fd62ea1a 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
NYX 0:85b3fd62ea1a 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
NYX 0:85b3fd62ea1a 34 *
NYX 0:85b3fd62ea1a 35 ******************************************************************************
NYX 0:85b3fd62ea1a 36 */
NYX 0:85b3fd62ea1a 37 #if defined(USE_FULL_LL_DRIVER)
NYX 0:85b3fd62ea1a 38
NYX 0:85b3fd62ea1a 39 /* Includes ------------------------------------------------------------------*/
NYX 0:85b3fd62ea1a 40 #include "stm32f4xx_ll_dac.h"
NYX 0:85b3fd62ea1a 41 #include "stm32f4xx_ll_bus.h"
NYX 0:85b3fd62ea1a 42
NYX 0:85b3fd62ea1a 43 #ifdef USE_FULL_ASSERT
NYX 0:85b3fd62ea1a 44 #include "stm32_assert.h"
NYX 0:85b3fd62ea1a 45 #else
NYX 0:85b3fd62ea1a 46 #define assert_param(expr) ((void)0U)
NYX 0:85b3fd62ea1a 47 #endif
NYX 0:85b3fd62ea1a 48
NYX 0:85b3fd62ea1a 49 /** @addtogroup STM32F4xx_LL_Driver
NYX 0:85b3fd62ea1a 50 * @{
NYX 0:85b3fd62ea1a 51 */
NYX 0:85b3fd62ea1a 52
NYX 0:85b3fd62ea1a 53 #if defined(DAC)
NYX 0:85b3fd62ea1a 54
NYX 0:85b3fd62ea1a 55 /** @addtogroup DAC_LL DAC
NYX 0:85b3fd62ea1a 56 * @{
NYX 0:85b3fd62ea1a 57 */
NYX 0:85b3fd62ea1a 58
NYX 0:85b3fd62ea1a 59 /* Private types -------------------------------------------------------------*/
NYX 0:85b3fd62ea1a 60 /* Private variables ---------------------------------------------------------*/
NYX 0:85b3fd62ea1a 61 /* Private constants ---------------------------------------------------------*/
NYX 0:85b3fd62ea1a 62 /* Private macros ------------------------------------------------------------*/
NYX 0:85b3fd62ea1a 63
NYX 0:85b3fd62ea1a 64 /** @addtogroup DAC_LL_Private_Macros
NYX 0:85b3fd62ea1a 65 * @{
NYX 0:85b3fd62ea1a 66 */
NYX 0:85b3fd62ea1a 67
NYX 0:85b3fd62ea1a 68 #if defined(DAC_CHANNEL2_SUPPORT)
NYX 0:85b3fd62ea1a 69 #define IS_LL_DAC_CHANNEL(__DACX__, __DAC_CHANNEL__) \
NYX 0:85b3fd62ea1a 70 ( \
NYX 0:85b3fd62ea1a 71 ((__DAC_CHANNEL__) == LL_DAC_CHANNEL_1) \
NYX 0:85b3fd62ea1a 72 || ((__DAC_CHANNEL__) == LL_DAC_CHANNEL_2) \
NYX 0:85b3fd62ea1a 73 )
NYX 0:85b3fd62ea1a 74 #else
NYX 0:85b3fd62ea1a 75 #define IS_LL_DAC_CHANNEL(__DACX__, __DAC_CHANNEL__) \
NYX 0:85b3fd62ea1a 76 ( \
NYX 0:85b3fd62ea1a 77 ((__DAC_CHANNEL__) == LL_DAC_CHANNEL_1) \
NYX 0:85b3fd62ea1a 78 )
NYX 0:85b3fd62ea1a 79 #endif /* DAC_CHANNEL2_SUPPORT */
NYX 0:85b3fd62ea1a 80
NYX 0:85b3fd62ea1a 81 #define IS_LL_DAC_TRIGGER_SOURCE(__TRIGGER_SOURCE__) \
NYX 0:85b3fd62ea1a 82 ( ((__TRIGGER_SOURCE__) == LL_DAC_TRIG_SOFTWARE) \
NYX 0:85b3fd62ea1a 83 || ((__TRIGGER_SOURCE__) == LL_DAC_TRIG_EXT_TIM2_TRGO) \
NYX 0:85b3fd62ea1a 84 || ((__TRIGGER_SOURCE__) == LL_DAC_TRIG_EXT_TIM4_TRGO) \
NYX 0:85b3fd62ea1a 85 || ((__TRIGGER_SOURCE__) == LL_DAC_TRIG_EXT_TIM5_TRGO) \
NYX 0:85b3fd62ea1a 86 || ((__TRIGGER_SOURCE__) == LL_DAC_TRIG_EXT_TIM6_TRGO) \
NYX 0:85b3fd62ea1a 87 || ((__TRIGGER_SOURCE__) == LL_DAC_TRIG_EXT_TIM7_TRGO) \
NYX 0:85b3fd62ea1a 88 || ((__TRIGGER_SOURCE__) == LL_DAC_TRIG_EXT_TIM8_TRGO) \
NYX 0:85b3fd62ea1a 89 || ((__TRIGGER_SOURCE__) == LL_DAC_TRIG_EXT_EXTI_LINE9) \
NYX 0:85b3fd62ea1a 90 )
NYX 0:85b3fd62ea1a 91
NYX 0:85b3fd62ea1a 92 #define IS_LL_DAC_WAVE_AUTO_GENER_MODE(__WAVE_AUTO_GENERATION_MODE__) \
NYX 0:85b3fd62ea1a 93 ( ((__WAVE_AUTO_GENERATION_MODE__) == LL_DAC_WAVE_AUTO_GENERATION_NONE) \
NYX 0:85b3fd62ea1a 94 || ((__WAVE_AUTO_GENERATION_MODE__) == LL_DAC_WAVE_AUTO_GENERATION_NOISE) \
NYX 0:85b3fd62ea1a 95 || ((__WAVE_AUTO_GENERATION_MODE__) == LL_DAC_WAVE_AUTO_GENERATION_TRIANGLE) \
NYX 0:85b3fd62ea1a 96 )
NYX 0:85b3fd62ea1a 97
NYX 0:85b3fd62ea1a 98 #define IS_LL_DAC_WAVE_AUTO_GENER_CONFIG(__WAVE_AUTO_GENERATION_CONFIG__) \
NYX 0:85b3fd62ea1a 99 ( ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BIT0) \
NYX 0:85b3fd62ea1a 100 || ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS1_0) \
NYX 0:85b3fd62ea1a 101 || ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS2_0) \
NYX 0:85b3fd62ea1a 102 || ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS3_0) \
NYX 0:85b3fd62ea1a 103 || ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS4_0) \
NYX 0:85b3fd62ea1a 104 || ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS5_0) \
NYX 0:85b3fd62ea1a 105 || ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS6_0) \
NYX 0:85b3fd62ea1a 106 || ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS7_0) \
NYX 0:85b3fd62ea1a 107 || ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS8_0) \
NYX 0:85b3fd62ea1a 108 || ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS9_0) \
NYX 0:85b3fd62ea1a 109 || ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS10_0) \
NYX 0:85b3fd62ea1a 110 || ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_NOISE_LFSR_UNMASK_BITS11_0) \
NYX 0:85b3fd62ea1a 111 || ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_1) \
NYX 0:85b3fd62ea1a 112 || ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_3) \
NYX 0:85b3fd62ea1a 113 || ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_7) \
NYX 0:85b3fd62ea1a 114 || ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_15) \
NYX 0:85b3fd62ea1a 115 || ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_31) \
NYX 0:85b3fd62ea1a 116 || ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_63) \
NYX 0:85b3fd62ea1a 117 || ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_127) \
NYX 0:85b3fd62ea1a 118 || ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_255) \
NYX 0:85b3fd62ea1a 119 || ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_511) \
NYX 0:85b3fd62ea1a 120 || ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_1023) \
NYX 0:85b3fd62ea1a 121 || ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_2047) \
NYX 0:85b3fd62ea1a 122 || ((__WAVE_AUTO_GENERATION_CONFIG__) == LL_DAC_TRIANGLE_AMPLITUDE_4095) \
NYX 0:85b3fd62ea1a 123 )
NYX 0:85b3fd62ea1a 124
NYX 0:85b3fd62ea1a 125 #define IS_LL_DAC_OUTPUT_BUFFER(__OUTPUT_BUFFER__) \
NYX 0:85b3fd62ea1a 126 ( ((__OUTPUT_BUFFER__) == LL_DAC_OUTPUT_BUFFER_ENABLE) \
NYX 0:85b3fd62ea1a 127 || ((__OUTPUT_BUFFER__) == LL_DAC_OUTPUT_BUFFER_DISABLE) \
NYX 0:85b3fd62ea1a 128 )
NYX 0:85b3fd62ea1a 129
NYX 0:85b3fd62ea1a 130 /**
NYX 0:85b3fd62ea1a 131 * @}
NYX 0:85b3fd62ea1a 132 */
NYX 0:85b3fd62ea1a 133
NYX 0:85b3fd62ea1a 134
NYX 0:85b3fd62ea1a 135 /* Private function prototypes -----------------------------------------------*/
NYX 0:85b3fd62ea1a 136
NYX 0:85b3fd62ea1a 137 /* Exported functions --------------------------------------------------------*/
NYX 0:85b3fd62ea1a 138 /** @addtogroup DAC_LL_Exported_Functions
NYX 0:85b3fd62ea1a 139 * @{
NYX 0:85b3fd62ea1a 140 */
NYX 0:85b3fd62ea1a 141
NYX 0:85b3fd62ea1a 142 /** @addtogroup DAC_LL_EF_Init
NYX 0:85b3fd62ea1a 143 * @{
NYX 0:85b3fd62ea1a 144 */
NYX 0:85b3fd62ea1a 145
NYX 0:85b3fd62ea1a 146 /**
NYX 0:85b3fd62ea1a 147 * @brief De-initialize registers of the selected DAC instance
NYX 0:85b3fd62ea1a 148 * to their default reset values.
NYX 0:85b3fd62ea1a 149 * @param DACx DAC instance
NYX 0:85b3fd62ea1a 150 * @retval An ErrorStatus enumeration value:
NYX 0:85b3fd62ea1a 151 * - SUCCESS: DAC registers are de-initialized
NYX 0:85b3fd62ea1a 152 * - ERROR: not applicable
NYX 0:85b3fd62ea1a 153 */
NYX 0:85b3fd62ea1a 154 ErrorStatus LL_DAC_DeInit(DAC_TypeDef *DACx)
NYX 0:85b3fd62ea1a 155 {
NYX 0:85b3fd62ea1a 156 /* Check the parameters */
NYX 0:85b3fd62ea1a 157 assert_param(IS_DAC_ALL_INSTANCE(DACx));
NYX 0:85b3fd62ea1a 158
NYX 0:85b3fd62ea1a 159 /* Force reset of DAC1 clock */
NYX 0:85b3fd62ea1a 160 LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_DAC1);
NYX 0:85b3fd62ea1a 161
NYX 0:85b3fd62ea1a 162 /* Release reset of DAC1 clock */
NYX 0:85b3fd62ea1a 163 LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_DAC1);
NYX 0:85b3fd62ea1a 164 return SUCCESS;
NYX 0:85b3fd62ea1a 165 }
NYX 0:85b3fd62ea1a 166
NYX 0:85b3fd62ea1a 167 /**
NYX 0:85b3fd62ea1a 168 * @brief Initialize some features of DAC instance.
NYX 0:85b3fd62ea1a 169 * @note The setting of these parameters by function @ref LL_DAC_Init()
NYX 0:85b3fd62ea1a 170 * is conditioned to DAC state:
NYX 0:85b3fd62ea1a 171 * DAC instance must be disabled.
NYX 0:85b3fd62ea1a 172 * @param DACx DAC instance
NYX 0:85b3fd62ea1a 173 * @param DAC_Channel This parameter can be one of the following values:
NYX 0:85b3fd62ea1a 174 * @arg @ref LL_DAC_CHANNEL_1
NYX 0:85b3fd62ea1a 175 * @arg @ref LL_DAC_CHANNEL_2 (1)
NYX 0:85b3fd62ea1a 176 *
NYX 0:85b3fd62ea1a 177 * (1) On this STM32 serie, parameter not available on all devices.
NYX 0:85b3fd62ea1a 178 * Refer to device datasheet for channels availability.
NYX 0:85b3fd62ea1a 179 * @param DAC_InitStruct Pointer to a @ref LL_DAC_InitTypeDef structure
NYX 0:85b3fd62ea1a 180 * @retval An ErrorStatus enumeration value:
NYX 0:85b3fd62ea1a 181 * - SUCCESS: DAC registers are initialized
NYX 0:85b3fd62ea1a 182 * - ERROR: DAC registers are not initialized
NYX 0:85b3fd62ea1a 183 */
NYX 0:85b3fd62ea1a 184 ErrorStatus LL_DAC_Init(DAC_TypeDef *DACx, uint32_t DAC_Channel, LL_DAC_InitTypeDef *DAC_InitStruct)
NYX 0:85b3fd62ea1a 185 {
NYX 0:85b3fd62ea1a 186 ErrorStatus status = SUCCESS;
NYX 0:85b3fd62ea1a 187
NYX 0:85b3fd62ea1a 188 /* Check the parameters */
NYX 0:85b3fd62ea1a 189 assert_param(IS_DAC_ALL_INSTANCE(DACx));
NYX 0:85b3fd62ea1a 190 assert_param(IS_LL_DAC_CHANNEL(DACx, DAC_Channel));
NYX 0:85b3fd62ea1a 191 assert_param(IS_LL_DAC_TRIGGER_SOURCE(DAC_InitStruct->TriggerSource));
NYX 0:85b3fd62ea1a 192 assert_param(IS_LL_DAC_OUTPUT_BUFFER(DAC_InitStruct->OutputBuffer));
NYX 0:85b3fd62ea1a 193 assert_param(IS_LL_DAC_WAVE_AUTO_GENER_MODE(DAC_InitStruct->WaveAutoGeneration));
NYX 0:85b3fd62ea1a 194 if (DAC_InitStruct->WaveAutoGeneration != LL_DAC_WAVE_AUTO_GENERATION_NONE)
NYX 0:85b3fd62ea1a 195 {
NYX 0:85b3fd62ea1a 196 assert_param(IS_LL_DAC_WAVE_AUTO_GENER_CONFIG(DAC_InitStruct->WaveAutoGenerationConfig));
NYX 0:85b3fd62ea1a 197 }
NYX 0:85b3fd62ea1a 198
NYX 0:85b3fd62ea1a 199 /* Note: Hardware constraint (refer to description of this function) */
NYX 0:85b3fd62ea1a 200 /* DAC instance must be disabled. */
NYX 0:85b3fd62ea1a 201 if(LL_DAC_IsEnabled(DACx, DAC_Channel) == 0U)
NYX 0:85b3fd62ea1a 202 {
NYX 0:85b3fd62ea1a 203 /* Configuration of DAC channel: */
NYX 0:85b3fd62ea1a 204 /* - TriggerSource */
NYX 0:85b3fd62ea1a 205 /* - WaveAutoGeneration */
NYX 0:85b3fd62ea1a 206 /* - OutputBuffer */
NYX 0:85b3fd62ea1a 207 if (DAC_InitStruct->WaveAutoGeneration != LL_DAC_WAVE_AUTO_GENERATION_NONE)
NYX 0:85b3fd62ea1a 208 {
NYX 0:85b3fd62ea1a 209 MODIFY_REG(DACx->CR,
NYX 0:85b3fd62ea1a 210 ( DAC_CR_TSEL1
NYX 0:85b3fd62ea1a 211 | DAC_CR_WAVE1
NYX 0:85b3fd62ea1a 212 | DAC_CR_MAMP1
NYX 0:85b3fd62ea1a 213 | DAC_CR_BOFF1
NYX 0:85b3fd62ea1a 214 ) << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
NYX 0:85b3fd62ea1a 215 ,
NYX 0:85b3fd62ea1a 216 ( DAC_InitStruct->TriggerSource
NYX 0:85b3fd62ea1a 217 | DAC_InitStruct->WaveAutoGeneration
NYX 0:85b3fd62ea1a 218 | DAC_InitStruct->WaveAutoGenerationConfig
NYX 0:85b3fd62ea1a 219 | DAC_InitStruct->OutputBuffer
NYX 0:85b3fd62ea1a 220 ) << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
NYX 0:85b3fd62ea1a 221 );
NYX 0:85b3fd62ea1a 222 }
NYX 0:85b3fd62ea1a 223 else
NYX 0:85b3fd62ea1a 224 {
NYX 0:85b3fd62ea1a 225 MODIFY_REG(DACx->CR,
NYX 0:85b3fd62ea1a 226 ( DAC_CR_TSEL1
NYX 0:85b3fd62ea1a 227 | DAC_CR_WAVE1
NYX 0:85b3fd62ea1a 228 | DAC_CR_BOFF1
NYX 0:85b3fd62ea1a 229 ) << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
NYX 0:85b3fd62ea1a 230 ,
NYX 0:85b3fd62ea1a 231 ( DAC_InitStruct->TriggerSource
NYX 0:85b3fd62ea1a 232 | LL_DAC_WAVE_AUTO_GENERATION_NONE
NYX 0:85b3fd62ea1a 233 | DAC_InitStruct->OutputBuffer
NYX 0:85b3fd62ea1a 234 ) << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
NYX 0:85b3fd62ea1a 235 );
NYX 0:85b3fd62ea1a 236 }
NYX 0:85b3fd62ea1a 237 }
NYX 0:85b3fd62ea1a 238 else
NYX 0:85b3fd62ea1a 239 {
NYX 0:85b3fd62ea1a 240 /* Initialization error: DAC instance is not disabled. */
NYX 0:85b3fd62ea1a 241 status = ERROR;
NYX 0:85b3fd62ea1a 242 }
NYX 0:85b3fd62ea1a 243 return status;
NYX 0:85b3fd62ea1a 244 }
NYX 0:85b3fd62ea1a 245
NYX 0:85b3fd62ea1a 246 /**
NYX 0:85b3fd62ea1a 247 * @brief Set each @ref LL_DAC_InitTypeDef field to default value.
NYX 0:85b3fd62ea1a 248 * @param DAC_InitStruct pointer to a @ref LL_DAC_InitTypeDef structure
NYX 0:85b3fd62ea1a 249 * whose fields will be set to default values.
NYX 0:85b3fd62ea1a 250 * @retval None
NYX 0:85b3fd62ea1a 251 */
NYX 0:85b3fd62ea1a 252 void LL_DAC_StructInit(LL_DAC_InitTypeDef *DAC_InitStruct)
NYX 0:85b3fd62ea1a 253 {
NYX 0:85b3fd62ea1a 254 /* Set DAC_InitStruct fields to default values */
NYX 0:85b3fd62ea1a 255 DAC_InitStruct->TriggerSource = LL_DAC_TRIG_SOFTWARE;
NYX 0:85b3fd62ea1a 256 DAC_InitStruct->WaveAutoGeneration = LL_DAC_WAVE_AUTO_GENERATION_NONE;
NYX 0:85b3fd62ea1a 257 /* Note: Parameter discarded if wave auto generation is disabled, */
NYX 0:85b3fd62ea1a 258 /* set anyway to its default value. */
NYX 0:85b3fd62ea1a 259 DAC_InitStruct->WaveAutoGenerationConfig = LL_DAC_NOISE_LFSR_UNMASK_BIT0;
NYX 0:85b3fd62ea1a 260 DAC_InitStruct->OutputBuffer = LL_DAC_OUTPUT_BUFFER_ENABLE;
NYX 0:85b3fd62ea1a 261 }
NYX 0:85b3fd62ea1a 262
NYX 0:85b3fd62ea1a 263 /**
NYX 0:85b3fd62ea1a 264 * @}
NYX 0:85b3fd62ea1a 265 */
NYX 0:85b3fd62ea1a 266
NYX 0:85b3fd62ea1a 267 /**
NYX 0:85b3fd62ea1a 268 * @}
NYX 0:85b3fd62ea1a 269 */
NYX 0:85b3fd62ea1a 270
NYX 0:85b3fd62ea1a 271 /**
NYX 0:85b3fd62ea1a 272 * @}
NYX 0:85b3fd62ea1a 273 */
NYX 0:85b3fd62ea1a 274
NYX 0:85b3fd62ea1a 275 #endif /* DAC */
NYX 0:85b3fd62ea1a 276
NYX 0:85b3fd62ea1a 277 /**
NYX 0:85b3fd62ea1a 278 * @}
NYX 0:85b3fd62ea1a 279 */
NYX 0:85b3fd62ea1a 280
NYX 0:85b3fd62ea1a 281 #endif /* USE_FULL_LL_DRIVER */
NYX 0:85b3fd62ea1a 282
NYX 0:85b3fd62ea1a 283 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/