/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/adc/fsl_adc_hal.h substitute line 894 extern } by }
Fork of mbed by
TARGET_NUCLEO_F103RB/stm32f10x_dac.h@73:1efda918f0ba, 2013-12-09 (annotated)
- Committer:
- bogdanm
- Date:
- Mon Dec 09 18:43:03 2013 +0200
- Revision:
- 73:1efda918f0ba
- Child:
- 76:824293ae5e43
Release 73 of the mbed library
Main changes:
- added support for KL46Z and NUCLEO_F103RB
- STM32 USB device support
- various bug fixes
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 73:1efda918f0ba | 1 | /** |
bogdanm | 73:1efda918f0ba | 2 | ****************************************************************************** |
bogdanm | 73:1efda918f0ba | 3 | * @file stm32f10x_dac.h |
bogdanm | 73:1efda918f0ba | 4 | * @author MCD Application Team |
bogdanm | 73:1efda918f0ba | 5 | * @version V3.5.0 |
bogdanm | 73:1efda918f0ba | 6 | * @date 11-March-2011 |
bogdanm | 73:1efda918f0ba | 7 | * @brief This file contains all the functions prototypes for the DAC firmware |
bogdanm | 73:1efda918f0ba | 8 | * library. |
bogdanm | 73:1efda918f0ba | 9 | ****************************************************************************** |
bogdanm | 73:1efda918f0ba | 10 | * @attention |
bogdanm | 73:1efda918f0ba | 11 | * |
bogdanm | 73:1efda918f0ba | 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS |
bogdanm | 73:1efda918f0ba | 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE |
bogdanm | 73:1efda918f0ba | 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY |
bogdanm | 73:1efda918f0ba | 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING |
bogdanm | 73:1efda918f0ba | 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE |
bogdanm | 73:1efda918f0ba | 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. |
bogdanm | 73:1efda918f0ba | 18 | * |
bogdanm | 73:1efda918f0ba | 19 | * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2> |
bogdanm | 73:1efda918f0ba | 20 | ****************************************************************************** |
bogdanm | 73:1efda918f0ba | 21 | */ |
bogdanm | 73:1efda918f0ba | 22 | |
bogdanm | 73:1efda918f0ba | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ |
bogdanm | 73:1efda918f0ba | 24 | #ifndef __STM32F10x_DAC_H |
bogdanm | 73:1efda918f0ba | 25 | #define __STM32F10x_DAC_H |
bogdanm | 73:1efda918f0ba | 26 | |
bogdanm | 73:1efda918f0ba | 27 | #ifdef __cplusplus |
bogdanm | 73:1efda918f0ba | 28 | extern "C" { |
bogdanm | 73:1efda918f0ba | 29 | #endif |
bogdanm | 73:1efda918f0ba | 30 | |
bogdanm | 73:1efda918f0ba | 31 | /* Includes ------------------------------------------------------------------*/ |
bogdanm | 73:1efda918f0ba | 32 | #include "stm32f10x.h" |
bogdanm | 73:1efda918f0ba | 33 | |
bogdanm | 73:1efda918f0ba | 34 | /** @addtogroup STM32F10x_StdPeriph_Driver |
bogdanm | 73:1efda918f0ba | 35 | * @{ |
bogdanm | 73:1efda918f0ba | 36 | */ |
bogdanm | 73:1efda918f0ba | 37 | |
bogdanm | 73:1efda918f0ba | 38 | /** @addtogroup DAC |
bogdanm | 73:1efda918f0ba | 39 | * @{ |
bogdanm | 73:1efda918f0ba | 40 | */ |
bogdanm | 73:1efda918f0ba | 41 | |
bogdanm | 73:1efda918f0ba | 42 | /** @defgroup DAC_Exported_Types |
bogdanm | 73:1efda918f0ba | 43 | * @{ |
bogdanm | 73:1efda918f0ba | 44 | */ |
bogdanm | 73:1efda918f0ba | 45 | |
bogdanm | 73:1efda918f0ba | 46 | /** |
bogdanm | 73:1efda918f0ba | 47 | * @brief DAC Init structure definition |
bogdanm | 73:1efda918f0ba | 48 | */ |
bogdanm | 73:1efda918f0ba | 49 | |
bogdanm | 73:1efda918f0ba | 50 | typedef struct |
bogdanm | 73:1efda918f0ba | 51 | { |
bogdanm | 73:1efda918f0ba | 52 | uint32_t DAC_Trigger; /*!< Specifies the external trigger for the selected DAC channel. |
bogdanm | 73:1efda918f0ba | 53 | This parameter can be a value of @ref DAC_trigger_selection */ |
bogdanm | 73:1efda918f0ba | 54 | |
bogdanm | 73:1efda918f0ba | 55 | uint32_t DAC_WaveGeneration; /*!< Specifies whether DAC channel noise waves or triangle waves |
bogdanm | 73:1efda918f0ba | 56 | are generated, or whether no wave is generated. |
bogdanm | 73:1efda918f0ba | 57 | This parameter can be a value of @ref DAC_wave_generation */ |
bogdanm | 73:1efda918f0ba | 58 | |
bogdanm | 73:1efda918f0ba | 59 | uint32_t DAC_LFSRUnmask_TriangleAmplitude; /*!< Specifies the LFSR mask for noise wave generation or |
bogdanm | 73:1efda918f0ba | 60 | the maximum amplitude triangle generation for the DAC channel. |
bogdanm | 73:1efda918f0ba | 61 | This parameter can be a value of @ref DAC_lfsrunmask_triangleamplitude */ |
bogdanm | 73:1efda918f0ba | 62 | |
bogdanm | 73:1efda918f0ba | 63 | uint32_t DAC_OutputBuffer; /*!< Specifies whether the DAC channel output buffer is enabled or disabled. |
bogdanm | 73:1efda918f0ba | 64 | This parameter can be a value of @ref DAC_output_buffer */ |
bogdanm | 73:1efda918f0ba | 65 | }DAC_InitTypeDef; |
bogdanm | 73:1efda918f0ba | 66 | |
bogdanm | 73:1efda918f0ba | 67 | /** |
bogdanm | 73:1efda918f0ba | 68 | * @} |
bogdanm | 73:1efda918f0ba | 69 | */ |
bogdanm | 73:1efda918f0ba | 70 | |
bogdanm | 73:1efda918f0ba | 71 | /** @defgroup DAC_Exported_Constants |
bogdanm | 73:1efda918f0ba | 72 | * @{ |
bogdanm | 73:1efda918f0ba | 73 | */ |
bogdanm | 73:1efda918f0ba | 74 | |
bogdanm | 73:1efda918f0ba | 75 | /** @defgroup DAC_trigger_selection |
bogdanm | 73:1efda918f0ba | 76 | * @{ |
bogdanm | 73:1efda918f0ba | 77 | */ |
bogdanm | 73:1efda918f0ba | 78 | |
bogdanm | 73:1efda918f0ba | 79 | #define DAC_Trigger_None ((uint32_t)0x00000000) /*!< Conversion is automatic once the DAC1_DHRxxxx register |
bogdanm | 73:1efda918f0ba | 80 | has been loaded, and not by external trigger */ |
bogdanm | 73:1efda918f0ba | 81 | #define DAC_Trigger_T6_TRGO ((uint32_t)0x00000004) /*!< TIM6 TRGO selected as external conversion trigger for DAC channel */ |
bogdanm | 73:1efda918f0ba | 82 | #define DAC_Trigger_T8_TRGO ((uint32_t)0x0000000C) /*!< TIM8 TRGO selected as external conversion trigger for DAC channel |
bogdanm | 73:1efda918f0ba | 83 | only in High-density devices*/ |
bogdanm | 73:1efda918f0ba | 84 | #define DAC_Trigger_T3_TRGO ((uint32_t)0x0000000C) /*!< TIM8 TRGO selected as external conversion trigger for DAC channel |
bogdanm | 73:1efda918f0ba | 85 | only in Connectivity line, Medium-density and Low-density Value Line devices */ |
bogdanm | 73:1efda918f0ba | 86 | #define DAC_Trigger_T7_TRGO ((uint32_t)0x00000014) /*!< TIM7 TRGO selected as external conversion trigger for DAC channel */ |
bogdanm | 73:1efda918f0ba | 87 | #define DAC_Trigger_T5_TRGO ((uint32_t)0x0000001C) /*!< TIM5 TRGO selected as external conversion trigger for DAC channel */ |
bogdanm | 73:1efda918f0ba | 88 | #define DAC_Trigger_T15_TRGO ((uint32_t)0x0000001C) /*!< TIM15 TRGO selected as external conversion trigger for DAC channel |
bogdanm | 73:1efda918f0ba | 89 | only in Medium-density and Low-density Value Line devices*/ |
bogdanm | 73:1efda918f0ba | 90 | #define DAC_Trigger_T2_TRGO ((uint32_t)0x00000024) /*!< TIM2 TRGO selected as external conversion trigger for DAC channel */ |
bogdanm | 73:1efda918f0ba | 91 | #define DAC_Trigger_T4_TRGO ((uint32_t)0x0000002C) /*!< TIM4 TRGO selected as external conversion trigger for DAC channel */ |
bogdanm | 73:1efda918f0ba | 92 | #define DAC_Trigger_Ext_IT9 ((uint32_t)0x00000034) /*!< EXTI Line9 event selected as external conversion trigger for DAC channel */ |
bogdanm | 73:1efda918f0ba | 93 | #define DAC_Trigger_Software ((uint32_t)0x0000003C) /*!< Conversion started by software trigger for DAC channel */ |
bogdanm | 73:1efda918f0ba | 94 | |
bogdanm | 73:1efda918f0ba | 95 | #define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_Trigger_None) || \ |
bogdanm | 73:1efda918f0ba | 96 | ((TRIGGER) == DAC_Trigger_T6_TRGO) || \ |
bogdanm | 73:1efda918f0ba | 97 | ((TRIGGER) == DAC_Trigger_T8_TRGO) || \ |
bogdanm | 73:1efda918f0ba | 98 | ((TRIGGER) == DAC_Trigger_T7_TRGO) || \ |
bogdanm | 73:1efda918f0ba | 99 | ((TRIGGER) == DAC_Trigger_T5_TRGO) || \ |
bogdanm | 73:1efda918f0ba | 100 | ((TRIGGER) == DAC_Trigger_T2_TRGO) || \ |
bogdanm | 73:1efda918f0ba | 101 | ((TRIGGER) == DAC_Trigger_T4_TRGO) || \ |
bogdanm | 73:1efda918f0ba | 102 | ((TRIGGER) == DAC_Trigger_Ext_IT9) || \ |
bogdanm | 73:1efda918f0ba | 103 | ((TRIGGER) == DAC_Trigger_Software)) |
bogdanm | 73:1efda918f0ba | 104 | |
bogdanm | 73:1efda918f0ba | 105 | /** |
bogdanm | 73:1efda918f0ba | 106 | * @} |
bogdanm | 73:1efda918f0ba | 107 | */ |
bogdanm | 73:1efda918f0ba | 108 | |
bogdanm | 73:1efda918f0ba | 109 | /** @defgroup DAC_wave_generation |
bogdanm | 73:1efda918f0ba | 110 | * @{ |
bogdanm | 73:1efda918f0ba | 111 | */ |
bogdanm | 73:1efda918f0ba | 112 | |
bogdanm | 73:1efda918f0ba | 113 | #define DAC_WaveGeneration_None ((uint32_t)0x00000000) |
bogdanm | 73:1efda918f0ba | 114 | #define DAC_WaveGeneration_Noise ((uint32_t)0x00000040) |
bogdanm | 73:1efda918f0ba | 115 | #define DAC_WaveGeneration_Triangle ((uint32_t)0x00000080) |
bogdanm | 73:1efda918f0ba | 116 | #define IS_DAC_GENERATE_WAVE(WAVE) (((WAVE) == DAC_WaveGeneration_None) || \ |
bogdanm | 73:1efda918f0ba | 117 | ((WAVE) == DAC_WaveGeneration_Noise) || \ |
bogdanm | 73:1efda918f0ba | 118 | ((WAVE) == DAC_WaveGeneration_Triangle)) |
bogdanm | 73:1efda918f0ba | 119 | /** |
bogdanm | 73:1efda918f0ba | 120 | * @} |
bogdanm | 73:1efda918f0ba | 121 | */ |
bogdanm | 73:1efda918f0ba | 122 | |
bogdanm | 73:1efda918f0ba | 123 | /** @defgroup DAC_lfsrunmask_triangleamplitude |
bogdanm | 73:1efda918f0ba | 124 | * @{ |
bogdanm | 73:1efda918f0ba | 125 | */ |
bogdanm | 73:1efda918f0ba | 126 | |
bogdanm | 73:1efda918f0ba | 127 | #define DAC_LFSRUnmask_Bit0 ((uint32_t)0x00000000) /*!< Unmask DAC channel LFSR bit0 for noise wave generation */ |
bogdanm | 73:1efda918f0ba | 128 | #define DAC_LFSRUnmask_Bits1_0 ((uint32_t)0x00000100) /*!< Unmask DAC channel LFSR bit[1:0] for noise wave generation */ |
bogdanm | 73:1efda918f0ba | 129 | #define DAC_LFSRUnmask_Bits2_0 ((uint32_t)0x00000200) /*!< Unmask DAC channel LFSR bit[2:0] for noise wave generation */ |
bogdanm | 73:1efda918f0ba | 130 | #define DAC_LFSRUnmask_Bits3_0 ((uint32_t)0x00000300) /*!< Unmask DAC channel LFSR bit[3:0] for noise wave generation */ |
bogdanm | 73:1efda918f0ba | 131 | #define DAC_LFSRUnmask_Bits4_0 ((uint32_t)0x00000400) /*!< Unmask DAC channel LFSR bit[4:0] for noise wave generation */ |
bogdanm | 73:1efda918f0ba | 132 | #define DAC_LFSRUnmask_Bits5_0 ((uint32_t)0x00000500) /*!< Unmask DAC channel LFSR bit[5:0] for noise wave generation */ |
bogdanm | 73:1efda918f0ba | 133 | #define DAC_LFSRUnmask_Bits6_0 ((uint32_t)0x00000600) /*!< Unmask DAC channel LFSR bit[6:0] for noise wave generation */ |
bogdanm | 73:1efda918f0ba | 134 | #define DAC_LFSRUnmask_Bits7_0 ((uint32_t)0x00000700) /*!< Unmask DAC channel LFSR bit[7:0] for noise wave generation */ |
bogdanm | 73:1efda918f0ba | 135 | #define DAC_LFSRUnmask_Bits8_0 ((uint32_t)0x00000800) /*!< Unmask DAC channel LFSR bit[8:0] for noise wave generation */ |
bogdanm | 73:1efda918f0ba | 136 | #define DAC_LFSRUnmask_Bits9_0 ((uint32_t)0x00000900) /*!< Unmask DAC channel LFSR bit[9:0] for noise wave generation */ |
bogdanm | 73:1efda918f0ba | 137 | #define DAC_LFSRUnmask_Bits10_0 ((uint32_t)0x00000A00) /*!< Unmask DAC channel LFSR bit[10:0] for noise wave generation */ |
bogdanm | 73:1efda918f0ba | 138 | #define DAC_LFSRUnmask_Bits11_0 ((uint32_t)0x00000B00) /*!< Unmask DAC channel LFSR bit[11:0] for noise wave generation */ |
bogdanm | 73:1efda918f0ba | 139 | #define DAC_TriangleAmplitude_1 ((uint32_t)0x00000000) /*!< Select max triangle amplitude of 1 */ |
bogdanm | 73:1efda918f0ba | 140 | #define DAC_TriangleAmplitude_3 ((uint32_t)0x00000100) /*!< Select max triangle amplitude of 3 */ |
bogdanm | 73:1efda918f0ba | 141 | #define DAC_TriangleAmplitude_7 ((uint32_t)0x00000200) /*!< Select max triangle amplitude of 7 */ |
bogdanm | 73:1efda918f0ba | 142 | #define DAC_TriangleAmplitude_15 ((uint32_t)0x00000300) /*!< Select max triangle amplitude of 15 */ |
bogdanm | 73:1efda918f0ba | 143 | #define DAC_TriangleAmplitude_31 ((uint32_t)0x00000400) /*!< Select max triangle amplitude of 31 */ |
bogdanm | 73:1efda918f0ba | 144 | #define DAC_TriangleAmplitude_63 ((uint32_t)0x00000500) /*!< Select max triangle amplitude of 63 */ |
bogdanm | 73:1efda918f0ba | 145 | #define DAC_TriangleAmplitude_127 ((uint32_t)0x00000600) /*!< Select max triangle amplitude of 127 */ |
bogdanm | 73:1efda918f0ba | 146 | #define DAC_TriangleAmplitude_255 ((uint32_t)0x00000700) /*!< Select max triangle amplitude of 255 */ |
bogdanm | 73:1efda918f0ba | 147 | #define DAC_TriangleAmplitude_511 ((uint32_t)0x00000800) /*!< Select max triangle amplitude of 511 */ |
bogdanm | 73:1efda918f0ba | 148 | #define DAC_TriangleAmplitude_1023 ((uint32_t)0x00000900) /*!< Select max triangle amplitude of 1023 */ |
bogdanm | 73:1efda918f0ba | 149 | #define DAC_TriangleAmplitude_2047 ((uint32_t)0x00000A00) /*!< Select max triangle amplitude of 2047 */ |
bogdanm | 73:1efda918f0ba | 150 | #define DAC_TriangleAmplitude_4095 ((uint32_t)0x00000B00) /*!< Select max triangle amplitude of 4095 */ |
bogdanm | 73:1efda918f0ba | 151 | |
bogdanm | 73:1efda918f0ba | 152 | #define IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(VALUE) (((VALUE) == DAC_LFSRUnmask_Bit0) || \ |
bogdanm | 73:1efda918f0ba | 153 | ((VALUE) == DAC_LFSRUnmask_Bits1_0) || \ |
bogdanm | 73:1efda918f0ba | 154 | ((VALUE) == DAC_LFSRUnmask_Bits2_0) || \ |
bogdanm | 73:1efda918f0ba | 155 | ((VALUE) == DAC_LFSRUnmask_Bits3_0) || \ |
bogdanm | 73:1efda918f0ba | 156 | ((VALUE) == DAC_LFSRUnmask_Bits4_0) || \ |
bogdanm | 73:1efda918f0ba | 157 | ((VALUE) == DAC_LFSRUnmask_Bits5_0) || \ |
bogdanm | 73:1efda918f0ba | 158 | ((VALUE) == DAC_LFSRUnmask_Bits6_0) || \ |
bogdanm | 73:1efda918f0ba | 159 | ((VALUE) == DAC_LFSRUnmask_Bits7_0) || \ |
bogdanm | 73:1efda918f0ba | 160 | ((VALUE) == DAC_LFSRUnmask_Bits8_0) || \ |
bogdanm | 73:1efda918f0ba | 161 | ((VALUE) == DAC_LFSRUnmask_Bits9_0) || \ |
bogdanm | 73:1efda918f0ba | 162 | ((VALUE) == DAC_LFSRUnmask_Bits10_0) || \ |
bogdanm | 73:1efda918f0ba | 163 | ((VALUE) == DAC_LFSRUnmask_Bits11_0) || \ |
bogdanm | 73:1efda918f0ba | 164 | ((VALUE) == DAC_TriangleAmplitude_1) || \ |
bogdanm | 73:1efda918f0ba | 165 | ((VALUE) == DAC_TriangleAmplitude_3) || \ |
bogdanm | 73:1efda918f0ba | 166 | ((VALUE) == DAC_TriangleAmplitude_7) || \ |
bogdanm | 73:1efda918f0ba | 167 | ((VALUE) == DAC_TriangleAmplitude_15) || \ |
bogdanm | 73:1efda918f0ba | 168 | ((VALUE) == DAC_TriangleAmplitude_31) || \ |
bogdanm | 73:1efda918f0ba | 169 | ((VALUE) == DAC_TriangleAmplitude_63) || \ |
bogdanm | 73:1efda918f0ba | 170 | ((VALUE) == DAC_TriangleAmplitude_127) || \ |
bogdanm | 73:1efda918f0ba | 171 | ((VALUE) == DAC_TriangleAmplitude_255) || \ |
bogdanm | 73:1efda918f0ba | 172 | ((VALUE) == DAC_TriangleAmplitude_511) || \ |
bogdanm | 73:1efda918f0ba | 173 | ((VALUE) == DAC_TriangleAmplitude_1023) || \ |
bogdanm | 73:1efda918f0ba | 174 | ((VALUE) == DAC_TriangleAmplitude_2047) || \ |
bogdanm | 73:1efda918f0ba | 175 | ((VALUE) == DAC_TriangleAmplitude_4095)) |
bogdanm | 73:1efda918f0ba | 176 | /** |
bogdanm | 73:1efda918f0ba | 177 | * @} |
bogdanm | 73:1efda918f0ba | 178 | */ |
bogdanm | 73:1efda918f0ba | 179 | |
bogdanm | 73:1efda918f0ba | 180 | /** @defgroup DAC_output_buffer |
bogdanm | 73:1efda918f0ba | 181 | * @{ |
bogdanm | 73:1efda918f0ba | 182 | */ |
bogdanm | 73:1efda918f0ba | 183 | |
bogdanm | 73:1efda918f0ba | 184 | #define DAC_OutputBuffer_Enable ((uint32_t)0x00000000) |
bogdanm | 73:1efda918f0ba | 185 | #define DAC_OutputBuffer_Disable ((uint32_t)0x00000002) |
bogdanm | 73:1efda918f0ba | 186 | #define IS_DAC_OUTPUT_BUFFER_STATE(STATE) (((STATE) == DAC_OutputBuffer_Enable) || \ |
bogdanm | 73:1efda918f0ba | 187 | ((STATE) == DAC_OutputBuffer_Disable)) |
bogdanm | 73:1efda918f0ba | 188 | /** |
bogdanm | 73:1efda918f0ba | 189 | * @} |
bogdanm | 73:1efda918f0ba | 190 | */ |
bogdanm | 73:1efda918f0ba | 191 | |
bogdanm | 73:1efda918f0ba | 192 | /** @defgroup DAC_Channel_selection |
bogdanm | 73:1efda918f0ba | 193 | * @{ |
bogdanm | 73:1efda918f0ba | 194 | */ |
bogdanm | 73:1efda918f0ba | 195 | |
bogdanm | 73:1efda918f0ba | 196 | #define DAC_Channel_1 ((uint32_t)0x00000000) |
bogdanm | 73:1efda918f0ba | 197 | #define DAC_Channel_2 ((uint32_t)0x00000010) |
bogdanm | 73:1efda918f0ba | 198 | #define IS_DAC_CHANNEL(CHANNEL) (((CHANNEL) == DAC_Channel_1) || \ |
bogdanm | 73:1efda918f0ba | 199 | ((CHANNEL) == DAC_Channel_2)) |
bogdanm | 73:1efda918f0ba | 200 | /** |
bogdanm | 73:1efda918f0ba | 201 | * @} |
bogdanm | 73:1efda918f0ba | 202 | */ |
bogdanm | 73:1efda918f0ba | 203 | |
bogdanm | 73:1efda918f0ba | 204 | /** @defgroup DAC_data_alignment |
bogdanm | 73:1efda918f0ba | 205 | * @{ |
bogdanm | 73:1efda918f0ba | 206 | */ |
bogdanm | 73:1efda918f0ba | 207 | |
bogdanm | 73:1efda918f0ba | 208 | #define DAC_Align_12b_R ((uint32_t)0x00000000) |
bogdanm | 73:1efda918f0ba | 209 | #define DAC_Align_12b_L ((uint32_t)0x00000004) |
bogdanm | 73:1efda918f0ba | 210 | #define DAC_Align_8b_R ((uint32_t)0x00000008) |
bogdanm | 73:1efda918f0ba | 211 | #define IS_DAC_ALIGN(ALIGN) (((ALIGN) == DAC_Align_12b_R) || \ |
bogdanm | 73:1efda918f0ba | 212 | ((ALIGN) == DAC_Align_12b_L) || \ |
bogdanm | 73:1efda918f0ba | 213 | ((ALIGN) == DAC_Align_8b_R)) |
bogdanm | 73:1efda918f0ba | 214 | /** |
bogdanm | 73:1efda918f0ba | 215 | * @} |
bogdanm | 73:1efda918f0ba | 216 | */ |
bogdanm | 73:1efda918f0ba | 217 | |
bogdanm | 73:1efda918f0ba | 218 | /** @defgroup DAC_wave_generation |
bogdanm | 73:1efda918f0ba | 219 | * @{ |
bogdanm | 73:1efda918f0ba | 220 | */ |
bogdanm | 73:1efda918f0ba | 221 | |
bogdanm | 73:1efda918f0ba | 222 | #define DAC_Wave_Noise ((uint32_t)0x00000040) |
bogdanm | 73:1efda918f0ba | 223 | #define DAC_Wave_Triangle ((uint32_t)0x00000080) |
bogdanm | 73:1efda918f0ba | 224 | #define IS_DAC_WAVE(WAVE) (((WAVE) == DAC_Wave_Noise) || \ |
bogdanm | 73:1efda918f0ba | 225 | ((WAVE) == DAC_Wave_Triangle)) |
bogdanm | 73:1efda918f0ba | 226 | /** |
bogdanm | 73:1efda918f0ba | 227 | * @} |
bogdanm | 73:1efda918f0ba | 228 | */ |
bogdanm | 73:1efda918f0ba | 229 | |
bogdanm | 73:1efda918f0ba | 230 | /** @defgroup DAC_data |
bogdanm | 73:1efda918f0ba | 231 | * @{ |
bogdanm | 73:1efda918f0ba | 232 | */ |
bogdanm | 73:1efda918f0ba | 233 | |
bogdanm | 73:1efda918f0ba | 234 | #define IS_DAC_DATA(DATA) ((DATA) <= 0xFFF0) |
bogdanm | 73:1efda918f0ba | 235 | /** |
bogdanm | 73:1efda918f0ba | 236 | * @} |
bogdanm | 73:1efda918f0ba | 237 | */ |
bogdanm | 73:1efda918f0ba | 238 | #if defined (STM32F10X_LD_VL) || defined (STM32F10X_MD_VL) || defined (STM32F10X_HD_VL) |
bogdanm | 73:1efda918f0ba | 239 | /** @defgroup DAC_interrupts_definition |
bogdanm | 73:1efda918f0ba | 240 | * @{ |
bogdanm | 73:1efda918f0ba | 241 | */ |
bogdanm | 73:1efda918f0ba | 242 | |
bogdanm | 73:1efda918f0ba | 243 | #define DAC_IT_DMAUDR ((uint32_t)0x00002000) |
bogdanm | 73:1efda918f0ba | 244 | #define IS_DAC_IT(IT) (((IT) == DAC_IT_DMAUDR)) |
bogdanm | 73:1efda918f0ba | 245 | |
bogdanm | 73:1efda918f0ba | 246 | /** |
bogdanm | 73:1efda918f0ba | 247 | * @} |
bogdanm | 73:1efda918f0ba | 248 | */ |
bogdanm | 73:1efda918f0ba | 249 | |
bogdanm | 73:1efda918f0ba | 250 | /** @defgroup DAC_flags_definition |
bogdanm | 73:1efda918f0ba | 251 | * @{ |
bogdanm | 73:1efda918f0ba | 252 | */ |
bogdanm | 73:1efda918f0ba | 253 | |
bogdanm | 73:1efda918f0ba | 254 | #define DAC_FLAG_DMAUDR ((uint32_t)0x00002000) |
bogdanm | 73:1efda918f0ba | 255 | #define IS_DAC_FLAG(FLAG) (((FLAG) == DAC_FLAG_DMAUDR)) |
bogdanm | 73:1efda918f0ba | 256 | |
bogdanm | 73:1efda918f0ba | 257 | /** |
bogdanm | 73:1efda918f0ba | 258 | * @} |
bogdanm | 73:1efda918f0ba | 259 | */ |
bogdanm | 73:1efda918f0ba | 260 | #endif |
bogdanm | 73:1efda918f0ba | 261 | |
bogdanm | 73:1efda918f0ba | 262 | /** |
bogdanm | 73:1efda918f0ba | 263 | * @} |
bogdanm | 73:1efda918f0ba | 264 | */ |
bogdanm | 73:1efda918f0ba | 265 | |
bogdanm | 73:1efda918f0ba | 266 | /** @defgroup DAC_Exported_Macros |
bogdanm | 73:1efda918f0ba | 267 | * @{ |
bogdanm | 73:1efda918f0ba | 268 | */ |
bogdanm | 73:1efda918f0ba | 269 | |
bogdanm | 73:1efda918f0ba | 270 | /** |
bogdanm | 73:1efda918f0ba | 271 | * @} |
bogdanm | 73:1efda918f0ba | 272 | */ |
bogdanm | 73:1efda918f0ba | 273 | |
bogdanm | 73:1efda918f0ba | 274 | /** @defgroup DAC_Exported_Functions |
bogdanm | 73:1efda918f0ba | 275 | * @{ |
bogdanm | 73:1efda918f0ba | 276 | */ |
bogdanm | 73:1efda918f0ba | 277 | |
bogdanm | 73:1efda918f0ba | 278 | void DAC_DeInit(void); |
bogdanm | 73:1efda918f0ba | 279 | void DAC_Init(uint32_t DAC_Channel, DAC_InitTypeDef* DAC_InitStruct); |
bogdanm | 73:1efda918f0ba | 280 | void DAC_StructInit(DAC_InitTypeDef* DAC_InitStruct); |
bogdanm | 73:1efda918f0ba | 281 | void DAC_Cmd(uint32_t DAC_Channel, FunctionalState NewState); |
bogdanm | 73:1efda918f0ba | 282 | #if defined (STM32F10X_LD_VL) || defined (STM32F10X_MD_VL) || defined (STM32F10X_HD_VL) |
bogdanm | 73:1efda918f0ba | 283 | void DAC_ITConfig(uint32_t DAC_Channel, uint32_t DAC_IT, FunctionalState NewState); |
bogdanm | 73:1efda918f0ba | 284 | #endif |
bogdanm | 73:1efda918f0ba | 285 | void DAC_DMACmd(uint32_t DAC_Channel, FunctionalState NewState); |
bogdanm | 73:1efda918f0ba | 286 | void DAC_SoftwareTriggerCmd(uint32_t DAC_Channel, FunctionalState NewState); |
bogdanm | 73:1efda918f0ba | 287 | void DAC_DualSoftwareTriggerCmd(FunctionalState NewState); |
bogdanm | 73:1efda918f0ba | 288 | void DAC_WaveGenerationCmd(uint32_t DAC_Channel, uint32_t DAC_Wave, FunctionalState NewState); |
bogdanm | 73:1efda918f0ba | 289 | void DAC_SetChannel1Data(uint32_t DAC_Align, uint16_t Data); |
bogdanm | 73:1efda918f0ba | 290 | void DAC_SetChannel2Data(uint32_t DAC_Align, uint16_t Data); |
bogdanm | 73:1efda918f0ba | 291 | void DAC_SetDualChannelData(uint32_t DAC_Align, uint16_t Data2, uint16_t Data1); |
bogdanm | 73:1efda918f0ba | 292 | uint16_t DAC_GetDataOutputValue(uint32_t DAC_Channel); |
bogdanm | 73:1efda918f0ba | 293 | #if defined (STM32F10X_LD_VL) || defined (STM32F10X_MD_VL) || defined (STM32F10X_HD_VL) |
bogdanm | 73:1efda918f0ba | 294 | FlagStatus DAC_GetFlagStatus(uint32_t DAC_Channel, uint32_t DAC_FLAG); |
bogdanm | 73:1efda918f0ba | 295 | void DAC_ClearFlag(uint32_t DAC_Channel, uint32_t DAC_FLAG); |
bogdanm | 73:1efda918f0ba | 296 | ITStatus DAC_GetITStatus(uint32_t DAC_Channel, uint32_t DAC_IT); |
bogdanm | 73:1efda918f0ba | 297 | void DAC_ClearITPendingBit(uint32_t DAC_Channel, uint32_t DAC_IT); |
bogdanm | 73:1efda918f0ba | 298 | #endif |
bogdanm | 73:1efda918f0ba | 299 | |
bogdanm | 73:1efda918f0ba | 300 | #ifdef __cplusplus |
bogdanm | 73:1efda918f0ba | 301 | } |
bogdanm | 73:1efda918f0ba | 302 | #endif |
bogdanm | 73:1efda918f0ba | 303 | |
bogdanm | 73:1efda918f0ba | 304 | #endif /*__STM32F10x_DAC_H */ |
bogdanm | 73:1efda918f0ba | 305 | /** |
bogdanm | 73:1efda918f0ba | 306 | * @} |
bogdanm | 73:1efda918f0ba | 307 | */ |
bogdanm | 73:1efda918f0ba | 308 | |
bogdanm | 73:1efda918f0ba | 309 | /** |
bogdanm | 73:1efda918f0ba | 310 | * @} |
bogdanm | 73:1efda918f0ba | 311 | */ |
bogdanm | 73:1efda918f0ba | 312 | |
bogdanm | 73:1efda918f0ba | 313 | /** |
bogdanm | 73:1efda918f0ba | 314 | * @} |
bogdanm | 73:1efda918f0ba | 315 | */ |
bogdanm | 73:1efda918f0ba | 316 | |
bogdanm | 73:1efda918f0ba | 317 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ |