stm32f10x_dac.h
Go to the documentation of this file.
1 
23 /* Define to prevent recursive inclusion -------------------------------------*/
24 #ifndef __STM32F10x_DAC_H
25 #define __STM32F10x_DAC_H
26 
27 #ifdef __cplusplus
28  extern "C" {
29 #endif
30 
31 /* Includes ------------------------------------------------------------------*/
32 #include "stm32f10x.h"
33 
50 typedef struct
51 {
52  uint32_t DAC_Trigger;
55  uint32_t DAC_WaveGeneration;
59  uint32_t DAC_LFSRUnmask_TriangleAmplitude;
63  uint32_t DAC_OutputBuffer;
66 
79 #define DAC_Trigger_None ((uint32_t)0x00000000)
81 #define DAC_Trigger_T6_TRGO ((uint32_t)0x00000004)
82 #define DAC_Trigger_T8_TRGO ((uint32_t)0x0000000C)
84 #define DAC_Trigger_T3_TRGO ((uint32_t)0x0000000C)
86 #define DAC_Trigger_T7_TRGO ((uint32_t)0x00000014)
87 #define DAC_Trigger_T5_TRGO ((uint32_t)0x0000001C)
88 #define DAC_Trigger_T15_TRGO ((uint32_t)0x0000001C)
90 #define DAC_Trigger_T2_TRGO ((uint32_t)0x00000024)
91 #define DAC_Trigger_T4_TRGO ((uint32_t)0x0000002C)
92 #define DAC_Trigger_Ext_IT9 ((uint32_t)0x00000034)
93 #define DAC_Trigger_Software ((uint32_t)0x0000003C)
95 #define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_Trigger_None) || \
96  ((TRIGGER) == DAC_Trigger_T6_TRGO) || \
97  ((TRIGGER) == DAC_Trigger_T8_TRGO) || \
98  ((TRIGGER) == DAC_Trigger_T7_TRGO) || \
99  ((TRIGGER) == DAC_Trigger_T5_TRGO) || \
100  ((TRIGGER) == DAC_Trigger_T2_TRGO) || \
101  ((TRIGGER) == DAC_Trigger_T4_TRGO) || \
102  ((TRIGGER) == DAC_Trigger_Ext_IT9) || \
103  ((TRIGGER) == DAC_Trigger_Software))
104 
113 #define DAC_WaveGeneration_None ((uint32_t)0x00000000)
114 #define DAC_WaveGeneration_Noise ((uint32_t)0x00000040)
115 #define DAC_WaveGeneration_Triangle ((uint32_t)0x00000080)
116 #define IS_DAC_GENERATE_WAVE(WAVE) (((WAVE) == DAC_WaveGeneration_None) || \
117  ((WAVE) == DAC_WaveGeneration_Noise) || \
118  ((WAVE) == DAC_WaveGeneration_Triangle))
127 #define DAC_LFSRUnmask_Bit0 ((uint32_t)0x00000000)
128 #define DAC_LFSRUnmask_Bits1_0 ((uint32_t)0x00000100)
129 #define DAC_LFSRUnmask_Bits2_0 ((uint32_t)0x00000200)
130 #define DAC_LFSRUnmask_Bits3_0 ((uint32_t)0x00000300)
131 #define DAC_LFSRUnmask_Bits4_0 ((uint32_t)0x00000400)
132 #define DAC_LFSRUnmask_Bits5_0 ((uint32_t)0x00000500)
133 #define DAC_LFSRUnmask_Bits6_0 ((uint32_t)0x00000600)
134 #define DAC_LFSRUnmask_Bits7_0 ((uint32_t)0x00000700)
135 #define DAC_LFSRUnmask_Bits8_0 ((uint32_t)0x00000800)
136 #define DAC_LFSRUnmask_Bits9_0 ((uint32_t)0x00000900)
137 #define DAC_LFSRUnmask_Bits10_0 ((uint32_t)0x00000A00)
138 #define DAC_LFSRUnmask_Bits11_0 ((uint32_t)0x00000B00)
139 #define DAC_TriangleAmplitude_1 ((uint32_t)0x00000000)
140 #define DAC_TriangleAmplitude_3 ((uint32_t)0x00000100)
141 #define DAC_TriangleAmplitude_7 ((uint32_t)0x00000200)
142 #define DAC_TriangleAmplitude_15 ((uint32_t)0x00000300)
143 #define DAC_TriangleAmplitude_31 ((uint32_t)0x00000400)
144 #define DAC_TriangleAmplitude_63 ((uint32_t)0x00000500)
145 #define DAC_TriangleAmplitude_127 ((uint32_t)0x00000600)
146 #define DAC_TriangleAmplitude_255 ((uint32_t)0x00000700)
147 #define DAC_TriangleAmplitude_511 ((uint32_t)0x00000800)
148 #define DAC_TriangleAmplitude_1023 ((uint32_t)0x00000900)
149 #define DAC_TriangleAmplitude_2047 ((uint32_t)0x00000A00)
150 #define DAC_TriangleAmplitude_4095 ((uint32_t)0x00000B00)
152 #define IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(VALUE) (((VALUE) == DAC_LFSRUnmask_Bit0) || \
153  ((VALUE) == DAC_LFSRUnmask_Bits1_0) || \
154  ((VALUE) == DAC_LFSRUnmask_Bits2_0) || \
155  ((VALUE) == DAC_LFSRUnmask_Bits3_0) || \
156  ((VALUE) == DAC_LFSRUnmask_Bits4_0) || \
157  ((VALUE) == DAC_LFSRUnmask_Bits5_0) || \
158  ((VALUE) == DAC_LFSRUnmask_Bits6_0) || \
159  ((VALUE) == DAC_LFSRUnmask_Bits7_0) || \
160  ((VALUE) == DAC_LFSRUnmask_Bits8_0) || \
161  ((VALUE) == DAC_LFSRUnmask_Bits9_0) || \
162  ((VALUE) == DAC_LFSRUnmask_Bits10_0) || \
163  ((VALUE) == DAC_LFSRUnmask_Bits11_0) || \
164  ((VALUE) == DAC_TriangleAmplitude_1) || \
165  ((VALUE) == DAC_TriangleAmplitude_3) || \
166  ((VALUE) == DAC_TriangleAmplitude_7) || \
167  ((VALUE) == DAC_TriangleAmplitude_15) || \
168  ((VALUE) == DAC_TriangleAmplitude_31) || \
169  ((VALUE) == DAC_TriangleAmplitude_63) || \
170  ((VALUE) == DAC_TriangleAmplitude_127) || \
171  ((VALUE) == DAC_TriangleAmplitude_255) || \
172  ((VALUE) == DAC_TriangleAmplitude_511) || \
173  ((VALUE) == DAC_TriangleAmplitude_1023) || \
174  ((VALUE) == DAC_TriangleAmplitude_2047) || \
175  ((VALUE) == DAC_TriangleAmplitude_4095))
176 
184 #define DAC_OutputBuffer_Enable ((uint32_t)0x00000000)
185 #define DAC_OutputBuffer_Disable ((uint32_t)0x00000002)
186 #define IS_DAC_OUTPUT_BUFFER_STATE(STATE) (((STATE) == DAC_OutputBuffer_Enable) || \
187  ((STATE) == DAC_OutputBuffer_Disable))
196 #define DAC_Channel_1 ((uint32_t)0x00000000)
197 #define DAC_Channel_2 ((uint32_t)0x00000010)
198 #define IS_DAC_CHANNEL(CHANNEL) (((CHANNEL) == DAC_Channel_1) || \
199  ((CHANNEL) == DAC_Channel_2))
208 #define DAC_Align_12b_R ((uint32_t)0x00000000)
209 #define DAC_Align_12b_L ((uint32_t)0x00000004)
210 #define DAC_Align_8b_R ((uint32_t)0x00000008)
211 #define IS_DAC_ALIGN(ALIGN) (((ALIGN) == DAC_Align_12b_R) || \
212  ((ALIGN) == DAC_Align_12b_L) || \
213  ((ALIGN) == DAC_Align_8b_R))
222 #define DAC_Wave_Noise ((uint32_t)0x00000040)
223 #define DAC_Wave_Triangle ((uint32_t)0x00000080)
224 #define IS_DAC_WAVE(WAVE) (((WAVE) == DAC_Wave_Noise) || \
225  ((WAVE) == DAC_Wave_Triangle))
234 #define IS_DAC_DATA(DATA) ((DATA) <= 0xFFF0)
235 
238 #if defined (STM32F10X_LD_VL) || defined (STM32F10X_MD_VL) || defined (STM32F10X_HD_VL)
239 
243 #define DAC_IT_DMAUDR ((uint32_t)0x00002000)
244 #define IS_DAC_IT(IT) (((IT) == DAC_IT_DMAUDR))
245 
254 #define DAC_FLAG_DMAUDR ((uint32_t)0x00002000)
255 #define IS_DAC_FLAG(FLAG) (((FLAG) == DAC_FLAG_DMAUDR))
256 
260 #endif
261 
278 void DAC_DeInit(void);
279 void DAC_Init(uint32_t DAC_Channel, DAC_InitTypeDef* DAC_InitStruct);
280 void DAC_StructInit(DAC_InitTypeDef* DAC_InitStruct);
281 void DAC_Cmd(uint32_t DAC_Channel, FunctionalState NewState);
282 #if defined (STM32F10X_LD_VL) || defined (STM32F10X_MD_VL) || defined (STM32F10X_HD_VL)
283 void DAC_ITConfig(uint32_t DAC_Channel, uint32_t DAC_IT, FunctionalState NewState);
284 #endif
285 void DAC_DMACmd(uint32_t DAC_Channel, FunctionalState NewState);
286 void DAC_SoftwareTriggerCmd(uint32_t DAC_Channel, FunctionalState NewState);
288 void DAC_WaveGenerationCmd(uint32_t DAC_Channel, uint32_t DAC_Wave, FunctionalState NewState);
289 void DAC_SetChannel1Data(uint32_t DAC_Align, uint16_t Data);
290 void DAC_SetChannel2Data(uint32_t DAC_Align, uint16_t Data);
291 void DAC_SetDualChannelData(uint32_t DAC_Align, uint16_t Data2, uint16_t Data1);
292 uint16_t DAC_GetDataOutputValue(uint32_t DAC_Channel);
293 #if defined (STM32F10X_LD_VL) || defined (STM32F10X_MD_VL) || defined (STM32F10X_HD_VL)
294 FlagStatus DAC_GetFlagStatus(uint32_t DAC_Channel, uint32_t DAC_FLAG);
295 void DAC_ClearFlag(uint32_t DAC_Channel, uint32_t DAC_FLAG);
296 ITStatus DAC_GetITStatus(uint32_t DAC_Channel, uint32_t DAC_IT);
297 void DAC_ClearITPendingBit(uint32_t DAC_Channel, uint32_t DAC_IT);
298 #endif
299 
300 #ifdef __cplusplus
301 }
302 #endif
303 
304 #endif /*__STM32F10x_DAC_H */
305 
317 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
FlagStatus
Definition: stm32f4xx.h:706
void DAC_ITConfig(uint32_t DAC_Channel, uint32_t DAC_IT, FunctionalState NewState)
Enables or disables the specified DAC interrupts.
FlagStatus DAC_GetFlagStatus(uint32_t DAC_Channel, uint32_t DAC_FLAG)
Checks whether the specified DAC flag is set or not.
void DAC_DualSoftwareTriggerCmd(FunctionalState NewState)
Enables or disables simultaneously the two DAC channels software triggers.
void DAC_StructInit(DAC_InitTypeDef *DAC_InitStruct)
Fills each DAC_InitStruct member with its default value.
FunctionalState
Definition: stm32f4xx.h:708
uint16_t DAC_GetDataOutputValue(uint32_t DAC_Channel)
Returns the last data output value of the selected DAC channel.
void DAC_ClearFlag(uint32_t DAC_Channel, uint32_t DAC_FLAG)
Clears the DAC channel&#39;s pending flags.
void DAC_DeInit(void)
Deinitializes the DAC peripheral registers to their default reset values.
void DAC_SoftwareTriggerCmd(uint32_t DAC_Channel, FunctionalState NewState)
Enables or disables the selected DAC channel software trigger.
void DAC_DMACmd(uint32_t DAC_Channel, FunctionalState NewState)
Enables or disables the specified DAC channel DMA request.
void DAC_Cmd(uint32_t DAC_Channel, FunctionalState NewState)
Enables or disables the specified DAC channel.
enum FlagStatus ITStatus
void DAC_WaveGenerationCmd(uint32_t DAC_Channel, uint32_t DAC_Wave, FunctionalState NewState)
Enables or disables the selected DAC channel wave generation.
void DAC_SetDualChannelData(uint32_t DAC_Align, uint16_t Data2, uint16_t Data1)
Set the specified data holding register value for dual channel DAC.
ITStatus DAC_GetITStatus(uint32_t DAC_Channel, uint32_t DAC_IT)
Checks whether the specified DAC interrupt has occurred or not.
void DAC_Init(uint32_t DAC_Channel, DAC_InitTypeDef *DAC_InitStruct)
Initializes the DAC peripheral according to the specified parameters in the DAC_InitStruct.
DAC Init structure definition.
Definition: stm32f4xx_dac.h:54
CMSIS Cortex-M3 Device Peripheral Access Layer Header File. This file contains all the peripheral reg...
void DAC_SetChannel2Data(uint32_t DAC_Align, uint16_t Data)
Set the specified data holding register value for DAC channel2.
void DAC_SetChannel1Data(uint32_t DAC_Align, uint16_t Data)
Set the specified data holding register value for DAC channel1.
void DAC_ClearITPendingBit(uint32_t DAC_Channel, uint32_t DAC_IT)
Clears the DAC channel&#39;s interrupt pending bits.


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Apr 15 2021 05:07:48