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