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