mbed library with additional peripherals for ST F401 board
Fork of mbed-src by
This mbed LIB has additional peripherals for ST F401 board
- UART2 : PA_3 rx, PA_2 tx
- UART3 : PC_7 rx, PC_6 tx
- I2C2 : PB_3 SDA, PB_10 SCL
- I2C3 : PB_4 SDA, PA_8 SCL
targets/cmsis/TARGET_STM/TARGET_NUCLEO_F030R8/stm32f0xx_dac.h@76:aeb1df146756, 2014-01-27 (annotated)
- Committer:
- mbed_official
- Date:
- Mon Jan 27 14:30:07 2014 +0000
- Revision:
- 76:aeb1df146756
- Child:
- 106:ced8cbb51063
Synchronized with git revision a31ec9c5f7bcb5c8a1b2eced103f6a1dfa921abd
Full URL: https://github.com/mbedmicro/mbed/commit/a31ec9c5f7bcb5c8a1b2eced103f6a1dfa921abd/
Add NUCLEO_L152RE
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 76:aeb1df146756 | 1 | /** |
mbed_official | 76:aeb1df146756 | 2 | ****************************************************************************** |
mbed_official | 76:aeb1df146756 | 3 | * @file stm32f0xx_dac.h |
mbed_official | 76:aeb1df146756 | 4 | * @author MCD Application Team |
mbed_official | 76:aeb1df146756 | 5 | * @version V1.3.0 |
mbed_official | 76:aeb1df146756 | 6 | * @date 16-January-2014 |
mbed_official | 76:aeb1df146756 | 7 | * @brief This file contains all the functions prototypes for the DAC firmware |
mbed_official | 76:aeb1df146756 | 8 | * library, applicable only for STM32F051 and STM32F072 devices. |
mbed_official | 76:aeb1df146756 | 9 | ****************************************************************************** |
mbed_official | 76:aeb1df146756 | 10 | * @attention |
mbed_official | 76:aeb1df146756 | 11 | * |
mbed_official | 76:aeb1df146756 | 12 | * <h2><center>© COPYRIGHT 2014 STMicroelectronics</center></h2> |
mbed_official | 76:aeb1df146756 | 13 | * |
mbed_official | 76:aeb1df146756 | 14 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); |
mbed_official | 76:aeb1df146756 | 15 | * You may not use this file except in compliance with the License. |
mbed_official | 76:aeb1df146756 | 16 | * You may obtain a copy of the License at: |
mbed_official | 76:aeb1df146756 | 17 | * |
mbed_official | 76:aeb1df146756 | 18 | * http://www.st.com/software_license_agreement_liberty_v2 |
mbed_official | 76:aeb1df146756 | 19 | * |
mbed_official | 76:aeb1df146756 | 20 | * Unless required by applicable law or agreed to in writing, software |
mbed_official | 76:aeb1df146756 | 21 | * distributed under the License is distributed on an "AS IS" BASIS, |
mbed_official | 76:aeb1df146756 | 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
mbed_official | 76:aeb1df146756 | 23 | * See the License for the specific language governing permissions and |
mbed_official | 76:aeb1df146756 | 24 | * limitations under the License. |
mbed_official | 76:aeb1df146756 | 25 | * |
mbed_official | 76:aeb1df146756 | 26 | ****************************************************************************** |
mbed_official | 76:aeb1df146756 | 27 | */ |
mbed_official | 76:aeb1df146756 | 28 | |
mbed_official | 76:aeb1df146756 | 29 | /* Define to prevent recursive inclusion -------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 30 | #ifndef __STM32F0XX_DAC_H |
mbed_official | 76:aeb1df146756 | 31 | #define __STM32F0XX_DAC_H |
mbed_official | 76:aeb1df146756 | 32 | |
mbed_official | 76:aeb1df146756 | 33 | #ifdef __cplusplus |
mbed_official | 76:aeb1df146756 | 34 | extern "C" { |
mbed_official | 76:aeb1df146756 | 35 | #endif |
mbed_official | 76:aeb1df146756 | 36 | |
mbed_official | 76:aeb1df146756 | 37 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 38 | #include "stm32f0xx.h" |
mbed_official | 76:aeb1df146756 | 39 | |
mbed_official | 76:aeb1df146756 | 40 | /** @addtogroup STM32F0xx_StdPeriph_Driver |
mbed_official | 76:aeb1df146756 | 41 | * @{ |
mbed_official | 76:aeb1df146756 | 42 | */ |
mbed_official | 76:aeb1df146756 | 43 | |
mbed_official | 76:aeb1df146756 | 44 | /** @addtogroup DAC |
mbed_official | 76:aeb1df146756 | 45 | * @{ |
mbed_official | 76:aeb1df146756 | 46 | */ |
mbed_official | 76:aeb1df146756 | 47 | |
mbed_official | 76:aeb1df146756 | 48 | /* Exported types ------------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 49 | |
mbed_official | 76:aeb1df146756 | 50 | /** |
mbed_official | 76:aeb1df146756 | 51 | * @brief DAC Init structure definition |
mbed_official | 76:aeb1df146756 | 52 | */ |
mbed_official | 76:aeb1df146756 | 53 | |
mbed_official | 76:aeb1df146756 | 54 | typedef struct |
mbed_official | 76:aeb1df146756 | 55 | { |
mbed_official | 76:aeb1df146756 | 56 | uint32_t DAC_Trigger; /*!< Specifies the external trigger for the selected DAC channel. |
mbed_official | 76:aeb1df146756 | 57 | This parameter can be a value of @ref DAC_trigger_selection */ |
mbed_official | 76:aeb1df146756 | 58 | |
mbed_official | 76:aeb1df146756 | 59 | uint32_t DAC_WaveGeneration; /*!< Specifies whether DAC channel noise waves or triangle waves |
mbed_official | 76:aeb1df146756 | 60 | are generated, or whether no wave is generated. |
mbed_official | 76:aeb1df146756 | 61 | This parameter can be a value of @ref DAC_wave_generation |
mbed_official | 76:aeb1df146756 | 62 | This parameter is only applicable for STM32F072 devices */ |
mbed_official | 76:aeb1df146756 | 63 | |
mbed_official | 76:aeb1df146756 | 64 | uint32_t DAC_LFSRUnmask_TriangleAmplitude; /*!< Specifies the LFSR mask for noise wave generation or |
mbed_official | 76:aeb1df146756 | 65 | the maximum amplitude triangle generation for the DAC channel. |
mbed_official | 76:aeb1df146756 | 66 | This parameter can be a value of @ref DAC_lfsrunmask_triangleamplitude |
mbed_official | 76:aeb1df146756 | 67 | This parameter is only applicable for STM32F072 devices */ |
mbed_official | 76:aeb1df146756 | 68 | |
mbed_official | 76:aeb1df146756 | 69 | uint32_t DAC_OutputBuffer; /*!< Specifies whether the DAC channel output buffer is enabled or disabled. |
mbed_official | 76:aeb1df146756 | 70 | This parameter can be a value of @ref DAC_output_buffer */ |
mbed_official | 76:aeb1df146756 | 71 | }DAC_InitTypeDef; |
mbed_official | 76:aeb1df146756 | 72 | |
mbed_official | 76:aeb1df146756 | 73 | /* Exported constants --------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 74 | |
mbed_official | 76:aeb1df146756 | 75 | /** @defgroup DAC_Exported_Constants |
mbed_official | 76:aeb1df146756 | 76 | * @{ |
mbed_official | 76:aeb1df146756 | 77 | */ |
mbed_official | 76:aeb1df146756 | 78 | |
mbed_official | 76:aeb1df146756 | 79 | /** @defgroup DAC_Trigger |
mbed_official | 76:aeb1df146756 | 80 | * @{ |
mbed_official | 76:aeb1df146756 | 81 | */ |
mbed_official | 76:aeb1df146756 | 82 | |
mbed_official | 76:aeb1df146756 | 83 | #define DAC_Trigger_None ((uint32_t)0x00000000) /*!< Conversion is automatic once the DAC1_DHRxxxx register |
mbed_official | 76:aeb1df146756 | 84 | has been loaded, and not by external trigger */ |
mbed_official | 76:aeb1df146756 | 85 | #define DAC_Trigger_T6_TRGO ((uint32_t)0x00000004) /*!< TIM6 TRGO selected as external conversion trigger for DAC channel1 */ |
mbed_official | 76:aeb1df146756 | 86 | #define DAC_Trigger_T3_TRGO ((uint32_t)0x0000000C) /*!< TIM3 TRGO selected as external conversion trigger for DAC channel1 */ |
mbed_official | 76:aeb1df146756 | 87 | #define DAC_Trigger_T7_TRGO ((uint32_t)0x00000014) /*!< TIM7 TRGO selected as external conversion trigger for DAC channel1, |
mbed_official | 76:aeb1df146756 | 88 | applicable only for STM32F072 devices */ |
mbed_official | 76:aeb1df146756 | 89 | #define DAC_Trigger_T15_TRGO ((uint32_t)0x0000001C) /*!< TIM15 TRGO selected as external conversion trigger for DAC channel1 */ |
mbed_official | 76:aeb1df146756 | 90 | #define DAC_Trigger_T2_TRGO ((uint32_t)0x00000024) /*!< TIM2 TRGO selected as external conversion trigger for DAC channel1 */ |
mbed_official | 76:aeb1df146756 | 91 | #define DAC_Trigger_Ext_IT9 ((uint32_t)0x00000034) /*!< EXTI Line9 event selected as external conversion trigger for DAC channels */ |
mbed_official | 76:aeb1df146756 | 92 | #define DAC_Trigger_Software ((uint32_t)0x0000003C) /*!< Conversion started by software trigger for DAC channels */ |
mbed_official | 76:aeb1df146756 | 93 | |
mbed_official | 76:aeb1df146756 | 94 | #define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_Trigger_None) || \ |
mbed_official | 76:aeb1df146756 | 95 | ((TRIGGER) == DAC_Trigger_T6_TRGO) || \ |
mbed_official | 76:aeb1df146756 | 96 | ((TRIGGER) == DAC_Trigger_T7_TRGO) || \ |
mbed_official | 76:aeb1df146756 | 97 | ((TRIGGER) == DAC_Trigger_T3_TRGO) || \ |
mbed_official | 76:aeb1df146756 | 98 | ((TRIGGER) == DAC_Trigger_T15_TRGO) || \ |
mbed_official | 76:aeb1df146756 | 99 | ((TRIGGER) == DAC_Trigger_T2_TRGO) || \ |
mbed_official | 76:aeb1df146756 | 100 | ((TRIGGER) == DAC_Trigger_Ext_IT9) || \ |
mbed_official | 76:aeb1df146756 | 101 | ((TRIGGER) == DAC_Trigger_Software)) |
mbed_official | 76:aeb1df146756 | 102 | |
mbed_official | 76:aeb1df146756 | 103 | /** |
mbed_official | 76:aeb1df146756 | 104 | * @} |
mbed_official | 76:aeb1df146756 | 105 | */ |
mbed_official | 76:aeb1df146756 | 106 | |
mbed_official | 76:aeb1df146756 | 107 | /** @defgroup DAC_wave_generation |
mbed_official | 76:aeb1df146756 | 108 | * @brief This parameters are only applicable for STM32F072 devices. |
mbed_official | 76:aeb1df146756 | 109 | * @{ |
mbed_official | 76:aeb1df146756 | 110 | */ |
mbed_official | 76:aeb1df146756 | 111 | |
mbed_official | 76:aeb1df146756 | 112 | #define DAC_WaveGeneration_None ((uint32_t)0x00000000) |
mbed_official | 76:aeb1df146756 | 113 | #define DAC_WaveGeneration_Noise ((uint32_t)0x00000040) |
mbed_official | 76:aeb1df146756 | 114 | #define DAC_WaveGeneration_Triangle ((uint32_t)0x00000080) |
mbed_official | 76:aeb1df146756 | 115 | #define IS_DAC_GENERATE_WAVE(WAVE) (((WAVE) == DAC_WaveGeneration_None) || \ |
mbed_official | 76:aeb1df146756 | 116 | ((WAVE) == DAC_WaveGeneration_Noise) || \ |
mbed_official | 76:aeb1df146756 | 117 | ((WAVE) == DAC_WaveGeneration_Triangle)) |
mbed_official | 76:aeb1df146756 | 118 | /** |
mbed_official | 76:aeb1df146756 | 119 | * @} |
mbed_official | 76:aeb1df146756 | 120 | */ |
mbed_official | 76:aeb1df146756 | 121 | |
mbed_official | 76:aeb1df146756 | 122 | /** @defgroup DAC_lfsrunmask_triangleamplitude |
mbed_official | 76:aeb1df146756 | 123 | * @brief These parameters are only applicable for STM32F072 devices. |
mbed_official | 76:aeb1df146756 | 124 | * @{ |
mbed_official | 76:aeb1df146756 | 125 | */ |
mbed_official | 76:aeb1df146756 | 126 | |
mbed_official | 76:aeb1df146756 | 127 | #define DAC_LFSRUnmask_Bit0 ((uint32_t)0x00000000) /*!< Unmask DAC channel LFSR bit0 for noise wave generation */ |
mbed_official | 76:aeb1df146756 | 128 | #define DAC_LFSRUnmask_Bits1_0 ((uint32_t)0x00000100) /*!< Unmask DAC channel LFSR bit[1:0] for noise wave generation */ |
mbed_official | 76:aeb1df146756 | 129 | #define DAC_LFSRUnmask_Bits2_0 ((uint32_t)0x00000200) /*!< Unmask DAC channel LFSR bit[2:0] for noise wave generation */ |
mbed_official | 76:aeb1df146756 | 130 | #define DAC_LFSRUnmask_Bits3_0 ((uint32_t)0x00000300) /*!< Unmask DAC channel LFSR bit[3:0] for noise wave generation */ |
mbed_official | 76:aeb1df146756 | 131 | #define DAC_LFSRUnmask_Bits4_0 ((uint32_t)0x00000400) /*!< Unmask DAC channel LFSR bit[4:0] for noise wave generation */ |
mbed_official | 76:aeb1df146756 | 132 | #define DAC_LFSRUnmask_Bits5_0 ((uint32_t)0x00000500) /*!< Unmask DAC channel LFSR bit[5:0] for noise wave generation */ |
mbed_official | 76:aeb1df146756 | 133 | #define DAC_LFSRUnmask_Bits6_0 ((uint32_t)0x00000600) /*!< Unmask DAC channel LFSR bit[6:0] for noise wave generation */ |
mbed_official | 76:aeb1df146756 | 134 | #define DAC_LFSRUnmask_Bits7_0 ((uint32_t)0x00000700) /*!< Unmask DAC channel LFSR bit[7:0] for noise wave generation */ |
mbed_official | 76:aeb1df146756 | 135 | #define DAC_LFSRUnmask_Bits8_0 ((uint32_t)0x00000800) /*!< Unmask DAC channel LFSR bit[8:0] for noise wave generation */ |
mbed_official | 76:aeb1df146756 | 136 | #define DAC_LFSRUnmask_Bits9_0 ((uint32_t)0x00000900) /*!< Unmask DAC channel LFSR bit[9:0] for noise wave generation */ |
mbed_official | 76:aeb1df146756 | 137 | #define DAC_LFSRUnmask_Bits10_0 ((uint32_t)0x00000A00) /*!< Unmask DAC channel LFSR bit[10:0] for noise wave generation */ |
mbed_official | 76:aeb1df146756 | 138 | #define DAC_LFSRUnmask_Bits11_0 ((uint32_t)0x00000B00) /*!< Unmask DAC channel LFSR bit[11:0] for noise wave generation */ |
mbed_official | 76:aeb1df146756 | 139 | #define DAC_TriangleAmplitude_1 ((uint32_t)0x00000000) /*!< Select max triangle amplitude of 1 */ |
mbed_official | 76:aeb1df146756 | 140 | #define DAC_TriangleAmplitude_3 ((uint32_t)0x00000100) /*!< Select max triangle amplitude of 3 */ |
mbed_official | 76:aeb1df146756 | 141 | #define DAC_TriangleAmplitude_7 ((uint32_t)0x00000200) /*!< Select max triangle amplitude of 7 */ |
mbed_official | 76:aeb1df146756 | 142 | #define DAC_TriangleAmplitude_15 ((uint32_t)0x00000300) /*!< Select max triangle amplitude of 15 */ |
mbed_official | 76:aeb1df146756 | 143 | #define DAC_TriangleAmplitude_31 ((uint32_t)0x00000400) /*!< Select max triangle amplitude of 31 */ |
mbed_official | 76:aeb1df146756 | 144 | #define DAC_TriangleAmplitude_63 ((uint32_t)0x00000500) /*!< Select max triangle amplitude of 63 */ |
mbed_official | 76:aeb1df146756 | 145 | #define DAC_TriangleAmplitude_127 ((uint32_t)0x00000600) /*!< Select max triangle amplitude of 127 */ |
mbed_official | 76:aeb1df146756 | 146 | #define DAC_TriangleAmplitude_255 ((uint32_t)0x00000700) /*!< Select max triangle amplitude of 255 */ |
mbed_official | 76:aeb1df146756 | 147 | #define DAC_TriangleAmplitude_511 ((uint32_t)0x00000800) /*!< Select max triangle amplitude of 511 */ |
mbed_official | 76:aeb1df146756 | 148 | #define DAC_TriangleAmplitude_1023 ((uint32_t)0x00000900) /*!< Select max triangle amplitude of 1023 */ |
mbed_official | 76:aeb1df146756 | 149 | #define DAC_TriangleAmplitude_2047 ((uint32_t)0x00000A00) /*!< Select max triangle amplitude of 2047 */ |
mbed_official | 76:aeb1df146756 | 150 | #define DAC_TriangleAmplitude_4095 ((uint32_t)0x00000B00) /*!< Select max triangle amplitude of 4095 */ |
mbed_official | 76:aeb1df146756 | 151 | |
mbed_official | 76:aeb1df146756 | 152 | #define IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(VALUE) (((VALUE) == DAC_LFSRUnmask_Bit0) || \ |
mbed_official | 76:aeb1df146756 | 153 | ((VALUE) == DAC_LFSRUnmask_Bits1_0) || \ |
mbed_official | 76:aeb1df146756 | 154 | ((VALUE) == DAC_LFSRUnmask_Bits2_0) || \ |
mbed_official | 76:aeb1df146756 | 155 | ((VALUE) == DAC_LFSRUnmask_Bits3_0) || \ |
mbed_official | 76:aeb1df146756 | 156 | ((VALUE) == DAC_LFSRUnmask_Bits4_0) || \ |
mbed_official | 76:aeb1df146756 | 157 | ((VALUE) == DAC_LFSRUnmask_Bits5_0) || \ |
mbed_official | 76:aeb1df146756 | 158 | ((VALUE) == DAC_LFSRUnmask_Bits6_0) || \ |
mbed_official | 76:aeb1df146756 | 159 | ((VALUE) == DAC_LFSRUnmask_Bits7_0) || \ |
mbed_official | 76:aeb1df146756 | 160 | ((VALUE) == DAC_LFSRUnmask_Bits8_0) || \ |
mbed_official | 76:aeb1df146756 | 161 | ((VALUE) == DAC_LFSRUnmask_Bits9_0) || \ |
mbed_official | 76:aeb1df146756 | 162 | ((VALUE) == DAC_LFSRUnmask_Bits10_0) || \ |
mbed_official | 76:aeb1df146756 | 163 | ((VALUE) == DAC_LFSRUnmask_Bits11_0) || \ |
mbed_official | 76:aeb1df146756 | 164 | ((VALUE) == DAC_TriangleAmplitude_1) || \ |
mbed_official | 76:aeb1df146756 | 165 | ((VALUE) == DAC_TriangleAmplitude_3) || \ |
mbed_official | 76:aeb1df146756 | 166 | ((VALUE) == DAC_TriangleAmplitude_7) || \ |
mbed_official | 76:aeb1df146756 | 167 | ((VALUE) == DAC_TriangleAmplitude_15) || \ |
mbed_official | 76:aeb1df146756 | 168 | ((VALUE) == DAC_TriangleAmplitude_31) || \ |
mbed_official | 76:aeb1df146756 | 169 | ((VALUE) == DAC_TriangleAmplitude_63) || \ |
mbed_official | 76:aeb1df146756 | 170 | ((VALUE) == DAC_TriangleAmplitude_127) || \ |
mbed_official | 76:aeb1df146756 | 171 | ((VALUE) == DAC_TriangleAmplitude_255) || \ |
mbed_official | 76:aeb1df146756 | 172 | ((VALUE) == DAC_TriangleAmplitude_511) || \ |
mbed_official | 76:aeb1df146756 | 173 | ((VALUE) == DAC_TriangleAmplitude_1023) || \ |
mbed_official | 76:aeb1df146756 | 174 | ((VALUE) == DAC_TriangleAmplitude_2047) || \ |
mbed_official | 76:aeb1df146756 | 175 | ((VALUE) == DAC_TriangleAmplitude_4095)) |
mbed_official | 76:aeb1df146756 | 176 | /** |
mbed_official | 76:aeb1df146756 | 177 | * @} |
mbed_official | 76:aeb1df146756 | 178 | */ |
mbed_official | 76:aeb1df146756 | 179 | |
mbed_official | 76:aeb1df146756 | 180 | /** @defgroup DAC_OutputBuffer |
mbed_official | 76:aeb1df146756 | 181 | * @{ |
mbed_official | 76:aeb1df146756 | 182 | */ |
mbed_official | 76:aeb1df146756 | 183 | |
mbed_official | 76:aeb1df146756 | 184 | #define DAC_OutputBuffer_Enable ((uint32_t)0x00000000) |
mbed_official | 76:aeb1df146756 | 185 | #define DAC_OutputBuffer_Disable DAC_CR_BOFF1 |
mbed_official | 76:aeb1df146756 | 186 | #define IS_DAC_OUTPUT_BUFFER_STATE(STATE) (((STATE) == DAC_OutputBuffer_Enable) || \ |
mbed_official | 76:aeb1df146756 | 187 | ((STATE) == DAC_OutputBuffer_Disable)) |
mbed_official | 76:aeb1df146756 | 188 | /** |
mbed_official | 76:aeb1df146756 | 189 | * @} |
mbed_official | 76:aeb1df146756 | 190 | */ |
mbed_official | 76:aeb1df146756 | 191 | |
mbed_official | 76:aeb1df146756 | 192 | /** @defgroup DAC_Channel_selection |
mbed_official | 76:aeb1df146756 | 193 | * @{ |
mbed_official | 76:aeb1df146756 | 194 | */ |
mbed_official | 76:aeb1df146756 | 195 | |
mbed_official | 76:aeb1df146756 | 196 | #define DAC_Channel_1 ((uint32_t)0x00000000) |
mbed_official | 76:aeb1df146756 | 197 | #define DAC_Channel_2 ((uint32_t)0x00000010) /*!< Only applicable for STM32F072 devices */ |
mbed_official | 76:aeb1df146756 | 198 | #define IS_DAC_CHANNEL(CHANNEL) (((CHANNEL) == DAC_Channel_1) || \ |
mbed_official | 76:aeb1df146756 | 199 | ((CHANNEL) == DAC_Channel_2)) |
mbed_official | 76:aeb1df146756 | 200 | |
mbed_official | 76:aeb1df146756 | 201 | /** |
mbed_official | 76:aeb1df146756 | 202 | * @} |
mbed_official | 76:aeb1df146756 | 203 | */ |
mbed_official | 76:aeb1df146756 | 204 | |
mbed_official | 76:aeb1df146756 | 205 | /** @defgroup DAC_data_alignment |
mbed_official | 76:aeb1df146756 | 206 | * @{ |
mbed_official | 76:aeb1df146756 | 207 | */ |
mbed_official | 76:aeb1df146756 | 208 | |
mbed_official | 76:aeb1df146756 | 209 | #define DAC_Align_12b_R ((uint32_t)0x00000000) |
mbed_official | 76:aeb1df146756 | 210 | #define DAC_Align_12b_L ((uint32_t)0x00000004) |
mbed_official | 76:aeb1df146756 | 211 | #define DAC_Align_8b_R ((uint32_t)0x00000008) |
mbed_official | 76:aeb1df146756 | 212 | #define IS_DAC_ALIGN(ALIGN) (((ALIGN) == DAC_Align_12b_R) || \ |
mbed_official | 76:aeb1df146756 | 213 | ((ALIGN) == DAC_Align_12b_L) || \ |
mbed_official | 76:aeb1df146756 | 214 | ((ALIGN) == DAC_Align_8b_R)) |
mbed_official | 76:aeb1df146756 | 215 | /** |
mbed_official | 76:aeb1df146756 | 216 | * @} |
mbed_official | 76:aeb1df146756 | 217 | */ |
mbed_official | 76:aeb1df146756 | 218 | |
mbed_official | 76:aeb1df146756 | 219 | /** @defgroup DAC_wave_generation |
mbed_official | 76:aeb1df146756 | 220 | * @brief These parameters are only applicable for STM32F072 devices. |
mbed_official | 76:aeb1df146756 | 221 | * @{ |
mbed_official | 76:aeb1df146756 | 222 | */ |
mbed_official | 76:aeb1df146756 | 223 | |
mbed_official | 76:aeb1df146756 | 224 | #define DAC_Wave_Noise ((uint32_t)0x00000040) |
mbed_official | 76:aeb1df146756 | 225 | #define DAC_Wave_Triangle ((uint32_t)0x00000080) |
mbed_official | 76:aeb1df146756 | 226 | #define IS_DAC_WAVE(WAVE) (((WAVE) == DAC_Wave_Noise) || \ |
mbed_official | 76:aeb1df146756 | 227 | ((WAVE) == DAC_Wave_Triangle)) |
mbed_official | 76:aeb1df146756 | 228 | /** |
mbed_official | 76:aeb1df146756 | 229 | * @} |
mbed_official | 76:aeb1df146756 | 230 | */ |
mbed_official | 76:aeb1df146756 | 231 | |
mbed_official | 76:aeb1df146756 | 232 | /** @defgroup DAC_data |
mbed_official | 76:aeb1df146756 | 233 | * @{ |
mbed_official | 76:aeb1df146756 | 234 | */ |
mbed_official | 76:aeb1df146756 | 235 | |
mbed_official | 76:aeb1df146756 | 236 | #define IS_DAC_DATA(DATA) ((DATA) <= 0xFFF0) |
mbed_official | 76:aeb1df146756 | 237 | |
mbed_official | 76:aeb1df146756 | 238 | /** |
mbed_official | 76:aeb1df146756 | 239 | * @} |
mbed_official | 76:aeb1df146756 | 240 | */ |
mbed_official | 76:aeb1df146756 | 241 | |
mbed_official | 76:aeb1df146756 | 242 | /** @defgroup DAC_interrupts_definition |
mbed_official | 76:aeb1df146756 | 243 | * @{ |
mbed_official | 76:aeb1df146756 | 244 | */ |
mbed_official | 76:aeb1df146756 | 245 | |
mbed_official | 76:aeb1df146756 | 246 | #define DAC_IT_DMAUDR DAC_SR_DMAUDR1 |
mbed_official | 76:aeb1df146756 | 247 | #define IS_DAC_IT(IT) (((IT) == DAC_IT_DMAUDR)) |
mbed_official | 76:aeb1df146756 | 248 | |
mbed_official | 76:aeb1df146756 | 249 | /** |
mbed_official | 76:aeb1df146756 | 250 | * @} |
mbed_official | 76:aeb1df146756 | 251 | */ |
mbed_official | 76:aeb1df146756 | 252 | |
mbed_official | 76:aeb1df146756 | 253 | |
mbed_official | 76:aeb1df146756 | 254 | /** @defgroup DAC_flags_definition |
mbed_official | 76:aeb1df146756 | 255 | * @{ |
mbed_official | 76:aeb1df146756 | 256 | */ |
mbed_official | 76:aeb1df146756 | 257 | |
mbed_official | 76:aeb1df146756 | 258 | #define DAC_FLAG_DMAUDR DAC_SR_DMAUDR1 |
mbed_official | 76:aeb1df146756 | 259 | |
mbed_official | 76:aeb1df146756 | 260 | #define IS_DAC_FLAG(FLAG) (((FLAG) == DAC_FLAG_DMAUDR)) |
mbed_official | 76:aeb1df146756 | 261 | |
mbed_official | 76:aeb1df146756 | 262 | /** |
mbed_official | 76:aeb1df146756 | 263 | * @} |
mbed_official | 76:aeb1df146756 | 264 | */ |
mbed_official | 76:aeb1df146756 | 265 | |
mbed_official | 76:aeb1df146756 | 266 | /** |
mbed_official | 76:aeb1df146756 | 267 | * @} |
mbed_official | 76:aeb1df146756 | 268 | */ |
mbed_official | 76:aeb1df146756 | 269 | |
mbed_official | 76:aeb1df146756 | 270 | /* Exported macro ------------------------------------------------------------*/ |
mbed_official | 76:aeb1df146756 | 271 | /* Exported functions ------------------------------------------------------- */ |
mbed_official | 76:aeb1df146756 | 272 | |
mbed_official | 76:aeb1df146756 | 273 | /* Function used to set the DAC configuration to the default reset state *****/ |
mbed_official | 76:aeb1df146756 | 274 | void DAC_DeInit(void); |
mbed_official | 76:aeb1df146756 | 275 | |
mbed_official | 76:aeb1df146756 | 276 | /* DAC channels configuration: trigger, output buffer, data format functions */ |
mbed_official | 76:aeb1df146756 | 277 | void DAC_Init(uint32_t DAC_Channel, DAC_InitTypeDef* DAC_InitStruct); |
mbed_official | 76:aeb1df146756 | 278 | void DAC_StructInit(DAC_InitTypeDef* DAC_InitStruct); |
mbed_official | 76:aeb1df146756 | 279 | void DAC_Cmd(uint32_t DAC_Channel, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 280 | void DAC_SoftwareTriggerCmd(uint32_t DAC_Channel, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 281 | void DAC_DualSoftwareTriggerCmd(FunctionalState NewState); /*!< Only applicable for STM32F072 devices */ |
mbed_official | 76:aeb1df146756 | 282 | void DAC_WaveGenerationCmd(uint32_t DAC_Channel, uint32_t DAC_Wave, FunctionalState NewState); /*!< Only applicable for STM32F072 devices */ |
mbed_official | 76:aeb1df146756 | 283 | void DAC_SetChannel1Data(uint32_t DAC_Align, uint16_t Data); |
mbed_official | 76:aeb1df146756 | 284 | void DAC_SetChannel2Data(uint32_t DAC_Align, uint16_t Data); /*!< Only applicable for STM32F072 devices */ |
mbed_official | 76:aeb1df146756 | 285 | void DAC_SetDualChannelData(uint32_t DAC_Align, uint16_t Data2, uint16_t Data1); /*!< Only applicable for STM32F072 devices */ |
mbed_official | 76:aeb1df146756 | 286 | uint16_t DAC_GetDataOutputValue(uint32_t DAC_Channel); |
mbed_official | 76:aeb1df146756 | 287 | |
mbed_official | 76:aeb1df146756 | 288 | /* DMA management functions ***************************************************/ |
mbed_official | 76:aeb1df146756 | 289 | void DAC_DMACmd(uint32_t DAC_Channel, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 290 | |
mbed_official | 76:aeb1df146756 | 291 | /* Interrupts and flags management functions **********************************/ |
mbed_official | 76:aeb1df146756 | 292 | void DAC_ITConfig(uint32_t DAC_Channel, uint32_t DAC_IT, FunctionalState NewState); |
mbed_official | 76:aeb1df146756 | 293 | FlagStatus DAC_GetFlagStatus(uint32_t DAC_Channel, uint32_t DAC_FLAG); |
mbed_official | 76:aeb1df146756 | 294 | void DAC_ClearFlag(uint32_t DAC_Channel, uint32_t DAC_FLAG); |
mbed_official | 76:aeb1df146756 | 295 | ITStatus DAC_GetITStatus(uint32_t DAC_Channel, uint32_t DAC_IT); |
mbed_official | 76:aeb1df146756 | 296 | void DAC_ClearITPendingBit(uint32_t DAC_Channel, uint32_t DAC_IT); |
mbed_official | 76:aeb1df146756 | 297 | |
mbed_official | 76:aeb1df146756 | 298 | #ifdef __cplusplus |
mbed_official | 76:aeb1df146756 | 299 | } |
mbed_official | 76:aeb1df146756 | 300 | #endif |
mbed_official | 76:aeb1df146756 | 301 | |
mbed_official | 76:aeb1df146756 | 302 | #endif /*__STM32F0XX_DAC_H */ |
mbed_official | 76:aeb1df146756 | 303 | |
mbed_official | 76:aeb1df146756 | 304 | /** |
mbed_official | 76:aeb1df146756 | 305 | * @} |
mbed_official | 76:aeb1df146756 | 306 | */ |
mbed_official | 76:aeb1df146756 | 307 | |
mbed_official | 76:aeb1df146756 | 308 | /** |
mbed_official | 76:aeb1df146756 | 309 | * @} |
mbed_official | 76:aeb1df146756 | 310 | */ |
mbed_official | 76:aeb1df146756 | 311 | |
mbed_official | 76:aeb1df146756 | 312 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |