Mangue Baja Box

Dependencies:   mbed

Committer:
einsteingustavo
Date:
Mon Jul 29 20:38:00 2019 +0000
Revision:
0:0dee8840a1c0
Mangue Baja Box

Who changed what in which revision?

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