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