mbed library sources

Dependents:   bare

Fork of mbed-src by mbed official

Committer:
mbed_official
Date:
Wed Mar 19 10:15:22 2014 +0000
Revision:
125:23cc3068a9e4
Synchronized with git revision ace35dfba3748c7cdc102eb38ec6b9e1067c3252

Full URL: https://github.com/mbedmicro/mbed/commit/ace35dfba3748c7cdc102eb38ec6b9e1067c3252/

[NUCLEO_F302R8] Add cmsis and hal files + change F401RE clock to 84MHz

Who changed what in which revision?

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