version_2.0
Dependents: cc3000_ping_demo_try_2
Fork of mbed by
TARGET_NUCLEO_F030R8/stm32f0xx_dac.h@77:869cf507173a, 2014-02-14 (annotated)
- Committer:
- emilmont
- Date:
- Fri Feb 14 14:36:43 2014 +0000
- Revision:
- 77:869cf507173a
- Child:
- 81:7d30d6019079
Release 77 of the mbed library
Main changes:
* Add target NUCLEO_F030R8
* Add target NUCLEO_F401RE
* Add target NUCLEO_F103RB
* Add target NUCLEO_L152RE
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emilmont | 77:869cf507173a | 1 | /** |
emilmont | 77:869cf507173a | 2 | ****************************************************************************** |
emilmont | 77:869cf507173a | 3 | * @file stm32f0xx_dac.h |
emilmont | 77:869cf507173a | 4 | * @author MCD Application Team |
emilmont | 77:869cf507173a | 5 | * @version V1.3.0 |
emilmont | 77:869cf507173a | 6 | * @date 16-January-2014 |
emilmont | 77:869cf507173a | 7 | * @brief This file contains all the functions prototypes for the DAC firmware |
emilmont | 77:869cf507173a | 8 | * library, applicable only for STM32F051 and STM32F072 devices. |
emilmont | 77:869cf507173a | 9 | ****************************************************************************** |
emilmont | 77:869cf507173a | 10 | * @attention |
emilmont | 77:869cf507173a | 11 | * |
emilmont | 77:869cf507173a | 12 | * <h2><center>© COPYRIGHT 2014 STMicroelectronics</center></h2> |
emilmont | 77:869cf507173a | 13 | * |
emilmont | 77:869cf507173a | 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); |
emilmont | 77:869cf507173a | 15 | * You may not use this file except in compliance with the License. |
emilmont | 77:869cf507173a | 16 | * You may obtain a copy of the License at: |
emilmont | 77:869cf507173a | 17 | * |
emilmont | 77:869cf507173a | 18 | * http://www.st.com/software_license_agreement_liberty_v2 |
emilmont | 77:869cf507173a | 19 | * |
emilmont | 77:869cf507173a | 20 | * Unless required by applicable law or agreed to in writing, software |
emilmont | 77:869cf507173a | 21 | * distributed under the License is distributed on an "AS IS" BASIS, |
emilmont | 77:869cf507173a | 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
emilmont | 77:869cf507173a | 23 | * See the License for the specific language governing permissions and |
emilmont | 77:869cf507173a | 24 | * limitations under the License. |
emilmont | 77:869cf507173a | 25 | * |
emilmont | 77:869cf507173a | 26 | ****************************************************************************** |
emilmont | 77:869cf507173a | 27 | */ |
emilmont | 77:869cf507173a | 28 | |
emilmont | 77:869cf507173a | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ |
emilmont | 77:869cf507173a | 30 | #ifndef __STM32F0XX_DAC_H |
emilmont | 77:869cf507173a | 31 | #define __STM32F0XX_DAC_H |
emilmont | 77:869cf507173a | 32 | |
emilmont | 77:869cf507173a | 33 | #ifdef __cplusplus |
emilmont | 77:869cf507173a | 34 | extern "C" { |
emilmont | 77:869cf507173a | 35 | #endif |
emilmont | 77:869cf507173a | 36 | |
emilmont | 77:869cf507173a | 37 | /* Includes ------------------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 38 | #include "stm32f0xx.h" |
emilmont | 77:869cf507173a | 39 | |
emilmont | 77:869cf507173a | 40 | /** @addtogroup STM32F0xx_StdPeriph_Driver |
emilmont | 77:869cf507173a | 41 | * @{ |
emilmont | 77:869cf507173a | 42 | */ |
emilmont | 77:869cf507173a | 43 | |
emilmont | 77:869cf507173a | 44 | /** @addtogroup DAC |
emilmont | 77:869cf507173a | 45 | * @{ |
emilmont | 77:869cf507173a | 46 | */ |
emilmont | 77:869cf507173a | 47 | |
emilmont | 77:869cf507173a | 48 | /* Exported types ------------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 49 | |
emilmont | 77:869cf507173a | 50 | /** |
emilmont | 77:869cf507173a | 51 | * @brief DAC Init structure definition |
emilmont | 77:869cf507173a | 52 | */ |
emilmont | 77:869cf507173a | 53 | |
emilmont | 77:869cf507173a | 54 | typedef struct |
emilmont | 77:869cf507173a | 55 | { |
emilmont | 77:869cf507173a | 56 | uint32_t DAC_Trigger; /*!< Specifies the external trigger for the selected DAC channel. |
emilmont | 77:869cf507173a | 57 | This parameter can be a value of @ref DAC_trigger_selection */ |
emilmont | 77:869cf507173a | 58 | |
emilmont | 77:869cf507173a | 59 | uint32_t DAC_WaveGeneration; /*!< Specifies whether DAC channel noise waves or triangle waves |
emilmont | 77:869cf507173a | 60 | are generated, or whether no wave is generated. |
emilmont | 77:869cf507173a | 61 | This parameter can be a value of @ref DAC_wave_generation |
emilmont | 77:869cf507173a | 62 | This parameter is only applicable for STM32F072 devices */ |
emilmont | 77:869cf507173a | 63 | |
emilmont | 77:869cf507173a | 64 | uint32_t DAC_LFSRUnmask_TriangleAmplitude; /*!< Specifies the LFSR mask for noise wave generation or |
emilmont | 77:869cf507173a | 65 | the maximum amplitude triangle generation for the DAC channel. |
emilmont | 77:869cf507173a | 66 | This parameter can be a value of @ref DAC_lfsrunmask_triangleamplitude |
emilmont | 77:869cf507173a | 67 | This parameter is only applicable for STM32F072 devices */ |
emilmont | 77:869cf507173a | 68 | |
emilmont | 77:869cf507173a | 69 | uint32_t DAC_OutputBuffer; /*!< Specifies whether the DAC channel output buffer is enabled or disabled. |
emilmont | 77:869cf507173a | 70 | This parameter can be a value of @ref DAC_output_buffer */ |
emilmont | 77:869cf507173a | 71 | }DAC_InitTypeDef; |
emilmont | 77:869cf507173a | 72 | |
emilmont | 77:869cf507173a | 73 | /* Exported constants --------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 74 | |
emilmont | 77:869cf507173a | 75 | /** @defgroup DAC_Exported_Constants |
emilmont | 77:869cf507173a | 76 | * @{ |
emilmont | 77:869cf507173a | 77 | */ |
emilmont | 77:869cf507173a | 78 | |
emilmont | 77:869cf507173a | 79 | /** @defgroup DAC_Trigger |
emilmont | 77:869cf507173a | 80 | * @{ |
emilmont | 77:869cf507173a | 81 | */ |
emilmont | 77:869cf507173a | 82 | |
emilmont | 77:869cf507173a | 83 | #define DAC_Trigger_None ((uint32_t)0x00000000) /*!< Conversion is automatic once the DAC1_DHRxxxx register |
emilmont | 77:869cf507173a | 84 | has been loaded, and not by external trigger */ |
emilmont | 77:869cf507173a | 85 | #define DAC_Trigger_T6_TRGO ((uint32_t)0x00000004) /*!< TIM6 TRGO selected as external conversion trigger for DAC channel1 */ |
emilmont | 77:869cf507173a | 86 | #define DAC_Trigger_T3_TRGO ((uint32_t)0x0000000C) /*!< TIM3 TRGO selected as external conversion trigger for DAC channel1 */ |
emilmont | 77:869cf507173a | 87 | #define DAC_Trigger_T7_TRGO ((uint32_t)0x00000014) /*!< TIM7 TRGO selected as external conversion trigger for DAC channel1, |
emilmont | 77:869cf507173a | 88 | applicable only for STM32F072 devices */ |
emilmont | 77:869cf507173a | 89 | #define DAC_Trigger_T15_TRGO ((uint32_t)0x0000001C) /*!< TIM15 TRGO selected as external conversion trigger for DAC channel1 */ |
emilmont | 77:869cf507173a | 90 | #define DAC_Trigger_T2_TRGO ((uint32_t)0x00000024) /*!< TIM2 TRGO selected as external conversion trigger for DAC channel1 */ |
emilmont | 77:869cf507173a | 91 | #define DAC_Trigger_Ext_IT9 ((uint32_t)0x00000034) /*!< EXTI Line9 event selected as external conversion trigger for DAC channels */ |
emilmont | 77:869cf507173a | 92 | #define DAC_Trigger_Software ((uint32_t)0x0000003C) /*!< Conversion started by software trigger for DAC channels */ |
emilmont | 77:869cf507173a | 93 | |
emilmont | 77:869cf507173a | 94 | #define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_Trigger_None) || \ |
emilmont | 77:869cf507173a | 95 | ((TRIGGER) == DAC_Trigger_T6_TRGO) || \ |
emilmont | 77:869cf507173a | 96 | ((TRIGGER) == DAC_Trigger_T7_TRGO) || \ |
emilmont | 77:869cf507173a | 97 | ((TRIGGER) == DAC_Trigger_T3_TRGO) || \ |
emilmont | 77:869cf507173a | 98 | ((TRIGGER) == DAC_Trigger_T15_TRGO) || \ |
emilmont | 77:869cf507173a | 99 | ((TRIGGER) == DAC_Trigger_T2_TRGO) || \ |
emilmont | 77:869cf507173a | 100 | ((TRIGGER) == DAC_Trigger_Ext_IT9) || \ |
emilmont | 77:869cf507173a | 101 | ((TRIGGER) == DAC_Trigger_Software)) |
emilmont | 77:869cf507173a | 102 | |
emilmont | 77:869cf507173a | 103 | /** |
emilmont | 77:869cf507173a | 104 | * @} |
emilmont | 77:869cf507173a | 105 | */ |
emilmont | 77:869cf507173a | 106 | |
emilmont | 77:869cf507173a | 107 | /** @defgroup DAC_wave_generation |
emilmont | 77:869cf507173a | 108 | * @brief This parameters are only applicable for STM32F072 devices. |
emilmont | 77:869cf507173a | 109 | * @{ |
emilmont | 77:869cf507173a | 110 | */ |
emilmont | 77:869cf507173a | 111 | |
emilmont | 77:869cf507173a | 112 | #define DAC_WaveGeneration_None ((uint32_t)0x00000000) |
emilmont | 77:869cf507173a | 113 | #define DAC_WaveGeneration_Noise ((uint32_t)0x00000040) |
emilmont | 77:869cf507173a | 114 | #define DAC_WaveGeneration_Triangle ((uint32_t)0x00000080) |
emilmont | 77:869cf507173a | 115 | #define IS_DAC_GENERATE_WAVE(WAVE) (((WAVE) == DAC_WaveGeneration_None) || \ |
emilmont | 77:869cf507173a | 116 | ((WAVE) == DAC_WaveGeneration_Noise) || \ |
emilmont | 77:869cf507173a | 117 | ((WAVE) == DAC_WaveGeneration_Triangle)) |
emilmont | 77:869cf507173a | 118 | /** |
emilmont | 77:869cf507173a | 119 | * @} |
emilmont | 77:869cf507173a | 120 | */ |
emilmont | 77:869cf507173a | 121 | |
emilmont | 77:869cf507173a | 122 | /** @defgroup DAC_lfsrunmask_triangleamplitude |
emilmont | 77:869cf507173a | 123 | * @brief These parameters are only applicable for STM32F072 devices. |
emilmont | 77:869cf507173a | 124 | * @{ |
emilmont | 77:869cf507173a | 125 | */ |
emilmont | 77:869cf507173a | 126 | |
emilmont | 77:869cf507173a | 127 | #define DAC_LFSRUnmask_Bit0 ((uint32_t)0x00000000) /*!< Unmask DAC channel LFSR bit0 for noise wave generation */ |
emilmont | 77:869cf507173a | 128 | #define DAC_LFSRUnmask_Bits1_0 ((uint32_t)0x00000100) /*!< Unmask DAC channel LFSR bit[1:0] for noise wave generation */ |
emilmont | 77:869cf507173a | 129 | #define DAC_LFSRUnmask_Bits2_0 ((uint32_t)0x00000200) /*!< Unmask DAC channel LFSR bit[2:0] for noise wave generation */ |
emilmont | 77:869cf507173a | 130 | #define DAC_LFSRUnmask_Bits3_0 ((uint32_t)0x00000300) /*!< Unmask DAC channel LFSR bit[3:0] for noise wave generation */ |
emilmont | 77:869cf507173a | 131 | #define DAC_LFSRUnmask_Bits4_0 ((uint32_t)0x00000400) /*!< Unmask DAC channel LFSR bit[4:0] for noise wave generation */ |
emilmont | 77:869cf507173a | 132 | #define DAC_LFSRUnmask_Bits5_0 ((uint32_t)0x00000500) /*!< Unmask DAC channel LFSR bit[5:0] for noise wave generation */ |
emilmont | 77:869cf507173a | 133 | #define DAC_LFSRUnmask_Bits6_0 ((uint32_t)0x00000600) /*!< Unmask DAC channel LFSR bit[6:0] for noise wave generation */ |
emilmont | 77:869cf507173a | 134 | #define DAC_LFSRUnmask_Bits7_0 ((uint32_t)0x00000700) /*!< Unmask DAC channel LFSR bit[7:0] for noise wave generation */ |
emilmont | 77:869cf507173a | 135 | #define DAC_LFSRUnmask_Bits8_0 ((uint32_t)0x00000800) /*!< Unmask DAC channel LFSR bit[8:0] for noise wave generation */ |
emilmont | 77:869cf507173a | 136 | #define DAC_LFSRUnmask_Bits9_0 ((uint32_t)0x00000900) /*!< Unmask DAC channel LFSR bit[9:0] for noise wave generation */ |
emilmont | 77:869cf507173a | 137 | #define DAC_LFSRUnmask_Bits10_0 ((uint32_t)0x00000A00) /*!< Unmask DAC channel LFSR bit[10:0] for noise wave generation */ |
emilmont | 77:869cf507173a | 138 | #define DAC_LFSRUnmask_Bits11_0 ((uint32_t)0x00000B00) /*!< Unmask DAC channel LFSR bit[11:0] for noise wave generation */ |
emilmont | 77:869cf507173a | 139 | #define DAC_TriangleAmplitude_1 ((uint32_t)0x00000000) /*!< Select max triangle amplitude of 1 */ |
emilmont | 77:869cf507173a | 140 | #define DAC_TriangleAmplitude_3 ((uint32_t)0x00000100) /*!< Select max triangle amplitude of 3 */ |
emilmont | 77:869cf507173a | 141 | #define DAC_TriangleAmplitude_7 ((uint32_t)0x00000200) /*!< Select max triangle amplitude of 7 */ |
emilmont | 77:869cf507173a | 142 | #define DAC_TriangleAmplitude_15 ((uint32_t)0x00000300) /*!< Select max triangle amplitude of 15 */ |
emilmont | 77:869cf507173a | 143 | #define DAC_TriangleAmplitude_31 ((uint32_t)0x00000400) /*!< Select max triangle amplitude of 31 */ |
emilmont | 77:869cf507173a | 144 | #define DAC_TriangleAmplitude_63 ((uint32_t)0x00000500) /*!< Select max triangle amplitude of 63 */ |
emilmont | 77:869cf507173a | 145 | #define DAC_TriangleAmplitude_127 ((uint32_t)0x00000600) /*!< Select max triangle amplitude of 127 */ |
emilmont | 77:869cf507173a | 146 | #define DAC_TriangleAmplitude_255 ((uint32_t)0x00000700) /*!< Select max triangle amplitude of 255 */ |
emilmont | 77:869cf507173a | 147 | #define DAC_TriangleAmplitude_511 ((uint32_t)0x00000800) /*!< Select max triangle amplitude of 511 */ |
emilmont | 77:869cf507173a | 148 | #define DAC_TriangleAmplitude_1023 ((uint32_t)0x00000900) /*!< Select max triangle amplitude of 1023 */ |
emilmont | 77:869cf507173a | 149 | #define DAC_TriangleAmplitude_2047 ((uint32_t)0x00000A00) /*!< Select max triangle amplitude of 2047 */ |
emilmont | 77:869cf507173a | 150 | #define DAC_TriangleAmplitude_4095 ((uint32_t)0x00000B00) /*!< Select max triangle amplitude of 4095 */ |
emilmont | 77:869cf507173a | 151 | |
emilmont | 77:869cf507173a | 152 | #define IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(VALUE) (((VALUE) == DAC_LFSRUnmask_Bit0) || \ |
emilmont | 77:869cf507173a | 153 | ((VALUE) == DAC_LFSRUnmask_Bits1_0) || \ |
emilmont | 77:869cf507173a | 154 | ((VALUE) == DAC_LFSRUnmask_Bits2_0) || \ |
emilmont | 77:869cf507173a | 155 | ((VALUE) == DAC_LFSRUnmask_Bits3_0) || \ |
emilmont | 77:869cf507173a | 156 | ((VALUE) == DAC_LFSRUnmask_Bits4_0) || \ |
emilmont | 77:869cf507173a | 157 | ((VALUE) == DAC_LFSRUnmask_Bits5_0) || \ |
emilmont | 77:869cf507173a | 158 | ((VALUE) == DAC_LFSRUnmask_Bits6_0) || \ |
emilmont | 77:869cf507173a | 159 | ((VALUE) == DAC_LFSRUnmask_Bits7_0) || \ |
emilmont | 77:869cf507173a | 160 | ((VALUE) == DAC_LFSRUnmask_Bits8_0) || \ |
emilmont | 77:869cf507173a | 161 | ((VALUE) == DAC_LFSRUnmask_Bits9_0) || \ |
emilmont | 77:869cf507173a | 162 | ((VALUE) == DAC_LFSRUnmask_Bits10_0) || \ |
emilmont | 77:869cf507173a | 163 | ((VALUE) == DAC_LFSRUnmask_Bits11_0) || \ |
emilmont | 77:869cf507173a | 164 | ((VALUE) == DAC_TriangleAmplitude_1) || \ |
emilmont | 77:869cf507173a | 165 | ((VALUE) == DAC_TriangleAmplitude_3) || \ |
emilmont | 77:869cf507173a | 166 | ((VALUE) == DAC_TriangleAmplitude_7) || \ |
emilmont | 77:869cf507173a | 167 | ((VALUE) == DAC_TriangleAmplitude_15) || \ |
emilmont | 77:869cf507173a | 168 | ((VALUE) == DAC_TriangleAmplitude_31) || \ |
emilmont | 77:869cf507173a | 169 | ((VALUE) == DAC_TriangleAmplitude_63) || \ |
emilmont | 77:869cf507173a | 170 | ((VALUE) == DAC_TriangleAmplitude_127) || \ |
emilmont | 77:869cf507173a | 171 | ((VALUE) == DAC_TriangleAmplitude_255) || \ |
emilmont | 77:869cf507173a | 172 | ((VALUE) == DAC_TriangleAmplitude_511) || \ |
emilmont | 77:869cf507173a | 173 | ((VALUE) == DAC_TriangleAmplitude_1023) || \ |
emilmont | 77:869cf507173a | 174 | ((VALUE) == DAC_TriangleAmplitude_2047) || \ |
emilmont | 77:869cf507173a | 175 | ((VALUE) == DAC_TriangleAmplitude_4095)) |
emilmont | 77:869cf507173a | 176 | /** |
emilmont | 77:869cf507173a | 177 | * @} |
emilmont | 77:869cf507173a | 178 | */ |
emilmont | 77:869cf507173a | 179 | |
emilmont | 77:869cf507173a | 180 | /** @defgroup DAC_OutputBuffer |
emilmont | 77:869cf507173a | 181 | * @{ |
emilmont | 77:869cf507173a | 182 | */ |
emilmont | 77:869cf507173a | 183 | |
emilmont | 77:869cf507173a | 184 | #define DAC_OutputBuffer_Enable ((uint32_t)0x00000000) |
emilmont | 77:869cf507173a | 185 | #define DAC_OutputBuffer_Disable DAC_CR_BOFF1 |
emilmont | 77:869cf507173a | 186 | #define IS_DAC_OUTPUT_BUFFER_STATE(STATE) (((STATE) == DAC_OutputBuffer_Enable) || \ |
emilmont | 77:869cf507173a | 187 | ((STATE) == DAC_OutputBuffer_Disable)) |
emilmont | 77:869cf507173a | 188 | /** |
emilmont | 77:869cf507173a | 189 | * @} |
emilmont | 77:869cf507173a | 190 | */ |
emilmont | 77:869cf507173a | 191 | |
emilmont | 77:869cf507173a | 192 | /** @defgroup DAC_Channel_selection |
emilmont | 77:869cf507173a | 193 | * @{ |
emilmont | 77:869cf507173a | 194 | */ |
emilmont | 77:869cf507173a | 195 | |
emilmont | 77:869cf507173a | 196 | #define DAC_Channel_1 ((uint32_t)0x00000000) |
emilmont | 77:869cf507173a | 197 | #define DAC_Channel_2 ((uint32_t)0x00000010) /*!< Only applicable for STM32F072 devices */ |
emilmont | 77:869cf507173a | 198 | #define IS_DAC_CHANNEL(CHANNEL) (((CHANNEL) == DAC_Channel_1) || \ |
emilmont | 77:869cf507173a | 199 | ((CHANNEL) == DAC_Channel_2)) |
emilmont | 77:869cf507173a | 200 | |
emilmont | 77:869cf507173a | 201 | /** |
emilmont | 77:869cf507173a | 202 | * @} |
emilmont | 77:869cf507173a | 203 | */ |
emilmont | 77:869cf507173a | 204 | |
emilmont | 77:869cf507173a | 205 | /** @defgroup DAC_data_alignment |
emilmont | 77:869cf507173a | 206 | * @{ |
emilmont | 77:869cf507173a | 207 | */ |
emilmont | 77:869cf507173a | 208 | |
emilmont | 77:869cf507173a | 209 | #define DAC_Align_12b_R ((uint32_t)0x00000000) |
emilmont | 77:869cf507173a | 210 | #define DAC_Align_12b_L ((uint32_t)0x00000004) |
emilmont | 77:869cf507173a | 211 | #define DAC_Align_8b_R ((uint32_t)0x00000008) |
emilmont | 77:869cf507173a | 212 | #define IS_DAC_ALIGN(ALIGN) (((ALIGN) == DAC_Align_12b_R) || \ |
emilmont | 77:869cf507173a | 213 | ((ALIGN) == DAC_Align_12b_L) || \ |
emilmont | 77:869cf507173a | 214 | ((ALIGN) == DAC_Align_8b_R)) |
emilmont | 77:869cf507173a | 215 | /** |
emilmont | 77:869cf507173a | 216 | * @} |
emilmont | 77:869cf507173a | 217 | */ |
emilmont | 77:869cf507173a | 218 | |
emilmont | 77:869cf507173a | 219 | /** @defgroup DAC_wave_generation |
emilmont | 77:869cf507173a | 220 | * @brief These parameters are only applicable for STM32F072 devices. |
emilmont | 77:869cf507173a | 221 | * @{ |
emilmont | 77:869cf507173a | 222 | */ |
emilmont | 77:869cf507173a | 223 | |
emilmont | 77:869cf507173a | 224 | #define DAC_Wave_Noise ((uint32_t)0x00000040) |
emilmont | 77:869cf507173a | 225 | #define DAC_Wave_Triangle ((uint32_t)0x00000080) |
emilmont | 77:869cf507173a | 226 | #define IS_DAC_WAVE(WAVE) (((WAVE) == DAC_Wave_Noise) || \ |
emilmont | 77:869cf507173a | 227 | ((WAVE) == DAC_Wave_Triangle)) |
emilmont | 77:869cf507173a | 228 | /** |
emilmont | 77:869cf507173a | 229 | * @} |
emilmont | 77:869cf507173a | 230 | */ |
emilmont | 77:869cf507173a | 231 | |
emilmont | 77:869cf507173a | 232 | /** @defgroup DAC_data |
emilmont | 77:869cf507173a | 233 | * @{ |
emilmont | 77:869cf507173a | 234 | */ |
emilmont | 77:869cf507173a | 235 | |
emilmont | 77:869cf507173a | 236 | #define IS_DAC_DATA(DATA) ((DATA) <= 0xFFF0) |
emilmont | 77:869cf507173a | 237 | |
emilmont | 77:869cf507173a | 238 | /** |
emilmont | 77:869cf507173a | 239 | * @} |
emilmont | 77:869cf507173a | 240 | */ |
emilmont | 77:869cf507173a | 241 | |
emilmont | 77:869cf507173a | 242 | /** @defgroup DAC_interrupts_definition |
emilmont | 77:869cf507173a | 243 | * @{ |
emilmont | 77:869cf507173a | 244 | */ |
emilmont | 77:869cf507173a | 245 | |
emilmont | 77:869cf507173a | 246 | #define DAC_IT_DMAUDR DAC_SR_DMAUDR1 |
emilmont | 77:869cf507173a | 247 | #define IS_DAC_IT(IT) (((IT) == DAC_IT_DMAUDR)) |
emilmont | 77:869cf507173a | 248 | |
emilmont | 77:869cf507173a | 249 | /** |
emilmont | 77:869cf507173a | 250 | * @} |
emilmont | 77:869cf507173a | 251 | */ |
emilmont | 77:869cf507173a | 252 | |
emilmont | 77:869cf507173a | 253 | |
emilmont | 77:869cf507173a | 254 | /** @defgroup DAC_flags_definition |
emilmont | 77:869cf507173a | 255 | * @{ |
emilmont | 77:869cf507173a | 256 | */ |
emilmont | 77:869cf507173a | 257 | |
emilmont | 77:869cf507173a | 258 | #define DAC_FLAG_DMAUDR DAC_SR_DMAUDR1 |
emilmont | 77:869cf507173a | 259 | |
emilmont | 77:869cf507173a | 260 | #define IS_DAC_FLAG(FLAG) (((FLAG) == DAC_FLAG_DMAUDR)) |
emilmont | 77:869cf507173a | 261 | |
emilmont | 77:869cf507173a | 262 | /** |
emilmont | 77:869cf507173a | 263 | * @} |
emilmont | 77:869cf507173a | 264 | */ |
emilmont | 77:869cf507173a | 265 | |
emilmont | 77:869cf507173a | 266 | /** |
emilmont | 77:869cf507173a | 267 | * @} |
emilmont | 77:869cf507173a | 268 | */ |
emilmont | 77:869cf507173a | 269 | |
emilmont | 77:869cf507173a | 270 | /* Exported macro ------------------------------------------------------------*/ |
emilmont | 77:869cf507173a | 271 | /* Exported functions ------------------------------------------------------- */ |
emilmont | 77:869cf507173a | 272 | |
emilmont | 77:869cf507173a | 273 | /* Function used to set the DAC configuration to the default reset state *****/ |
emilmont | 77:869cf507173a | 274 | void DAC_DeInit(void); |
emilmont | 77:869cf507173a | 275 | |
emilmont | 77:869cf507173a | 276 | /* DAC channels configuration: trigger, output buffer, data format functions */ |
emilmont | 77:869cf507173a | 277 | void DAC_Init(uint32_t DAC_Channel, DAC_InitTypeDef* DAC_InitStruct); |
emilmont | 77:869cf507173a | 278 | void DAC_StructInit(DAC_InitTypeDef* DAC_InitStruct); |
emilmont | 77:869cf507173a | 279 | void DAC_Cmd(uint32_t DAC_Channel, FunctionalState NewState); |
emilmont | 77:869cf507173a | 280 | void DAC_SoftwareTriggerCmd(uint32_t DAC_Channel, FunctionalState NewState); |
emilmont | 77:869cf507173a | 281 | void DAC_DualSoftwareTriggerCmd(FunctionalState NewState); /*!< Only applicable for STM32F072 devices */ |
emilmont | 77:869cf507173a | 282 | void DAC_WaveGenerationCmd(uint32_t DAC_Channel, uint32_t DAC_Wave, FunctionalState NewState); /*!< Only applicable for STM32F072 devices */ |
emilmont | 77:869cf507173a | 283 | void DAC_SetChannel1Data(uint32_t DAC_Align, uint16_t Data); |
emilmont | 77:869cf507173a | 284 | void DAC_SetChannel2Data(uint32_t DAC_Align, uint16_t Data); /*!< Only applicable for STM32F072 devices */ |
emilmont | 77:869cf507173a | 285 | void DAC_SetDualChannelData(uint32_t DAC_Align, uint16_t Data2, uint16_t Data1); /*!< Only applicable for STM32F072 devices */ |
emilmont | 77:869cf507173a | 286 | uint16_t DAC_GetDataOutputValue(uint32_t DAC_Channel); |
emilmont | 77:869cf507173a | 287 | |
emilmont | 77:869cf507173a | 288 | /* DMA management functions ***************************************************/ |
emilmont | 77:869cf507173a | 289 | void DAC_DMACmd(uint32_t DAC_Channel, FunctionalState NewState); |
emilmont | 77:869cf507173a | 290 | |
emilmont | 77:869cf507173a | 291 | /* Interrupts and flags management functions **********************************/ |
emilmont | 77:869cf507173a | 292 | void DAC_ITConfig(uint32_t DAC_Channel, uint32_t DAC_IT, FunctionalState NewState); |
emilmont | 77:869cf507173a | 293 | FlagStatus DAC_GetFlagStatus(uint32_t DAC_Channel, uint32_t DAC_FLAG); |
emilmont | 77:869cf507173a | 294 | void DAC_ClearFlag(uint32_t DAC_Channel, uint32_t DAC_FLAG); |
emilmont | 77:869cf507173a | 295 | ITStatus DAC_GetITStatus(uint32_t DAC_Channel, uint32_t DAC_IT); |
emilmont | 77:869cf507173a | 296 | void DAC_ClearITPendingBit(uint32_t DAC_Channel, uint32_t DAC_IT); |
emilmont | 77:869cf507173a | 297 | |
emilmont | 77:869cf507173a | 298 | #ifdef __cplusplus |
emilmont | 77:869cf507173a | 299 | } |
emilmont | 77:869cf507173a | 300 | #endif |
emilmont | 77:869cf507173a | 301 | |
emilmont | 77:869cf507173a | 302 | #endif /*__STM32F0XX_DAC_H */ |
emilmont | 77:869cf507173a | 303 | |
emilmont | 77:869cf507173a | 304 | /** |
emilmont | 77:869cf507173a | 305 | * @} |
emilmont | 77:869cf507173a | 306 | */ |
emilmont | 77:869cf507173a | 307 | |
emilmont | 77:869cf507173a | 308 | /** |
emilmont | 77:869cf507173a | 309 | * @} |
emilmont | 77:869cf507173a | 310 | */ |
emilmont | 77:869cf507173a | 311 | |
emilmont | 77:869cf507173a | 312 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |