version_2.0

Dependents:   cc3000_ping_demo_try_2

Fork of mbed by mbed official

Committer:
erezi
Date:
Wed Jun 25 06:08:49 2014 +0000
Revision:
86:4f9a848d74c7
Parent:
82:6473597d706e
version_2.0

Who changed what in which revision?

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