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