mbed library sources

Dependents:   frdm_kl05z_gpio_test

Fork of mbed-src by mbed official

Committer:
shaoziyang
Date:
Sat Sep 13 14:25:46 2014 +0000
Revision:
323:9e901b0a5aa1
Parent:
106:ced8cbb51063
test with CLOCK_SETUP = 0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 76:aeb1df146756 1 /**
mbed_official 76:aeb1df146756 2 ******************************************************************************
mbed_official 76:aeb1df146756 3 * @file stm32f0xx_dac.h
mbed_official 76:aeb1df146756 4 * @author MCD Application Team
mbed_official 76:aeb1df146756 5 * @version V1.3.0
mbed_official 76:aeb1df146756 6 * @date 16-January-2014
mbed_official 76:aeb1df146756 7 * @brief This file contains all the functions prototypes for the DAC firmware
mbed_official 76:aeb1df146756 8 * library, applicable only for STM32F051 and STM32F072 devices.
mbed_official 76:aeb1df146756 9 ******************************************************************************
mbed_official 76:aeb1df146756 10 * @attention
mbed_official 76:aeb1df146756 11 *
mbed_official 106:ced8cbb51063 12 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
mbed_official 76:aeb1df146756 13 *
mbed_official 106:ced8cbb51063 14 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 106:ced8cbb51063 15 * are permitted provided that the following conditions are met:
mbed_official 106:ced8cbb51063 16 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 106:ced8cbb51063 17 * this list of conditions and the following disclaimer.
mbed_official 106:ced8cbb51063 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 106:ced8cbb51063 19 * this list of conditions and the following disclaimer in the documentation
mbed_official 106:ced8cbb51063 20 * and/or other materials provided with the distribution.
mbed_official 106:ced8cbb51063 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 106:ced8cbb51063 22 * may be used to endorse or promote products derived from this software
mbed_official 106:ced8cbb51063 23 * without specific prior written permission.
mbed_official 76:aeb1df146756 24 *
mbed_official 106:ced8cbb51063 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 106:ced8cbb51063 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 106:ced8cbb51063 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 106:ced8cbb51063 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 106:ced8cbb51063 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 106:ced8cbb51063 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 106:ced8cbb51063 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 106:ced8cbb51063 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 106:ced8cbb51063 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 106:ced8cbb51063 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 76:aeb1df146756 35 *
mbed_official 76:aeb1df146756 36 ******************************************************************************
mbed_official 76:aeb1df146756 37 */
mbed_official 76:aeb1df146756 38
mbed_official 76:aeb1df146756 39 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 76:aeb1df146756 40 #ifndef __STM32F0XX_DAC_H
mbed_official 76:aeb1df146756 41 #define __STM32F0XX_DAC_H
mbed_official 76:aeb1df146756 42
mbed_official 76:aeb1df146756 43 #ifdef __cplusplus
mbed_official 76:aeb1df146756 44 extern "C" {
mbed_official 76:aeb1df146756 45 #endif
mbed_official 76:aeb1df146756 46
mbed_official 76:aeb1df146756 47 /* Includes ------------------------------------------------------------------*/
mbed_official 76:aeb1df146756 48 #include "stm32f0xx.h"
mbed_official 76:aeb1df146756 49
mbed_official 76:aeb1df146756 50 /** @addtogroup STM32F0xx_StdPeriph_Driver
mbed_official 76:aeb1df146756 51 * @{
mbed_official 76:aeb1df146756 52 */
mbed_official 76:aeb1df146756 53
mbed_official 76:aeb1df146756 54 /** @addtogroup DAC
mbed_official 76:aeb1df146756 55 * @{
mbed_official 76:aeb1df146756 56 */
mbed_official 76:aeb1df146756 57
mbed_official 76:aeb1df146756 58 /* Exported types ------------------------------------------------------------*/
mbed_official 76:aeb1df146756 59
mbed_official 76:aeb1df146756 60 /**
mbed_official 76:aeb1df146756 61 * @brief DAC Init structure definition
mbed_official 76:aeb1df146756 62 */
mbed_official 76:aeb1df146756 63
mbed_official 76:aeb1df146756 64 typedef struct
mbed_official 76:aeb1df146756 65 {
mbed_official 76:aeb1df146756 66 uint32_t DAC_Trigger; /*!< Specifies the external trigger for the selected DAC channel.
mbed_official 76:aeb1df146756 67 This parameter can be a value of @ref DAC_trigger_selection */
mbed_official 76:aeb1df146756 68
mbed_official 76:aeb1df146756 69 uint32_t DAC_WaveGeneration; /*!< Specifies whether DAC channel noise waves or triangle waves
mbed_official 76:aeb1df146756 70 are generated, or whether no wave is generated.
mbed_official 76:aeb1df146756 71 This parameter can be a value of @ref DAC_wave_generation
mbed_official 76:aeb1df146756 72 This parameter is only applicable for STM32F072 devices */
mbed_official 76:aeb1df146756 73
mbed_official 76:aeb1df146756 74 uint32_t DAC_LFSRUnmask_TriangleAmplitude; /*!< Specifies the LFSR mask for noise wave generation or
mbed_official 76:aeb1df146756 75 the maximum amplitude triangle generation for the DAC channel.
mbed_official 76:aeb1df146756 76 This parameter can be a value of @ref DAC_lfsrunmask_triangleamplitude
mbed_official 76:aeb1df146756 77 This parameter is only applicable for STM32F072 devices */
mbed_official 76:aeb1df146756 78
mbed_official 76:aeb1df146756 79 uint32_t DAC_OutputBuffer; /*!< Specifies whether the DAC channel output buffer is enabled or disabled.
mbed_official 76:aeb1df146756 80 This parameter can be a value of @ref DAC_output_buffer */
mbed_official 76:aeb1df146756 81 }DAC_InitTypeDef;
mbed_official 76:aeb1df146756 82
mbed_official 76:aeb1df146756 83 /* Exported constants --------------------------------------------------------*/
mbed_official 76:aeb1df146756 84
mbed_official 76:aeb1df146756 85 /** @defgroup DAC_Exported_Constants
mbed_official 76:aeb1df146756 86 * @{
mbed_official 76:aeb1df146756 87 */
mbed_official 76:aeb1df146756 88
mbed_official 76:aeb1df146756 89 /** @defgroup DAC_Trigger
mbed_official 76:aeb1df146756 90 * @{
mbed_official 76:aeb1df146756 91 */
mbed_official 76:aeb1df146756 92
mbed_official 76:aeb1df146756 93 #define DAC_Trigger_None ((uint32_t)0x00000000) /*!< Conversion is automatic once the DAC1_DHRxxxx register
mbed_official 76:aeb1df146756 94 has been loaded, and not by external trigger */
mbed_official 76:aeb1df146756 95 #define DAC_Trigger_T6_TRGO ((uint32_t)0x00000004) /*!< TIM6 TRGO selected as external conversion trigger for DAC channel1 */
mbed_official 76:aeb1df146756 96 #define DAC_Trigger_T3_TRGO ((uint32_t)0x0000000C) /*!< TIM3 TRGO selected as external conversion trigger for DAC channel1 */
mbed_official 76:aeb1df146756 97 #define DAC_Trigger_T7_TRGO ((uint32_t)0x00000014) /*!< TIM7 TRGO selected as external conversion trigger for DAC channel1,
mbed_official 76:aeb1df146756 98 applicable only for STM32F072 devices */
mbed_official 76:aeb1df146756 99 #define DAC_Trigger_T15_TRGO ((uint32_t)0x0000001C) /*!< TIM15 TRGO selected as external conversion trigger for DAC channel1 */
mbed_official 76:aeb1df146756 100 #define DAC_Trigger_T2_TRGO ((uint32_t)0x00000024) /*!< TIM2 TRGO selected as external conversion trigger for DAC channel1 */
mbed_official 76:aeb1df146756 101 #define DAC_Trigger_Ext_IT9 ((uint32_t)0x00000034) /*!< EXTI Line9 event selected as external conversion trigger for DAC channels */
mbed_official 76:aeb1df146756 102 #define DAC_Trigger_Software ((uint32_t)0x0000003C) /*!< Conversion started by software trigger for DAC channels */
mbed_official 76:aeb1df146756 103
mbed_official 76:aeb1df146756 104 #define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_Trigger_None) || \
mbed_official 76:aeb1df146756 105 ((TRIGGER) == DAC_Trigger_T6_TRGO) || \
mbed_official 76:aeb1df146756 106 ((TRIGGER) == DAC_Trigger_T7_TRGO) || \
mbed_official 76:aeb1df146756 107 ((TRIGGER) == DAC_Trigger_T3_TRGO) || \
mbed_official 76:aeb1df146756 108 ((TRIGGER) == DAC_Trigger_T15_TRGO) || \
mbed_official 76:aeb1df146756 109 ((TRIGGER) == DAC_Trigger_T2_TRGO) || \
mbed_official 76:aeb1df146756 110 ((TRIGGER) == DAC_Trigger_Ext_IT9) || \
mbed_official 76:aeb1df146756 111 ((TRIGGER) == DAC_Trigger_Software))
mbed_official 76:aeb1df146756 112
mbed_official 76:aeb1df146756 113 /**
mbed_official 76:aeb1df146756 114 * @}
mbed_official 76:aeb1df146756 115 */
mbed_official 76:aeb1df146756 116
mbed_official 76:aeb1df146756 117 /** @defgroup DAC_wave_generation
mbed_official 76:aeb1df146756 118 * @brief This parameters are only applicable for STM32F072 devices.
mbed_official 76:aeb1df146756 119 * @{
mbed_official 76:aeb1df146756 120 */
mbed_official 76:aeb1df146756 121
mbed_official 76:aeb1df146756 122 #define DAC_WaveGeneration_None ((uint32_t)0x00000000)
mbed_official 76:aeb1df146756 123 #define DAC_WaveGeneration_Noise ((uint32_t)0x00000040)
mbed_official 76:aeb1df146756 124 #define DAC_WaveGeneration_Triangle ((uint32_t)0x00000080)
mbed_official 76:aeb1df146756 125 #define IS_DAC_GENERATE_WAVE(WAVE) (((WAVE) == DAC_WaveGeneration_None) || \
mbed_official 76:aeb1df146756 126 ((WAVE) == DAC_WaveGeneration_Noise) || \
mbed_official 76:aeb1df146756 127 ((WAVE) == DAC_WaveGeneration_Triangle))
mbed_official 76:aeb1df146756 128 /**
mbed_official 76:aeb1df146756 129 * @}
mbed_official 76:aeb1df146756 130 */
mbed_official 76:aeb1df146756 131
mbed_official 76:aeb1df146756 132 /** @defgroup DAC_lfsrunmask_triangleamplitude
mbed_official 76:aeb1df146756 133 * @brief These parameters are only applicable for STM32F072 devices.
mbed_official 76:aeb1df146756 134 * @{
mbed_official 76:aeb1df146756 135 */
mbed_official 76:aeb1df146756 136
mbed_official 76:aeb1df146756 137 #define DAC_LFSRUnmask_Bit0 ((uint32_t)0x00000000) /*!< Unmask DAC channel LFSR bit0 for noise wave generation */
mbed_official 76:aeb1df146756 138 #define DAC_LFSRUnmask_Bits1_0 ((uint32_t)0x00000100) /*!< Unmask DAC channel LFSR bit[1:0] for noise wave generation */
mbed_official 76:aeb1df146756 139 #define DAC_LFSRUnmask_Bits2_0 ((uint32_t)0x00000200) /*!< Unmask DAC channel LFSR bit[2:0] for noise wave generation */
mbed_official 76:aeb1df146756 140 #define DAC_LFSRUnmask_Bits3_0 ((uint32_t)0x00000300) /*!< Unmask DAC channel LFSR bit[3:0] for noise wave generation */
mbed_official 76:aeb1df146756 141 #define DAC_LFSRUnmask_Bits4_0 ((uint32_t)0x00000400) /*!< Unmask DAC channel LFSR bit[4:0] for noise wave generation */
mbed_official 76:aeb1df146756 142 #define DAC_LFSRUnmask_Bits5_0 ((uint32_t)0x00000500) /*!< Unmask DAC channel LFSR bit[5:0] for noise wave generation */
mbed_official 76:aeb1df146756 143 #define DAC_LFSRUnmask_Bits6_0 ((uint32_t)0x00000600) /*!< Unmask DAC channel LFSR bit[6:0] for noise wave generation */
mbed_official 76:aeb1df146756 144 #define DAC_LFSRUnmask_Bits7_0 ((uint32_t)0x00000700) /*!< Unmask DAC channel LFSR bit[7:0] for noise wave generation */
mbed_official 76:aeb1df146756 145 #define DAC_LFSRUnmask_Bits8_0 ((uint32_t)0x00000800) /*!< Unmask DAC channel LFSR bit[8:0] for noise wave generation */
mbed_official 76:aeb1df146756 146 #define DAC_LFSRUnmask_Bits9_0 ((uint32_t)0x00000900) /*!< Unmask DAC channel LFSR bit[9:0] for noise wave generation */
mbed_official 76:aeb1df146756 147 #define DAC_LFSRUnmask_Bits10_0 ((uint32_t)0x00000A00) /*!< Unmask DAC channel LFSR bit[10:0] for noise wave generation */
mbed_official 76:aeb1df146756 148 #define DAC_LFSRUnmask_Bits11_0 ((uint32_t)0x00000B00) /*!< Unmask DAC channel LFSR bit[11:0] for noise wave generation */
mbed_official 76:aeb1df146756 149 #define DAC_TriangleAmplitude_1 ((uint32_t)0x00000000) /*!< Select max triangle amplitude of 1 */
mbed_official 76:aeb1df146756 150 #define DAC_TriangleAmplitude_3 ((uint32_t)0x00000100) /*!< Select max triangle amplitude of 3 */
mbed_official 76:aeb1df146756 151 #define DAC_TriangleAmplitude_7 ((uint32_t)0x00000200) /*!< Select max triangle amplitude of 7 */
mbed_official 76:aeb1df146756 152 #define DAC_TriangleAmplitude_15 ((uint32_t)0x00000300) /*!< Select max triangle amplitude of 15 */
mbed_official 76:aeb1df146756 153 #define DAC_TriangleAmplitude_31 ((uint32_t)0x00000400) /*!< Select max triangle amplitude of 31 */
mbed_official 76:aeb1df146756 154 #define DAC_TriangleAmplitude_63 ((uint32_t)0x00000500) /*!< Select max triangle amplitude of 63 */
mbed_official 76:aeb1df146756 155 #define DAC_TriangleAmplitude_127 ((uint32_t)0x00000600) /*!< Select max triangle amplitude of 127 */
mbed_official 76:aeb1df146756 156 #define DAC_TriangleAmplitude_255 ((uint32_t)0x00000700) /*!< Select max triangle amplitude of 255 */
mbed_official 76:aeb1df146756 157 #define DAC_TriangleAmplitude_511 ((uint32_t)0x00000800) /*!< Select max triangle amplitude of 511 */
mbed_official 76:aeb1df146756 158 #define DAC_TriangleAmplitude_1023 ((uint32_t)0x00000900) /*!< Select max triangle amplitude of 1023 */
mbed_official 76:aeb1df146756 159 #define DAC_TriangleAmplitude_2047 ((uint32_t)0x00000A00) /*!< Select max triangle amplitude of 2047 */
mbed_official 76:aeb1df146756 160 #define DAC_TriangleAmplitude_4095 ((uint32_t)0x00000B00) /*!< Select max triangle amplitude of 4095 */
mbed_official 76:aeb1df146756 161
mbed_official 76:aeb1df146756 162 #define IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(VALUE) (((VALUE) == DAC_LFSRUnmask_Bit0) || \
mbed_official 76:aeb1df146756 163 ((VALUE) == DAC_LFSRUnmask_Bits1_0) || \
mbed_official 76:aeb1df146756 164 ((VALUE) == DAC_LFSRUnmask_Bits2_0) || \
mbed_official 76:aeb1df146756 165 ((VALUE) == DAC_LFSRUnmask_Bits3_0) || \
mbed_official 76:aeb1df146756 166 ((VALUE) == DAC_LFSRUnmask_Bits4_0) || \
mbed_official 76:aeb1df146756 167 ((VALUE) == DAC_LFSRUnmask_Bits5_0) || \
mbed_official 76:aeb1df146756 168 ((VALUE) == DAC_LFSRUnmask_Bits6_0) || \
mbed_official 76:aeb1df146756 169 ((VALUE) == DAC_LFSRUnmask_Bits7_0) || \
mbed_official 76:aeb1df146756 170 ((VALUE) == DAC_LFSRUnmask_Bits8_0) || \
mbed_official 76:aeb1df146756 171 ((VALUE) == DAC_LFSRUnmask_Bits9_0) || \
mbed_official 76:aeb1df146756 172 ((VALUE) == DAC_LFSRUnmask_Bits10_0) || \
mbed_official 76:aeb1df146756 173 ((VALUE) == DAC_LFSRUnmask_Bits11_0) || \
mbed_official 76:aeb1df146756 174 ((VALUE) == DAC_TriangleAmplitude_1) || \
mbed_official 76:aeb1df146756 175 ((VALUE) == DAC_TriangleAmplitude_3) || \
mbed_official 76:aeb1df146756 176 ((VALUE) == DAC_TriangleAmplitude_7) || \
mbed_official 76:aeb1df146756 177 ((VALUE) == DAC_TriangleAmplitude_15) || \
mbed_official 76:aeb1df146756 178 ((VALUE) == DAC_TriangleAmplitude_31) || \
mbed_official 76:aeb1df146756 179 ((VALUE) == DAC_TriangleAmplitude_63) || \
mbed_official 76:aeb1df146756 180 ((VALUE) == DAC_TriangleAmplitude_127) || \
mbed_official 76:aeb1df146756 181 ((VALUE) == DAC_TriangleAmplitude_255) || \
mbed_official 76:aeb1df146756 182 ((VALUE) == DAC_TriangleAmplitude_511) || \
mbed_official 76:aeb1df146756 183 ((VALUE) == DAC_TriangleAmplitude_1023) || \
mbed_official 76:aeb1df146756 184 ((VALUE) == DAC_TriangleAmplitude_2047) || \
mbed_official 76:aeb1df146756 185 ((VALUE) == DAC_TriangleAmplitude_4095))
mbed_official 76:aeb1df146756 186 /**
mbed_official 76:aeb1df146756 187 * @}
mbed_official 76:aeb1df146756 188 */
mbed_official 76:aeb1df146756 189
mbed_official 76:aeb1df146756 190 /** @defgroup DAC_OutputBuffer
mbed_official 76:aeb1df146756 191 * @{
mbed_official 76:aeb1df146756 192 */
mbed_official 76:aeb1df146756 193
mbed_official 76:aeb1df146756 194 #define DAC_OutputBuffer_Enable ((uint32_t)0x00000000)
mbed_official 76:aeb1df146756 195 #define DAC_OutputBuffer_Disable DAC_CR_BOFF1
mbed_official 76:aeb1df146756 196 #define IS_DAC_OUTPUT_BUFFER_STATE(STATE) (((STATE) == DAC_OutputBuffer_Enable) || \
mbed_official 76:aeb1df146756 197 ((STATE) == DAC_OutputBuffer_Disable))
mbed_official 76:aeb1df146756 198 /**
mbed_official 76:aeb1df146756 199 * @}
mbed_official 76:aeb1df146756 200 */
mbed_official 76:aeb1df146756 201
mbed_official 76:aeb1df146756 202 /** @defgroup DAC_Channel_selection
mbed_official 76:aeb1df146756 203 * @{
mbed_official 76:aeb1df146756 204 */
mbed_official 76:aeb1df146756 205
mbed_official 76:aeb1df146756 206 #define DAC_Channel_1 ((uint32_t)0x00000000)
mbed_official 76:aeb1df146756 207 #define DAC_Channel_2 ((uint32_t)0x00000010) /*!< Only applicable for STM32F072 devices */
mbed_official 76:aeb1df146756 208 #define IS_DAC_CHANNEL(CHANNEL) (((CHANNEL) == DAC_Channel_1) || \
mbed_official 76:aeb1df146756 209 ((CHANNEL) == DAC_Channel_2))
mbed_official 76:aeb1df146756 210
mbed_official 76:aeb1df146756 211 /**
mbed_official 76:aeb1df146756 212 * @}
mbed_official 76:aeb1df146756 213 */
mbed_official 76:aeb1df146756 214
mbed_official 76:aeb1df146756 215 /** @defgroup DAC_data_alignment
mbed_official 76:aeb1df146756 216 * @{
mbed_official 76:aeb1df146756 217 */
mbed_official 76:aeb1df146756 218
mbed_official 76:aeb1df146756 219 #define DAC_Align_12b_R ((uint32_t)0x00000000)
mbed_official 76:aeb1df146756 220 #define DAC_Align_12b_L ((uint32_t)0x00000004)
mbed_official 76:aeb1df146756 221 #define DAC_Align_8b_R ((uint32_t)0x00000008)
mbed_official 76:aeb1df146756 222 #define IS_DAC_ALIGN(ALIGN) (((ALIGN) == DAC_Align_12b_R) || \
mbed_official 76:aeb1df146756 223 ((ALIGN) == DAC_Align_12b_L) || \
mbed_official 76:aeb1df146756 224 ((ALIGN) == DAC_Align_8b_R))
mbed_official 76:aeb1df146756 225 /**
mbed_official 76:aeb1df146756 226 * @}
mbed_official 76:aeb1df146756 227 */
mbed_official 76:aeb1df146756 228
mbed_official 76:aeb1df146756 229 /** @defgroup DAC_wave_generation
mbed_official 76:aeb1df146756 230 * @brief These parameters are only applicable for STM32F072 devices.
mbed_official 76:aeb1df146756 231 * @{
mbed_official 76:aeb1df146756 232 */
mbed_official 76:aeb1df146756 233
mbed_official 76:aeb1df146756 234 #define DAC_Wave_Noise ((uint32_t)0x00000040)
mbed_official 76:aeb1df146756 235 #define DAC_Wave_Triangle ((uint32_t)0x00000080)
mbed_official 76:aeb1df146756 236 #define IS_DAC_WAVE(WAVE) (((WAVE) == DAC_Wave_Noise) || \
mbed_official 76:aeb1df146756 237 ((WAVE) == DAC_Wave_Triangle))
mbed_official 76:aeb1df146756 238 /**
mbed_official 76:aeb1df146756 239 * @}
mbed_official 76:aeb1df146756 240 */
mbed_official 76:aeb1df146756 241
mbed_official 76:aeb1df146756 242 /** @defgroup DAC_data
mbed_official 76:aeb1df146756 243 * @{
mbed_official 76:aeb1df146756 244 */
mbed_official 76:aeb1df146756 245
mbed_official 76:aeb1df146756 246 #define IS_DAC_DATA(DATA) ((DATA) <= 0xFFF0)
mbed_official 76:aeb1df146756 247
mbed_official 76:aeb1df146756 248 /**
mbed_official 76:aeb1df146756 249 * @}
mbed_official 76:aeb1df146756 250 */
mbed_official 76:aeb1df146756 251
mbed_official 76:aeb1df146756 252 /** @defgroup DAC_interrupts_definition
mbed_official 76:aeb1df146756 253 * @{
mbed_official 76:aeb1df146756 254 */
mbed_official 76:aeb1df146756 255
mbed_official 76:aeb1df146756 256 #define DAC_IT_DMAUDR DAC_SR_DMAUDR1
mbed_official 76:aeb1df146756 257 #define IS_DAC_IT(IT) (((IT) == DAC_IT_DMAUDR))
mbed_official 76:aeb1df146756 258
mbed_official 76:aeb1df146756 259 /**
mbed_official 76:aeb1df146756 260 * @}
mbed_official 76:aeb1df146756 261 */
mbed_official 76:aeb1df146756 262
mbed_official 76:aeb1df146756 263
mbed_official 76:aeb1df146756 264 /** @defgroup DAC_flags_definition
mbed_official 76:aeb1df146756 265 * @{
mbed_official 76:aeb1df146756 266 */
mbed_official 76:aeb1df146756 267
mbed_official 76:aeb1df146756 268 #define DAC_FLAG_DMAUDR DAC_SR_DMAUDR1
mbed_official 76:aeb1df146756 269
mbed_official 76:aeb1df146756 270 #define IS_DAC_FLAG(FLAG) (((FLAG) == DAC_FLAG_DMAUDR))
mbed_official 76:aeb1df146756 271
mbed_official 76:aeb1df146756 272 /**
mbed_official 76:aeb1df146756 273 * @}
mbed_official 76:aeb1df146756 274 */
mbed_official 76:aeb1df146756 275
mbed_official 76:aeb1df146756 276 /**
mbed_official 76:aeb1df146756 277 * @}
mbed_official 76:aeb1df146756 278 */
mbed_official 76:aeb1df146756 279
mbed_official 76:aeb1df146756 280 /* Exported macro ------------------------------------------------------------*/
mbed_official 76:aeb1df146756 281 /* Exported functions ------------------------------------------------------- */
mbed_official 76:aeb1df146756 282
mbed_official 76:aeb1df146756 283 /* Function used to set the DAC configuration to the default reset state *****/
mbed_official 76:aeb1df146756 284 void DAC_DeInit(void);
mbed_official 76:aeb1df146756 285
mbed_official 76:aeb1df146756 286 /* DAC channels configuration: trigger, output buffer, data format functions */
mbed_official 76:aeb1df146756 287 void DAC_Init(uint32_t DAC_Channel, DAC_InitTypeDef* DAC_InitStruct);
mbed_official 76:aeb1df146756 288 void DAC_StructInit(DAC_InitTypeDef* DAC_InitStruct);
mbed_official 76:aeb1df146756 289 void DAC_Cmd(uint32_t DAC_Channel, FunctionalState NewState);
mbed_official 76:aeb1df146756 290 void DAC_SoftwareTriggerCmd(uint32_t DAC_Channel, FunctionalState NewState);
mbed_official 76:aeb1df146756 291 void DAC_DualSoftwareTriggerCmd(FunctionalState NewState); /*!< Only applicable for STM32F072 devices */
mbed_official 76:aeb1df146756 292 void DAC_WaveGenerationCmd(uint32_t DAC_Channel, uint32_t DAC_Wave, FunctionalState NewState); /*!< Only applicable for STM32F072 devices */
mbed_official 76:aeb1df146756 293 void DAC_SetChannel1Data(uint32_t DAC_Align, uint16_t Data);
mbed_official 76:aeb1df146756 294 void DAC_SetChannel2Data(uint32_t DAC_Align, uint16_t Data); /*!< Only applicable for STM32F072 devices */
mbed_official 76:aeb1df146756 295 void DAC_SetDualChannelData(uint32_t DAC_Align, uint16_t Data2, uint16_t Data1); /*!< Only applicable for STM32F072 devices */
mbed_official 76:aeb1df146756 296 uint16_t DAC_GetDataOutputValue(uint32_t DAC_Channel);
mbed_official 76:aeb1df146756 297
mbed_official 76:aeb1df146756 298 /* DMA management functions ***************************************************/
mbed_official 76:aeb1df146756 299 void DAC_DMACmd(uint32_t DAC_Channel, FunctionalState NewState);
mbed_official 76:aeb1df146756 300
mbed_official 76:aeb1df146756 301 /* Interrupts and flags management functions **********************************/
mbed_official 76:aeb1df146756 302 void DAC_ITConfig(uint32_t DAC_Channel, uint32_t DAC_IT, FunctionalState NewState);
mbed_official 76:aeb1df146756 303 FlagStatus DAC_GetFlagStatus(uint32_t DAC_Channel, uint32_t DAC_FLAG);
mbed_official 76:aeb1df146756 304 void DAC_ClearFlag(uint32_t DAC_Channel, uint32_t DAC_FLAG);
mbed_official 76:aeb1df146756 305 ITStatus DAC_GetITStatus(uint32_t DAC_Channel, uint32_t DAC_IT);
mbed_official 76:aeb1df146756 306 void DAC_ClearITPendingBit(uint32_t DAC_Channel, uint32_t DAC_IT);
mbed_official 76:aeb1df146756 307
mbed_official 76:aeb1df146756 308 #ifdef __cplusplus
mbed_official 76:aeb1df146756 309 }
mbed_official 76:aeb1df146756 310 #endif
mbed_official 76:aeb1df146756 311
mbed_official 76:aeb1df146756 312 #endif /*__STM32F0XX_DAC_H */
mbed_official 76:aeb1df146756 313
mbed_official 76:aeb1df146756 314 /**
mbed_official 76:aeb1df146756 315 * @}
mbed_official 76:aeb1df146756 316 */
mbed_official 76:aeb1df146756 317
mbed_official 76:aeb1df146756 318 /**
mbed_official 76:aeb1df146756 319 * @}
mbed_official 76:aeb1df146756 320 */
mbed_official 76:aeb1df146756 321
mbed_official 76:aeb1df146756 322 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/