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