mbed library sources

Dependents:   Marvino mbot

Fork of mbed-src by mbed official

Committer:
jaerts
Date:
Tue Dec 22 13:22:16 2015 +0000
Revision:
637:ed69428d4850
Parent:
155:8435094ec241
Add very shady LPC1768 CAN Filter implementation

Who changed what in which revision?

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