mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_F103RB/stm32f10x_dac.c@52:a51c77007319, 2013-12-02 (annotated)
- Committer:
- mbed_official
- Date:
- Mon Dec 02 11:30:05 2013 +0000
- Revision:
- 52:a51c77007319
- Child:
- 70:c1fbde68b492
Synchronized with git revision 49df530ae72ce97ccc773d1f2c13b38e868e6abd
Full URL: https://github.com/mbedmicro/mbed/commit/49df530ae72ce97ccc773d1f2c13b38e868e6abd/
Add STMicroelectronics NUCLEO_F103RB target
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 52:a51c77007319 | 1 | /** |
mbed_official | 52:a51c77007319 | 2 | ****************************************************************************** |
mbed_official | 52:a51c77007319 | 3 | * @file stm32f10x_dac.c |
mbed_official | 52:a51c77007319 | 4 | * @author MCD Application Team |
mbed_official | 52:a51c77007319 | 5 | * @version V3.5.0 |
mbed_official | 52:a51c77007319 | 6 | * @date 11-March-2011 |
mbed_official | 52:a51c77007319 | 7 | * @brief This file provides all the DAC firmware functions. |
mbed_official | 52:a51c77007319 | 8 | ****************************************************************************** |
mbed_official | 52:a51c77007319 | 9 | * @attention |
mbed_official | 52:a51c77007319 | 10 | * |
mbed_official | 52:a51c77007319 | 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS |
mbed_official | 52:a51c77007319 | 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE |
mbed_official | 52:a51c77007319 | 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY |
mbed_official | 52:a51c77007319 | 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING |
mbed_official | 52:a51c77007319 | 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE |
mbed_official | 52:a51c77007319 | 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. |
mbed_official | 52:a51c77007319 | 17 | * |
mbed_official | 52:a51c77007319 | 18 | * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2> |
mbed_official | 52:a51c77007319 | 19 | ****************************************************************************** |
mbed_official | 52:a51c77007319 | 20 | */ |
mbed_official | 52:a51c77007319 | 21 | |
mbed_official | 52:a51c77007319 | 22 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 52:a51c77007319 | 23 | #include "stm32f10x_dac.h" |
mbed_official | 52:a51c77007319 | 24 | #include "stm32f10x_rcc.h" |
mbed_official | 52:a51c77007319 | 25 | |
mbed_official | 52:a51c77007319 | 26 | /** @addtogroup STM32F10x_StdPeriph_Driver |
mbed_official | 52:a51c77007319 | 27 | * @{ |
mbed_official | 52:a51c77007319 | 28 | */ |
mbed_official | 52:a51c77007319 | 29 | |
mbed_official | 52:a51c77007319 | 30 | /** @defgroup DAC |
mbed_official | 52:a51c77007319 | 31 | * @brief DAC driver modules |
mbed_official | 52:a51c77007319 | 32 | * @{ |
mbed_official | 52:a51c77007319 | 33 | */ |
mbed_official | 52:a51c77007319 | 34 | |
mbed_official | 52:a51c77007319 | 35 | /** @defgroup DAC_Private_TypesDefinitions |
mbed_official | 52:a51c77007319 | 36 | * @{ |
mbed_official | 52:a51c77007319 | 37 | */ |
mbed_official | 52:a51c77007319 | 38 | |
mbed_official | 52:a51c77007319 | 39 | /** |
mbed_official | 52:a51c77007319 | 40 | * @} |
mbed_official | 52:a51c77007319 | 41 | */ |
mbed_official | 52:a51c77007319 | 42 | |
mbed_official | 52:a51c77007319 | 43 | /** @defgroup DAC_Private_Defines |
mbed_official | 52:a51c77007319 | 44 | * @{ |
mbed_official | 52:a51c77007319 | 45 | */ |
mbed_official | 52:a51c77007319 | 46 | |
mbed_official | 52:a51c77007319 | 47 | /* CR register Mask */ |
mbed_official | 52:a51c77007319 | 48 | #define CR_CLEAR_MASK ((uint32_t)0x00000FFE) |
mbed_official | 52:a51c77007319 | 49 | |
mbed_official | 52:a51c77007319 | 50 | /* DAC Dual Channels SWTRIG masks */ |
mbed_official | 52:a51c77007319 | 51 | #define DUAL_SWTRIG_SET ((uint32_t)0x00000003) |
mbed_official | 52:a51c77007319 | 52 | #define DUAL_SWTRIG_RESET ((uint32_t)0xFFFFFFFC) |
mbed_official | 52:a51c77007319 | 53 | |
mbed_official | 52:a51c77007319 | 54 | /* DHR registers offsets */ |
mbed_official | 52:a51c77007319 | 55 | #define DHR12R1_OFFSET ((uint32_t)0x00000008) |
mbed_official | 52:a51c77007319 | 56 | #define DHR12R2_OFFSET ((uint32_t)0x00000014) |
mbed_official | 52:a51c77007319 | 57 | #define DHR12RD_OFFSET ((uint32_t)0x00000020) |
mbed_official | 52:a51c77007319 | 58 | |
mbed_official | 52:a51c77007319 | 59 | /* DOR register offset */ |
mbed_official | 52:a51c77007319 | 60 | #define DOR_OFFSET ((uint32_t)0x0000002C) |
mbed_official | 52:a51c77007319 | 61 | /** |
mbed_official | 52:a51c77007319 | 62 | * @} |
mbed_official | 52:a51c77007319 | 63 | */ |
mbed_official | 52:a51c77007319 | 64 | |
mbed_official | 52:a51c77007319 | 65 | /** @defgroup DAC_Private_Macros |
mbed_official | 52:a51c77007319 | 66 | * @{ |
mbed_official | 52:a51c77007319 | 67 | */ |
mbed_official | 52:a51c77007319 | 68 | |
mbed_official | 52:a51c77007319 | 69 | /** |
mbed_official | 52:a51c77007319 | 70 | * @} |
mbed_official | 52:a51c77007319 | 71 | */ |
mbed_official | 52:a51c77007319 | 72 | |
mbed_official | 52:a51c77007319 | 73 | /** @defgroup DAC_Private_Variables |
mbed_official | 52:a51c77007319 | 74 | * @{ |
mbed_official | 52:a51c77007319 | 75 | */ |
mbed_official | 52:a51c77007319 | 76 | |
mbed_official | 52:a51c77007319 | 77 | /** |
mbed_official | 52:a51c77007319 | 78 | * @} |
mbed_official | 52:a51c77007319 | 79 | */ |
mbed_official | 52:a51c77007319 | 80 | |
mbed_official | 52:a51c77007319 | 81 | /** @defgroup DAC_Private_FunctionPrototypes |
mbed_official | 52:a51c77007319 | 82 | * @{ |
mbed_official | 52:a51c77007319 | 83 | */ |
mbed_official | 52:a51c77007319 | 84 | |
mbed_official | 52:a51c77007319 | 85 | /** |
mbed_official | 52:a51c77007319 | 86 | * @} |
mbed_official | 52:a51c77007319 | 87 | */ |
mbed_official | 52:a51c77007319 | 88 | |
mbed_official | 52:a51c77007319 | 89 | /** @defgroup DAC_Private_Functions |
mbed_official | 52:a51c77007319 | 90 | * @{ |
mbed_official | 52:a51c77007319 | 91 | */ |
mbed_official | 52:a51c77007319 | 92 | |
mbed_official | 52:a51c77007319 | 93 | /** |
mbed_official | 52:a51c77007319 | 94 | * @brief Deinitializes the DAC peripheral registers to their default reset values. |
mbed_official | 52:a51c77007319 | 95 | * @param None |
mbed_official | 52:a51c77007319 | 96 | * @retval None |
mbed_official | 52:a51c77007319 | 97 | */ |
mbed_official | 52:a51c77007319 | 98 | void DAC_DeInit(void) |
mbed_official | 52:a51c77007319 | 99 | { |
mbed_official | 52:a51c77007319 | 100 | /* Enable DAC reset state */ |
mbed_official | 52:a51c77007319 | 101 | RCC_APB1PeriphResetCmd(RCC_APB1Periph_DAC, ENABLE); |
mbed_official | 52:a51c77007319 | 102 | /* Release DAC from reset state */ |
mbed_official | 52:a51c77007319 | 103 | RCC_APB1PeriphResetCmd(RCC_APB1Periph_DAC, DISABLE); |
mbed_official | 52:a51c77007319 | 104 | } |
mbed_official | 52:a51c77007319 | 105 | |
mbed_official | 52:a51c77007319 | 106 | /** |
mbed_official | 52:a51c77007319 | 107 | * @brief Initializes the DAC peripheral according to the specified |
mbed_official | 52:a51c77007319 | 108 | * parameters in the DAC_InitStruct. |
mbed_official | 52:a51c77007319 | 109 | * @param DAC_Channel: the selected DAC channel. |
mbed_official | 52:a51c77007319 | 110 | * This parameter can be one of the following values: |
mbed_official | 52:a51c77007319 | 111 | * @arg DAC_Channel_1: DAC Channel1 selected |
mbed_official | 52:a51c77007319 | 112 | * @arg DAC_Channel_2: DAC Channel2 selected |
mbed_official | 52:a51c77007319 | 113 | * @param DAC_InitStruct: pointer to a DAC_InitTypeDef structure that |
mbed_official | 52:a51c77007319 | 114 | * contains the configuration information for the specified DAC channel. |
mbed_official | 52:a51c77007319 | 115 | * @retval None |
mbed_official | 52:a51c77007319 | 116 | */ |
mbed_official | 52:a51c77007319 | 117 | void DAC_Init(uint32_t DAC_Channel, DAC_InitTypeDef* DAC_InitStruct) |
mbed_official | 52:a51c77007319 | 118 | { |
mbed_official | 52:a51c77007319 | 119 | uint32_t tmpreg1 = 0, tmpreg2 = 0; |
mbed_official | 52:a51c77007319 | 120 | /* Check the DAC parameters */ |
mbed_official | 52:a51c77007319 | 121 | assert_param(IS_DAC_TRIGGER(DAC_InitStruct->DAC_Trigger)); |
mbed_official | 52:a51c77007319 | 122 | assert_param(IS_DAC_GENERATE_WAVE(DAC_InitStruct->DAC_WaveGeneration)); |
mbed_official | 52:a51c77007319 | 123 | assert_param(IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(DAC_InitStruct->DAC_LFSRUnmask_TriangleAmplitude)); |
mbed_official | 52:a51c77007319 | 124 | assert_param(IS_DAC_OUTPUT_BUFFER_STATE(DAC_InitStruct->DAC_OutputBuffer)); |
mbed_official | 52:a51c77007319 | 125 | /*---------------------------- DAC CR Configuration --------------------------*/ |
mbed_official | 52:a51c77007319 | 126 | /* Get the DAC CR value */ |
mbed_official | 52:a51c77007319 | 127 | tmpreg1 = DAC->CR; |
mbed_official | 52:a51c77007319 | 128 | /* Clear BOFFx, TENx, TSELx, WAVEx and MAMPx bits */ |
mbed_official | 52:a51c77007319 | 129 | tmpreg1 &= ~(CR_CLEAR_MASK << DAC_Channel); |
mbed_official | 52:a51c77007319 | 130 | /* Configure for the selected DAC channel: buffer output, trigger, wave generation, |
mbed_official | 52:a51c77007319 | 131 | mask/amplitude for wave generation */ |
mbed_official | 52:a51c77007319 | 132 | /* Set TSELx and TENx bits according to DAC_Trigger value */ |
mbed_official | 52:a51c77007319 | 133 | /* Set WAVEx bits according to DAC_WaveGeneration value */ |
mbed_official | 52:a51c77007319 | 134 | /* Set MAMPx bits according to DAC_LFSRUnmask_TriangleAmplitude value */ |
mbed_official | 52:a51c77007319 | 135 | /* Set BOFFx bit according to DAC_OutputBuffer value */ |
mbed_official | 52:a51c77007319 | 136 | tmpreg2 = (DAC_InitStruct->DAC_Trigger | DAC_InitStruct->DAC_WaveGeneration | |
mbed_official | 52:a51c77007319 | 137 | DAC_InitStruct->DAC_LFSRUnmask_TriangleAmplitude | DAC_InitStruct->DAC_OutputBuffer); |
mbed_official | 52:a51c77007319 | 138 | /* Calculate CR register value depending on DAC_Channel */ |
mbed_official | 52:a51c77007319 | 139 | tmpreg1 |= tmpreg2 << DAC_Channel; |
mbed_official | 52:a51c77007319 | 140 | /* Write to DAC CR */ |
mbed_official | 52:a51c77007319 | 141 | DAC->CR = tmpreg1; |
mbed_official | 52:a51c77007319 | 142 | } |
mbed_official | 52:a51c77007319 | 143 | |
mbed_official | 52:a51c77007319 | 144 | /** |
mbed_official | 52:a51c77007319 | 145 | * @brief Fills each DAC_InitStruct member with its default value. |
mbed_official | 52:a51c77007319 | 146 | * @param DAC_InitStruct : pointer to a DAC_InitTypeDef structure which will |
mbed_official | 52:a51c77007319 | 147 | * be initialized. |
mbed_official | 52:a51c77007319 | 148 | * @retval None |
mbed_official | 52:a51c77007319 | 149 | */ |
mbed_official | 52:a51c77007319 | 150 | void DAC_StructInit(DAC_InitTypeDef* DAC_InitStruct) |
mbed_official | 52:a51c77007319 | 151 | { |
mbed_official | 52:a51c77007319 | 152 | /*--------------- Reset DAC init structure parameters values -----------------*/ |
mbed_official | 52:a51c77007319 | 153 | /* Initialize the DAC_Trigger member */ |
mbed_official | 52:a51c77007319 | 154 | DAC_InitStruct->DAC_Trigger = DAC_Trigger_None; |
mbed_official | 52:a51c77007319 | 155 | /* Initialize the DAC_WaveGeneration member */ |
mbed_official | 52:a51c77007319 | 156 | DAC_InitStruct->DAC_WaveGeneration = DAC_WaveGeneration_None; |
mbed_official | 52:a51c77007319 | 157 | /* Initialize the DAC_LFSRUnmask_TriangleAmplitude member */ |
mbed_official | 52:a51c77007319 | 158 | DAC_InitStruct->DAC_LFSRUnmask_TriangleAmplitude = DAC_LFSRUnmask_Bit0; |
mbed_official | 52:a51c77007319 | 159 | /* Initialize the DAC_OutputBuffer member */ |
mbed_official | 52:a51c77007319 | 160 | DAC_InitStruct->DAC_OutputBuffer = DAC_OutputBuffer_Enable; |
mbed_official | 52:a51c77007319 | 161 | } |
mbed_official | 52:a51c77007319 | 162 | |
mbed_official | 52:a51c77007319 | 163 | /** |
mbed_official | 52:a51c77007319 | 164 | * @brief Enables or disables the specified DAC channel. |
mbed_official | 52:a51c77007319 | 165 | * @param DAC_Channel: the selected DAC channel. |
mbed_official | 52:a51c77007319 | 166 | * This parameter can be one of the following values: |
mbed_official | 52:a51c77007319 | 167 | * @arg DAC_Channel_1: DAC Channel1 selected |
mbed_official | 52:a51c77007319 | 168 | * @arg DAC_Channel_2: DAC Channel2 selected |
mbed_official | 52:a51c77007319 | 169 | * @param NewState: new state of the DAC channel. |
mbed_official | 52:a51c77007319 | 170 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 52:a51c77007319 | 171 | * @retval None |
mbed_official | 52:a51c77007319 | 172 | */ |
mbed_official | 52:a51c77007319 | 173 | void DAC_Cmd(uint32_t DAC_Channel, FunctionalState NewState) |
mbed_official | 52:a51c77007319 | 174 | { |
mbed_official | 52:a51c77007319 | 175 | /* Check the parameters */ |
mbed_official | 52:a51c77007319 | 176 | assert_param(IS_DAC_CHANNEL(DAC_Channel)); |
mbed_official | 52:a51c77007319 | 177 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 52:a51c77007319 | 178 | if (NewState != DISABLE) |
mbed_official | 52:a51c77007319 | 179 | { |
mbed_official | 52:a51c77007319 | 180 | /* Enable the selected DAC channel */ |
mbed_official | 52:a51c77007319 | 181 | DAC->CR |= (DAC_CR_EN1 << DAC_Channel); |
mbed_official | 52:a51c77007319 | 182 | } |
mbed_official | 52:a51c77007319 | 183 | else |
mbed_official | 52:a51c77007319 | 184 | { |
mbed_official | 52:a51c77007319 | 185 | /* Disable the selected DAC channel */ |
mbed_official | 52:a51c77007319 | 186 | DAC->CR &= ~(DAC_CR_EN1 << DAC_Channel); |
mbed_official | 52:a51c77007319 | 187 | } |
mbed_official | 52:a51c77007319 | 188 | } |
mbed_official | 52:a51c77007319 | 189 | #if defined (STM32F10X_LD_VL) || defined (STM32F10X_MD_VL) || defined (STM32F10X_HD_VL) |
mbed_official | 52:a51c77007319 | 190 | /** |
mbed_official | 52:a51c77007319 | 191 | * @brief Enables or disables the specified DAC interrupts. |
mbed_official | 52:a51c77007319 | 192 | * @param DAC_Channel: the selected DAC channel. |
mbed_official | 52:a51c77007319 | 193 | * This parameter can be one of the following values: |
mbed_official | 52:a51c77007319 | 194 | * @arg DAC_Channel_1: DAC Channel1 selected |
mbed_official | 52:a51c77007319 | 195 | * @arg DAC_Channel_2: DAC Channel2 selected |
mbed_official | 52:a51c77007319 | 196 | * @param DAC_IT: specifies the DAC interrupt sources to be enabled or disabled. |
mbed_official | 52:a51c77007319 | 197 | * This parameter can be the following values: |
mbed_official | 52:a51c77007319 | 198 | * @arg DAC_IT_DMAUDR: DMA underrun interrupt mask |
mbed_official | 52:a51c77007319 | 199 | * @param NewState: new state of the specified DAC interrupts. |
mbed_official | 52:a51c77007319 | 200 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 52:a51c77007319 | 201 | * @retval None |
mbed_official | 52:a51c77007319 | 202 | */ |
mbed_official | 52:a51c77007319 | 203 | void DAC_ITConfig(uint32_t DAC_Channel, uint32_t DAC_IT, FunctionalState NewState) |
mbed_official | 52:a51c77007319 | 204 | { |
mbed_official | 52:a51c77007319 | 205 | /* Check the parameters */ |
mbed_official | 52:a51c77007319 | 206 | assert_param(IS_DAC_CHANNEL(DAC_Channel)); |
mbed_official | 52:a51c77007319 | 207 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 52:a51c77007319 | 208 | assert_param(IS_DAC_IT(DAC_IT)); |
mbed_official | 52:a51c77007319 | 209 | |
mbed_official | 52:a51c77007319 | 210 | if (NewState != DISABLE) |
mbed_official | 52:a51c77007319 | 211 | { |
mbed_official | 52:a51c77007319 | 212 | /* Enable the selected DAC interrupts */ |
mbed_official | 52:a51c77007319 | 213 | DAC->CR |= (DAC_IT << DAC_Channel); |
mbed_official | 52:a51c77007319 | 214 | } |
mbed_official | 52:a51c77007319 | 215 | else |
mbed_official | 52:a51c77007319 | 216 | { |
mbed_official | 52:a51c77007319 | 217 | /* Disable the selected DAC interrupts */ |
mbed_official | 52:a51c77007319 | 218 | DAC->CR &= (~(uint32_t)(DAC_IT << DAC_Channel)); |
mbed_official | 52:a51c77007319 | 219 | } |
mbed_official | 52:a51c77007319 | 220 | } |
mbed_official | 52:a51c77007319 | 221 | #endif |
mbed_official | 52:a51c77007319 | 222 | |
mbed_official | 52:a51c77007319 | 223 | /** |
mbed_official | 52:a51c77007319 | 224 | * @brief Enables or disables the specified DAC channel DMA request. |
mbed_official | 52:a51c77007319 | 225 | * @param DAC_Channel: the selected DAC channel. |
mbed_official | 52:a51c77007319 | 226 | * This parameter can be one of the following values: |
mbed_official | 52:a51c77007319 | 227 | * @arg DAC_Channel_1: DAC Channel1 selected |
mbed_official | 52:a51c77007319 | 228 | * @arg DAC_Channel_2: DAC Channel2 selected |
mbed_official | 52:a51c77007319 | 229 | * @param NewState: new state of the selected DAC channel DMA request. |
mbed_official | 52:a51c77007319 | 230 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 52:a51c77007319 | 231 | * @retval None |
mbed_official | 52:a51c77007319 | 232 | */ |
mbed_official | 52:a51c77007319 | 233 | void DAC_DMACmd(uint32_t DAC_Channel, FunctionalState NewState) |
mbed_official | 52:a51c77007319 | 234 | { |
mbed_official | 52:a51c77007319 | 235 | /* Check the parameters */ |
mbed_official | 52:a51c77007319 | 236 | assert_param(IS_DAC_CHANNEL(DAC_Channel)); |
mbed_official | 52:a51c77007319 | 237 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 52:a51c77007319 | 238 | if (NewState != DISABLE) |
mbed_official | 52:a51c77007319 | 239 | { |
mbed_official | 52:a51c77007319 | 240 | /* Enable the selected DAC channel DMA request */ |
mbed_official | 52:a51c77007319 | 241 | DAC->CR |= (DAC_CR_DMAEN1 << DAC_Channel); |
mbed_official | 52:a51c77007319 | 242 | } |
mbed_official | 52:a51c77007319 | 243 | else |
mbed_official | 52:a51c77007319 | 244 | { |
mbed_official | 52:a51c77007319 | 245 | /* Disable the selected DAC channel DMA request */ |
mbed_official | 52:a51c77007319 | 246 | DAC->CR &= ~(DAC_CR_DMAEN1 << DAC_Channel); |
mbed_official | 52:a51c77007319 | 247 | } |
mbed_official | 52:a51c77007319 | 248 | } |
mbed_official | 52:a51c77007319 | 249 | |
mbed_official | 52:a51c77007319 | 250 | /** |
mbed_official | 52:a51c77007319 | 251 | * @brief Enables or disables the selected DAC channel software trigger. |
mbed_official | 52:a51c77007319 | 252 | * @param DAC_Channel: the selected DAC channel. |
mbed_official | 52:a51c77007319 | 253 | * This parameter can be one of the following values: |
mbed_official | 52:a51c77007319 | 254 | * @arg DAC_Channel_1: DAC Channel1 selected |
mbed_official | 52:a51c77007319 | 255 | * @arg DAC_Channel_2: DAC Channel2 selected |
mbed_official | 52:a51c77007319 | 256 | * @param NewState: new state of the selected DAC channel software trigger. |
mbed_official | 52:a51c77007319 | 257 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 52:a51c77007319 | 258 | * @retval None |
mbed_official | 52:a51c77007319 | 259 | */ |
mbed_official | 52:a51c77007319 | 260 | void DAC_SoftwareTriggerCmd(uint32_t DAC_Channel, FunctionalState NewState) |
mbed_official | 52:a51c77007319 | 261 | { |
mbed_official | 52:a51c77007319 | 262 | /* Check the parameters */ |
mbed_official | 52:a51c77007319 | 263 | assert_param(IS_DAC_CHANNEL(DAC_Channel)); |
mbed_official | 52:a51c77007319 | 264 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 52:a51c77007319 | 265 | if (NewState != DISABLE) |
mbed_official | 52:a51c77007319 | 266 | { |
mbed_official | 52:a51c77007319 | 267 | /* Enable software trigger for the selected DAC channel */ |
mbed_official | 52:a51c77007319 | 268 | DAC->SWTRIGR |= (uint32_t)DAC_SWTRIGR_SWTRIG1 << (DAC_Channel >> 4); |
mbed_official | 52:a51c77007319 | 269 | } |
mbed_official | 52:a51c77007319 | 270 | else |
mbed_official | 52:a51c77007319 | 271 | { |
mbed_official | 52:a51c77007319 | 272 | /* Disable software trigger for the selected DAC channel */ |
mbed_official | 52:a51c77007319 | 273 | DAC->SWTRIGR &= ~((uint32_t)DAC_SWTRIGR_SWTRIG1 << (DAC_Channel >> 4)); |
mbed_official | 52:a51c77007319 | 274 | } |
mbed_official | 52:a51c77007319 | 275 | } |
mbed_official | 52:a51c77007319 | 276 | |
mbed_official | 52:a51c77007319 | 277 | /** |
mbed_official | 52:a51c77007319 | 278 | * @brief Enables or disables simultaneously the two DAC channels software |
mbed_official | 52:a51c77007319 | 279 | * triggers. |
mbed_official | 52:a51c77007319 | 280 | * @param NewState: new state of the DAC channels software triggers. |
mbed_official | 52:a51c77007319 | 281 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 52:a51c77007319 | 282 | * @retval None |
mbed_official | 52:a51c77007319 | 283 | */ |
mbed_official | 52:a51c77007319 | 284 | void DAC_DualSoftwareTriggerCmd(FunctionalState NewState) |
mbed_official | 52:a51c77007319 | 285 | { |
mbed_official | 52:a51c77007319 | 286 | /* Check the parameters */ |
mbed_official | 52:a51c77007319 | 287 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 52:a51c77007319 | 288 | if (NewState != DISABLE) |
mbed_official | 52:a51c77007319 | 289 | { |
mbed_official | 52:a51c77007319 | 290 | /* Enable software trigger for both DAC channels */ |
mbed_official | 52:a51c77007319 | 291 | DAC->SWTRIGR |= DUAL_SWTRIG_SET ; |
mbed_official | 52:a51c77007319 | 292 | } |
mbed_official | 52:a51c77007319 | 293 | else |
mbed_official | 52:a51c77007319 | 294 | { |
mbed_official | 52:a51c77007319 | 295 | /* Disable software trigger for both DAC channels */ |
mbed_official | 52:a51c77007319 | 296 | DAC->SWTRIGR &= DUAL_SWTRIG_RESET; |
mbed_official | 52:a51c77007319 | 297 | } |
mbed_official | 52:a51c77007319 | 298 | } |
mbed_official | 52:a51c77007319 | 299 | |
mbed_official | 52:a51c77007319 | 300 | /** |
mbed_official | 52:a51c77007319 | 301 | * @brief Enables or disables the selected DAC channel wave generation. |
mbed_official | 52:a51c77007319 | 302 | * @param DAC_Channel: the selected DAC channel. |
mbed_official | 52:a51c77007319 | 303 | * This parameter can be one of the following values: |
mbed_official | 52:a51c77007319 | 304 | * @arg DAC_Channel_1: DAC Channel1 selected |
mbed_official | 52:a51c77007319 | 305 | * @arg DAC_Channel_2: DAC Channel2 selected |
mbed_official | 52:a51c77007319 | 306 | * @param DAC_Wave: Specifies the wave type to enable or disable. |
mbed_official | 52:a51c77007319 | 307 | * This parameter can be one of the following values: |
mbed_official | 52:a51c77007319 | 308 | * @arg DAC_Wave_Noise: noise wave generation |
mbed_official | 52:a51c77007319 | 309 | * @arg DAC_Wave_Triangle: triangle wave generation |
mbed_official | 52:a51c77007319 | 310 | * @param NewState: new state of the selected DAC channel wave generation. |
mbed_official | 52:a51c77007319 | 311 | * This parameter can be: ENABLE or DISABLE. |
mbed_official | 52:a51c77007319 | 312 | * @retval None |
mbed_official | 52:a51c77007319 | 313 | */ |
mbed_official | 52:a51c77007319 | 314 | void DAC_WaveGenerationCmd(uint32_t DAC_Channel, uint32_t DAC_Wave, FunctionalState NewState) |
mbed_official | 52:a51c77007319 | 315 | { |
mbed_official | 52:a51c77007319 | 316 | /* Check the parameters */ |
mbed_official | 52:a51c77007319 | 317 | assert_param(IS_DAC_CHANNEL(DAC_Channel)); |
mbed_official | 52:a51c77007319 | 318 | assert_param(IS_DAC_WAVE(DAC_Wave)); |
mbed_official | 52:a51c77007319 | 319 | assert_param(IS_FUNCTIONAL_STATE(NewState)); |
mbed_official | 52:a51c77007319 | 320 | if (NewState != DISABLE) |
mbed_official | 52:a51c77007319 | 321 | { |
mbed_official | 52:a51c77007319 | 322 | /* Enable the selected wave generation for the selected DAC channel */ |
mbed_official | 52:a51c77007319 | 323 | DAC->CR |= DAC_Wave << DAC_Channel; |
mbed_official | 52:a51c77007319 | 324 | } |
mbed_official | 52:a51c77007319 | 325 | else |
mbed_official | 52:a51c77007319 | 326 | { |
mbed_official | 52:a51c77007319 | 327 | /* Disable the selected wave generation for the selected DAC channel */ |
mbed_official | 52:a51c77007319 | 328 | DAC->CR &= ~(DAC_Wave << DAC_Channel); |
mbed_official | 52:a51c77007319 | 329 | } |
mbed_official | 52:a51c77007319 | 330 | } |
mbed_official | 52:a51c77007319 | 331 | |
mbed_official | 52:a51c77007319 | 332 | /** |
mbed_official | 52:a51c77007319 | 333 | * @brief Set the specified data holding register value for DAC channel1. |
mbed_official | 52:a51c77007319 | 334 | * @param DAC_Align: Specifies the data alignment for DAC channel1. |
mbed_official | 52:a51c77007319 | 335 | * This parameter can be one of the following values: |
mbed_official | 52:a51c77007319 | 336 | * @arg DAC_Align_8b_R: 8bit right data alignment selected |
mbed_official | 52:a51c77007319 | 337 | * @arg DAC_Align_12b_L: 12bit left data alignment selected |
mbed_official | 52:a51c77007319 | 338 | * @arg DAC_Align_12b_R: 12bit right data alignment selected |
mbed_official | 52:a51c77007319 | 339 | * @param Data : Data to be loaded in the selected data holding register. |
mbed_official | 52:a51c77007319 | 340 | * @retval None |
mbed_official | 52:a51c77007319 | 341 | */ |
mbed_official | 52:a51c77007319 | 342 | void DAC_SetChannel1Data(uint32_t DAC_Align, uint16_t Data) |
mbed_official | 52:a51c77007319 | 343 | { |
mbed_official | 52:a51c77007319 | 344 | __IO uint32_t tmp = 0; |
mbed_official | 52:a51c77007319 | 345 | |
mbed_official | 52:a51c77007319 | 346 | /* Check the parameters */ |
mbed_official | 52:a51c77007319 | 347 | assert_param(IS_DAC_ALIGN(DAC_Align)); |
mbed_official | 52:a51c77007319 | 348 | assert_param(IS_DAC_DATA(Data)); |
mbed_official | 52:a51c77007319 | 349 | |
mbed_official | 52:a51c77007319 | 350 | tmp = (uint32_t)DAC_BASE; |
mbed_official | 52:a51c77007319 | 351 | tmp += DHR12R1_OFFSET + DAC_Align; |
mbed_official | 52:a51c77007319 | 352 | |
mbed_official | 52:a51c77007319 | 353 | /* Set the DAC channel1 selected data holding register */ |
mbed_official | 52:a51c77007319 | 354 | *(__IO uint32_t *) tmp = Data; |
mbed_official | 52:a51c77007319 | 355 | } |
mbed_official | 52:a51c77007319 | 356 | |
mbed_official | 52:a51c77007319 | 357 | /** |
mbed_official | 52:a51c77007319 | 358 | * @brief Set the specified data holding register value for DAC channel2. |
mbed_official | 52:a51c77007319 | 359 | * @param DAC_Align: Specifies the data alignment for DAC channel2. |
mbed_official | 52:a51c77007319 | 360 | * This parameter can be one of the following values: |
mbed_official | 52:a51c77007319 | 361 | * @arg DAC_Align_8b_R: 8bit right data alignment selected |
mbed_official | 52:a51c77007319 | 362 | * @arg DAC_Align_12b_L: 12bit left data alignment selected |
mbed_official | 52:a51c77007319 | 363 | * @arg DAC_Align_12b_R: 12bit right data alignment selected |
mbed_official | 52:a51c77007319 | 364 | * @param Data : Data to be loaded in the selected data holding register. |
mbed_official | 52:a51c77007319 | 365 | * @retval None |
mbed_official | 52:a51c77007319 | 366 | */ |
mbed_official | 52:a51c77007319 | 367 | void DAC_SetChannel2Data(uint32_t DAC_Align, uint16_t Data) |
mbed_official | 52:a51c77007319 | 368 | { |
mbed_official | 52:a51c77007319 | 369 | __IO uint32_t tmp = 0; |
mbed_official | 52:a51c77007319 | 370 | |
mbed_official | 52:a51c77007319 | 371 | /* Check the parameters */ |
mbed_official | 52:a51c77007319 | 372 | assert_param(IS_DAC_ALIGN(DAC_Align)); |
mbed_official | 52:a51c77007319 | 373 | assert_param(IS_DAC_DATA(Data)); |
mbed_official | 52:a51c77007319 | 374 | |
mbed_official | 52:a51c77007319 | 375 | tmp = (uint32_t)DAC_BASE; |
mbed_official | 52:a51c77007319 | 376 | tmp += DHR12R2_OFFSET + DAC_Align; |
mbed_official | 52:a51c77007319 | 377 | |
mbed_official | 52:a51c77007319 | 378 | /* Set the DAC channel2 selected data holding register */ |
mbed_official | 52:a51c77007319 | 379 | *(__IO uint32_t *)tmp = Data; |
mbed_official | 52:a51c77007319 | 380 | } |
mbed_official | 52:a51c77007319 | 381 | |
mbed_official | 52:a51c77007319 | 382 | /** |
mbed_official | 52:a51c77007319 | 383 | * @brief Set the specified data holding register value for dual channel |
mbed_official | 52:a51c77007319 | 384 | * DAC. |
mbed_official | 52:a51c77007319 | 385 | * @param DAC_Align: Specifies the data alignment for dual channel DAC. |
mbed_official | 52:a51c77007319 | 386 | * This parameter can be one of the following values: |
mbed_official | 52:a51c77007319 | 387 | * @arg DAC_Align_8b_R: 8bit right data alignment selected |
mbed_official | 52:a51c77007319 | 388 | * @arg DAC_Align_12b_L: 12bit left data alignment selected |
mbed_official | 52:a51c77007319 | 389 | * @arg DAC_Align_12b_R: 12bit right data alignment selected |
mbed_official | 52:a51c77007319 | 390 | * @param Data2: Data for DAC Channel2 to be loaded in the selected data |
mbed_official | 52:a51c77007319 | 391 | * holding register. |
mbed_official | 52:a51c77007319 | 392 | * @param Data1: Data for DAC Channel1 to be loaded in the selected data |
mbed_official | 52:a51c77007319 | 393 | * holding register. |
mbed_official | 52:a51c77007319 | 394 | * @retval None |
mbed_official | 52:a51c77007319 | 395 | */ |
mbed_official | 52:a51c77007319 | 396 | void DAC_SetDualChannelData(uint32_t DAC_Align, uint16_t Data2, uint16_t Data1) |
mbed_official | 52:a51c77007319 | 397 | { |
mbed_official | 52:a51c77007319 | 398 | uint32_t data = 0, tmp = 0; |
mbed_official | 52:a51c77007319 | 399 | |
mbed_official | 52:a51c77007319 | 400 | /* Check the parameters */ |
mbed_official | 52:a51c77007319 | 401 | assert_param(IS_DAC_ALIGN(DAC_Align)); |
mbed_official | 52:a51c77007319 | 402 | assert_param(IS_DAC_DATA(Data1)); |
mbed_official | 52:a51c77007319 | 403 | assert_param(IS_DAC_DATA(Data2)); |
mbed_official | 52:a51c77007319 | 404 | |
mbed_official | 52:a51c77007319 | 405 | /* Calculate and set dual DAC data holding register value */ |
mbed_official | 52:a51c77007319 | 406 | if (DAC_Align == DAC_Align_8b_R) |
mbed_official | 52:a51c77007319 | 407 | { |
mbed_official | 52:a51c77007319 | 408 | data = ((uint32_t)Data2 << 8) | Data1; |
mbed_official | 52:a51c77007319 | 409 | } |
mbed_official | 52:a51c77007319 | 410 | else |
mbed_official | 52:a51c77007319 | 411 | { |
mbed_official | 52:a51c77007319 | 412 | data = ((uint32_t)Data2 << 16) | Data1; |
mbed_official | 52:a51c77007319 | 413 | } |
mbed_official | 52:a51c77007319 | 414 | |
mbed_official | 52:a51c77007319 | 415 | tmp = (uint32_t)DAC_BASE; |
mbed_official | 52:a51c77007319 | 416 | tmp += DHR12RD_OFFSET + DAC_Align; |
mbed_official | 52:a51c77007319 | 417 | |
mbed_official | 52:a51c77007319 | 418 | /* Set the dual DAC selected data holding register */ |
mbed_official | 52:a51c77007319 | 419 | *(__IO uint32_t *)tmp = data; |
mbed_official | 52:a51c77007319 | 420 | } |
mbed_official | 52:a51c77007319 | 421 | |
mbed_official | 52:a51c77007319 | 422 | /** |
mbed_official | 52:a51c77007319 | 423 | * @brief Returns the last data output value of the selected DAC channel. |
mbed_official | 52:a51c77007319 | 424 | * @param DAC_Channel: the selected DAC channel. |
mbed_official | 52:a51c77007319 | 425 | * This parameter can be one of the following values: |
mbed_official | 52:a51c77007319 | 426 | * @arg DAC_Channel_1: DAC Channel1 selected |
mbed_official | 52:a51c77007319 | 427 | * @arg DAC_Channel_2: DAC Channel2 selected |
mbed_official | 52:a51c77007319 | 428 | * @retval The selected DAC channel data output value. |
mbed_official | 52:a51c77007319 | 429 | */ |
mbed_official | 52:a51c77007319 | 430 | uint16_t DAC_GetDataOutputValue(uint32_t DAC_Channel) |
mbed_official | 52:a51c77007319 | 431 | { |
mbed_official | 52:a51c77007319 | 432 | __IO uint32_t tmp = 0; |
mbed_official | 52:a51c77007319 | 433 | |
mbed_official | 52:a51c77007319 | 434 | /* Check the parameters */ |
mbed_official | 52:a51c77007319 | 435 | assert_param(IS_DAC_CHANNEL(DAC_Channel)); |
mbed_official | 52:a51c77007319 | 436 | |
mbed_official | 52:a51c77007319 | 437 | tmp = (uint32_t) DAC_BASE ; |
mbed_official | 52:a51c77007319 | 438 | tmp += DOR_OFFSET + ((uint32_t)DAC_Channel >> 2); |
mbed_official | 52:a51c77007319 | 439 | |
mbed_official | 52:a51c77007319 | 440 | /* Returns the DAC channel data output register value */ |
mbed_official | 52:a51c77007319 | 441 | return (uint16_t) (*(__IO uint32_t*) tmp); |
mbed_official | 52:a51c77007319 | 442 | } |
mbed_official | 52:a51c77007319 | 443 | |
mbed_official | 52:a51c77007319 | 444 | #if defined (STM32F10X_LD_VL) || defined (STM32F10X_MD_VL) || defined (STM32F10X_HD_VL) |
mbed_official | 52:a51c77007319 | 445 | /** |
mbed_official | 52:a51c77007319 | 446 | * @brief Checks whether the specified DAC flag is set or not. |
mbed_official | 52:a51c77007319 | 447 | * @param DAC_Channel: thee selected DAC channel. |
mbed_official | 52:a51c77007319 | 448 | * This parameter can be one of the following values: |
mbed_official | 52:a51c77007319 | 449 | * @arg DAC_Channel_1: DAC Channel1 selected |
mbed_official | 52:a51c77007319 | 450 | * @arg DAC_Channel_2: DAC Channel2 selected |
mbed_official | 52:a51c77007319 | 451 | * @param DAC_FLAG: specifies the flag to check. |
mbed_official | 52:a51c77007319 | 452 | * This parameter can be only of the following value: |
mbed_official | 52:a51c77007319 | 453 | * @arg DAC_FLAG_DMAUDR: DMA underrun flag |
mbed_official | 52:a51c77007319 | 454 | * @retval The new state of DAC_FLAG (SET or RESET). |
mbed_official | 52:a51c77007319 | 455 | */ |
mbed_official | 52:a51c77007319 | 456 | FlagStatus DAC_GetFlagStatus(uint32_t DAC_Channel, uint32_t DAC_FLAG) |
mbed_official | 52:a51c77007319 | 457 | { |
mbed_official | 52:a51c77007319 | 458 | FlagStatus bitstatus = RESET; |
mbed_official | 52:a51c77007319 | 459 | /* Check the parameters */ |
mbed_official | 52:a51c77007319 | 460 | assert_param(IS_DAC_CHANNEL(DAC_Channel)); |
mbed_official | 52:a51c77007319 | 461 | assert_param(IS_DAC_FLAG(DAC_FLAG)); |
mbed_official | 52:a51c77007319 | 462 | |
mbed_official | 52:a51c77007319 | 463 | /* Check the status of the specified DAC flag */ |
mbed_official | 52:a51c77007319 | 464 | if ((DAC->SR & (DAC_FLAG << DAC_Channel)) != (uint8_t)RESET) |
mbed_official | 52:a51c77007319 | 465 | { |
mbed_official | 52:a51c77007319 | 466 | /* DAC_FLAG is set */ |
mbed_official | 52:a51c77007319 | 467 | bitstatus = SET; |
mbed_official | 52:a51c77007319 | 468 | } |
mbed_official | 52:a51c77007319 | 469 | else |
mbed_official | 52:a51c77007319 | 470 | { |
mbed_official | 52:a51c77007319 | 471 | /* DAC_FLAG is reset */ |
mbed_official | 52:a51c77007319 | 472 | bitstatus = RESET; |
mbed_official | 52:a51c77007319 | 473 | } |
mbed_official | 52:a51c77007319 | 474 | /* Return the DAC_FLAG status */ |
mbed_official | 52:a51c77007319 | 475 | return bitstatus; |
mbed_official | 52:a51c77007319 | 476 | } |
mbed_official | 52:a51c77007319 | 477 | |
mbed_official | 52:a51c77007319 | 478 | /** |
mbed_official | 52:a51c77007319 | 479 | * @brief Clears the DAC channelx's pending flags. |
mbed_official | 52:a51c77007319 | 480 | * @param DAC_Channel: the selected DAC channel. |
mbed_official | 52:a51c77007319 | 481 | * This parameter can be one of the following values: |
mbed_official | 52:a51c77007319 | 482 | * @arg DAC_Channel_1: DAC Channel1 selected |
mbed_official | 52:a51c77007319 | 483 | * @arg DAC_Channel_2: DAC Channel2 selected |
mbed_official | 52:a51c77007319 | 484 | * @param DAC_FLAG: specifies the flag to clear. |
mbed_official | 52:a51c77007319 | 485 | * This parameter can be of the following value: |
mbed_official | 52:a51c77007319 | 486 | * @arg DAC_FLAG_DMAUDR: DMA underrun flag |
mbed_official | 52:a51c77007319 | 487 | * @retval None |
mbed_official | 52:a51c77007319 | 488 | */ |
mbed_official | 52:a51c77007319 | 489 | void DAC_ClearFlag(uint32_t DAC_Channel, uint32_t DAC_FLAG) |
mbed_official | 52:a51c77007319 | 490 | { |
mbed_official | 52:a51c77007319 | 491 | /* Check the parameters */ |
mbed_official | 52:a51c77007319 | 492 | assert_param(IS_DAC_CHANNEL(DAC_Channel)); |
mbed_official | 52:a51c77007319 | 493 | assert_param(IS_DAC_FLAG(DAC_FLAG)); |
mbed_official | 52:a51c77007319 | 494 | |
mbed_official | 52:a51c77007319 | 495 | /* Clear the selected DAC flags */ |
mbed_official | 52:a51c77007319 | 496 | DAC->SR = (DAC_FLAG << DAC_Channel); |
mbed_official | 52:a51c77007319 | 497 | } |
mbed_official | 52:a51c77007319 | 498 | |
mbed_official | 52:a51c77007319 | 499 | /** |
mbed_official | 52:a51c77007319 | 500 | * @brief Checks whether the specified DAC interrupt has occurred or not. |
mbed_official | 52:a51c77007319 | 501 | * @param DAC_Channel: the selected DAC channel. |
mbed_official | 52:a51c77007319 | 502 | * This parameter can be one of the following values: |
mbed_official | 52:a51c77007319 | 503 | * @arg DAC_Channel_1: DAC Channel1 selected |
mbed_official | 52:a51c77007319 | 504 | * @arg DAC_Channel_2: DAC Channel2 selected |
mbed_official | 52:a51c77007319 | 505 | * @param DAC_IT: specifies the DAC interrupt source to check. |
mbed_official | 52:a51c77007319 | 506 | * This parameter can be the following values: |
mbed_official | 52:a51c77007319 | 507 | * @arg DAC_IT_DMAUDR: DMA underrun interrupt mask |
mbed_official | 52:a51c77007319 | 508 | * @retval The new state of DAC_IT (SET or RESET). |
mbed_official | 52:a51c77007319 | 509 | */ |
mbed_official | 52:a51c77007319 | 510 | ITStatus DAC_GetITStatus(uint32_t DAC_Channel, uint32_t DAC_IT) |
mbed_official | 52:a51c77007319 | 511 | { |
mbed_official | 52:a51c77007319 | 512 | ITStatus bitstatus = RESET; |
mbed_official | 52:a51c77007319 | 513 | uint32_t enablestatus = 0; |
mbed_official | 52:a51c77007319 | 514 | |
mbed_official | 52:a51c77007319 | 515 | /* Check the parameters */ |
mbed_official | 52:a51c77007319 | 516 | assert_param(IS_DAC_CHANNEL(DAC_Channel)); |
mbed_official | 52:a51c77007319 | 517 | assert_param(IS_DAC_IT(DAC_IT)); |
mbed_official | 52:a51c77007319 | 518 | |
mbed_official | 52:a51c77007319 | 519 | /* Get the DAC_IT enable bit status */ |
mbed_official | 52:a51c77007319 | 520 | enablestatus = (DAC->CR & (DAC_IT << DAC_Channel)) ; |
mbed_official | 52:a51c77007319 | 521 | |
mbed_official | 52:a51c77007319 | 522 | /* Check the status of the specified DAC interrupt */ |
mbed_official | 52:a51c77007319 | 523 | if (((DAC->SR & (DAC_IT << DAC_Channel)) != (uint32_t)RESET) && enablestatus) |
mbed_official | 52:a51c77007319 | 524 | { |
mbed_official | 52:a51c77007319 | 525 | /* DAC_IT is set */ |
mbed_official | 52:a51c77007319 | 526 | bitstatus = SET; |
mbed_official | 52:a51c77007319 | 527 | } |
mbed_official | 52:a51c77007319 | 528 | else |
mbed_official | 52:a51c77007319 | 529 | { |
mbed_official | 52:a51c77007319 | 530 | /* DAC_IT is reset */ |
mbed_official | 52:a51c77007319 | 531 | bitstatus = RESET; |
mbed_official | 52:a51c77007319 | 532 | } |
mbed_official | 52:a51c77007319 | 533 | /* Return the DAC_IT status */ |
mbed_official | 52:a51c77007319 | 534 | return bitstatus; |
mbed_official | 52:a51c77007319 | 535 | } |
mbed_official | 52:a51c77007319 | 536 | |
mbed_official | 52:a51c77007319 | 537 | /** |
mbed_official | 52:a51c77007319 | 538 | * @brief Clears the DAC channelx's interrupt pending bits. |
mbed_official | 52:a51c77007319 | 539 | * @param DAC_Channel: the selected DAC channel. |
mbed_official | 52:a51c77007319 | 540 | * This parameter can be one of the following values: |
mbed_official | 52:a51c77007319 | 541 | * @arg DAC_Channel_1: DAC Channel1 selected |
mbed_official | 52:a51c77007319 | 542 | * @arg DAC_Channel_2: DAC Channel2 selected |
mbed_official | 52:a51c77007319 | 543 | * @param DAC_IT: specifies the DAC interrupt pending bit to clear. |
mbed_official | 52:a51c77007319 | 544 | * This parameter can be the following values: |
mbed_official | 52:a51c77007319 | 545 | * @arg DAC_IT_DMAUDR: DMA underrun interrupt mask |
mbed_official | 52:a51c77007319 | 546 | * @retval None |
mbed_official | 52:a51c77007319 | 547 | */ |
mbed_official | 52:a51c77007319 | 548 | void DAC_ClearITPendingBit(uint32_t DAC_Channel, uint32_t DAC_IT) |
mbed_official | 52:a51c77007319 | 549 | { |
mbed_official | 52:a51c77007319 | 550 | /* Check the parameters */ |
mbed_official | 52:a51c77007319 | 551 | assert_param(IS_DAC_CHANNEL(DAC_Channel)); |
mbed_official | 52:a51c77007319 | 552 | assert_param(IS_DAC_IT(DAC_IT)); |
mbed_official | 52:a51c77007319 | 553 | |
mbed_official | 52:a51c77007319 | 554 | /* Clear the selected DAC interrupt pending bits */ |
mbed_official | 52:a51c77007319 | 555 | DAC->SR = (DAC_IT << DAC_Channel); |
mbed_official | 52:a51c77007319 | 556 | } |
mbed_official | 52:a51c77007319 | 557 | #endif |
mbed_official | 52:a51c77007319 | 558 | |
mbed_official | 52:a51c77007319 | 559 | /** |
mbed_official | 52:a51c77007319 | 560 | * @} |
mbed_official | 52:a51c77007319 | 561 | */ |
mbed_official | 52:a51c77007319 | 562 | |
mbed_official | 52:a51c77007319 | 563 | /** |
mbed_official | 52:a51c77007319 | 564 | * @} |
mbed_official | 52:a51c77007319 | 565 | */ |
mbed_official | 52:a51c77007319 | 566 | |
mbed_official | 52:a51c77007319 | 567 | /** |
mbed_official | 52:a51c77007319 | 568 | * @} |
mbed_official | 52:a51c77007319 | 569 | */ |
mbed_official | 52:a51c77007319 | 570 | |
mbed_official | 52:a51c77007319 | 571 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ |