stm32f30x_dac.h
Go to the documentation of this file.
1 
29 /* Define to prevent recursive inclusion -------------------------------------*/
30 #ifndef __STM32F30x_DAC_H
31 #define __STM32F30x_DAC_H
32 
33 #ifdef __cplusplus
34  extern "C" {
35 #endif
36 
37 /* Includes ------------------------------------------------------------------*/
38 #include "stm32f30x.h"
39 
48 /* Exported types ------------------------------------------------------------*/
49 #define DAC_CR_DMAUDRIE ((uint32_t)0x00002000)
55 typedef struct
56 {
57  uint32_t DAC_Trigger;
60  uint32_t DAC_WaveGeneration;
64  uint32_t DAC_LFSRUnmask_TriangleAmplitude;
68  uint32_t DAC_Buffer_Switch;
72 
73 /* Exported constants --------------------------------------------------------*/
74 
79 #define IS_DAC_ALL_PERIPH(PERIPH) (((PERIPH) == DAC1) || \
80  ((PERIPH) == DAC2))
81 
82 #define IS_DAC_LIST1_PERIPH(PERIPH) (((PERIPH) == DAC1))
83 
88 #define DAC_Trigger_None ((uint32_t)0x00000000)
90 #define DAC_Trigger_T6_TRGO ((uint32_t)0x00000004)
91 #define DAC_Trigger_T3_TRGO ((uint32_t)0x0000000C)
92 #define DAC_Trigger_T8_TRGO ((uint32_t)0x0000000C)
93 #define DAC_Trigger_T7_TRGO ((uint32_t)0x00000014)
94 #define DAC_Trigger_T15_TRGO ((uint32_t)0x0000001C)
95 #define DAC_Trigger_HRTIM1_DACTRG1 ((uint32_t)0x0000001C)
96 #define DAC_Trigger_T2_TRGO ((uint32_t)0x00000024)
97 #define DAC_Trigger_T4_TRGO ((uint32_t)0x0000002C)
98 #define DAC_Trigger_HRTIM1_DACTRG2 ((uint32_t)0x0000002C)
99 #define DAC_Trigger_HRTIM1_DACTRG3 ((uint32_t)0x0000002C)
100 #define DAC_Trigger_Ext_IT9 ((uint32_t)0x00000034)
101 #define DAC_Trigger_Software ((uint32_t)0x0000003C)
103 #define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_Trigger_None) || \
104  ((TRIGGER) == DAC_Trigger_T6_TRGO) || \
105  ((TRIGGER) == DAC_Trigger_T3_TRGO) || \
106  ((TRIGGER) == DAC_Trigger_T8_TRGO) || \
107  ((TRIGGER) == DAC_Trigger_T7_TRGO) || \
108  ((TRIGGER) == DAC_Trigger_T15_TRGO) || \
109  ((TRIGGER) == DAC_Trigger_HRTIM1_DACTRG1)|| \
110  ((TRIGGER) == DAC_Trigger_T2_TRGO) || \
111  ((TRIGGER) == DAC_Trigger_T4_TRGO) || \
112  ((TRIGGER) == DAC_Trigger_HRTIM1_DACTRG2)|| \
113  ((TRIGGER) == DAC_Trigger_HRTIM1_DACTRG3)|| \
114  ((TRIGGER) == DAC_Trigger_Ext_IT9) || \
115  ((TRIGGER) == DAC_Trigger_Software))
116 
125 #define DAC_WaveGeneration_None ((uint32_t)0x00000000)
126 #define DAC_WaveGeneration_Noise ((uint32_t)0x00000040)
127 #define DAC_WaveGeneration_Triangle ((uint32_t)0x00000080)
129 #define IS_DAC_GENERATE_WAVE(WAVE) (((WAVE) == DAC_WaveGeneration_None) || \
130  ((WAVE) == DAC_WaveGeneration_Noise) || \
131  ((WAVE) == DAC_WaveGeneration_Triangle))
132 
140 #define DAC_LFSRUnmask_Bit0 ((uint32_t)0x00000000)
141 #define DAC_LFSRUnmask_Bits1_0 ((uint32_t)0x00000100)
142 #define DAC_LFSRUnmask_Bits2_0 ((uint32_t)0x00000200)
143 #define DAC_LFSRUnmask_Bits3_0 ((uint32_t)0x00000300)
144 #define DAC_LFSRUnmask_Bits4_0 ((uint32_t)0x00000400)
145 #define DAC_LFSRUnmask_Bits5_0 ((uint32_t)0x00000500)
146 #define DAC_LFSRUnmask_Bits6_0 ((uint32_t)0x00000600)
147 #define DAC_LFSRUnmask_Bits7_0 ((uint32_t)0x00000700)
148 #define DAC_LFSRUnmask_Bits8_0 ((uint32_t)0x00000800)
149 #define DAC_LFSRUnmask_Bits9_0 ((uint32_t)0x00000900)
150 #define DAC_LFSRUnmask_Bits10_0 ((uint32_t)0x00000A00)
151 #define DAC_LFSRUnmask_Bits11_0 ((uint32_t)0x00000B00)
152 #define DAC_TriangleAmplitude_1 ((uint32_t)0x00000000)
153 #define DAC_TriangleAmplitude_3 ((uint32_t)0x00000100)
154 #define DAC_TriangleAmplitude_7 ((uint32_t)0x00000200)
155 #define DAC_TriangleAmplitude_15 ((uint32_t)0x00000300)
156 #define DAC_TriangleAmplitude_31 ((uint32_t)0x00000400)
157 #define DAC_TriangleAmplitude_63 ((uint32_t)0x00000500)
158 #define DAC_TriangleAmplitude_127 ((uint32_t)0x00000600)
159 #define DAC_TriangleAmplitude_255 ((uint32_t)0x00000700)
160 #define DAC_TriangleAmplitude_511 ((uint32_t)0x00000800)
161 #define DAC_TriangleAmplitude_1023 ((uint32_t)0x00000900)
162 #define DAC_TriangleAmplitude_2047 ((uint32_t)0x00000A00)
163 #define DAC_TriangleAmplitude_4095 ((uint32_t)0x00000B00)
165 #define IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(VALUE) (((VALUE) == DAC_LFSRUnmask_Bit0) || \
166  ((VALUE) == DAC_LFSRUnmask_Bits1_0) || \
167  ((VALUE) == DAC_LFSRUnmask_Bits2_0) || \
168  ((VALUE) == DAC_LFSRUnmask_Bits3_0) || \
169  ((VALUE) == DAC_LFSRUnmask_Bits4_0) || \
170  ((VALUE) == DAC_LFSRUnmask_Bits5_0) || \
171  ((VALUE) == DAC_LFSRUnmask_Bits6_0) || \
172  ((VALUE) == DAC_LFSRUnmask_Bits7_0) || \
173  ((VALUE) == DAC_LFSRUnmask_Bits8_0) || \
174  ((VALUE) == DAC_LFSRUnmask_Bits9_0) || \
175  ((VALUE) == DAC_LFSRUnmask_Bits10_0) || \
176  ((VALUE) == DAC_LFSRUnmask_Bits11_0) || \
177  ((VALUE) == DAC_TriangleAmplitude_1) || \
178  ((VALUE) == DAC_TriangleAmplitude_3) || \
179  ((VALUE) == DAC_TriangleAmplitude_7) || \
180  ((VALUE) == DAC_TriangleAmplitude_15) || \
181  ((VALUE) == DAC_TriangleAmplitude_31) || \
182  ((VALUE) == DAC_TriangleAmplitude_63) || \
183  ((VALUE) == DAC_TriangleAmplitude_127) || \
184  ((VALUE) == DAC_TriangleAmplitude_255) || \
185  ((VALUE) == DAC_TriangleAmplitude_511) || \
186  ((VALUE) == DAC_TriangleAmplitude_1023) || \
187  ((VALUE) == DAC_TriangleAmplitude_2047) || \
188  ((VALUE) == DAC_TriangleAmplitude_4095))
189 
197 #define DAC_BufferSwitch_Disable ((uint32_t)0x00000000)
198 #define DAC_BufferSwitch_Enable ((uint32_t)0x00000002)
199 
200 #define IS_DAC_BUFFER_SWITCH_STATE(STATE) (((STATE) == DAC_BufferSwitch_Enable) || \
201  ((STATE) == DAC_BufferSwitch_Disable))
202 
209 #define DAC_Channel_1 ((uint32_t)0x00000000)
210 #define DAC_Channel_2 ((uint32_t)0x00000010)
212 #define IS_DAC_CHANNEL(CHANNEL) (((CHANNEL) == DAC_Channel_1) || \
213  ((CHANNEL) == DAC_Channel_2))
214 
222 #define DAC_Align_12b_R ((uint32_t)0x00000000)
223 #define DAC_Align_12b_L ((uint32_t)0x00000004)
224 #define DAC_Align_8b_R ((uint32_t)0x00000008)
226 #define IS_DAC_ALIGN(ALIGN) (((ALIGN) == DAC_Align_12b_R) || \
227  ((ALIGN) == DAC_Align_12b_L) || \
228  ((ALIGN) == DAC_Align_8b_R))
229 
237 #define DAC_Wave_Noise ((uint32_t)0x00000040)
238 #define DAC_Wave_Triangle ((uint32_t)0x00000080)
240 #define IS_DAC_WAVE(WAVE) (((WAVE) == DAC_Wave_Noise) || \
241  ((WAVE) == DAC_Wave_Triangle))
242 
250 #define IS_DAC_DATA(DATA) ((DATA) <= 0xFFF0)
258 #define DAC_IT_DMAUDR ((uint32_t)0x00002000)
259 #define IS_DAC_IT(IT) (((IT) == DAC_IT_DMAUDR))
269 #define DAC_FLAG_DMAUDR ((uint32_t)0x00002000)
270 #define IS_DAC_FLAG(FLAG) (((FLAG) == DAC_FLAG_DMAUDR))
280 /* Exported macro ------------------------------------------------------------*/
281 /* Exported functions --------------------------------------------------------*/
282 
283 /* Function used to set the DAC configuration to the default reset state *****/
284 void DAC_DeInit(DAC_TypeDef* DACx);
285 
286 /* DAC channels configuration: trigger, output buffer, data format functions */
287 void DAC_Init(DAC_TypeDef* DACx, uint32_t DAC_Channel, DAC_InitTypeDef* DAC_InitStruct);
288 void DAC_StructInit(DAC_InitTypeDef* DAC_InitStruct);
289 void DAC_Cmd(DAC_TypeDef* DACx, uint32_t DAC_Channel, FunctionalState NewState);
290 void DAC_SoftwareTriggerCmd(DAC_TypeDef* DACx, uint32_t DAC_Channel, FunctionalState NewState);
292 void DAC_WaveGenerationCmd(DAC_TypeDef* DACx, uint32_t DAC_Channel, uint32_t DAC_Wave, FunctionalState NewState);
293 void DAC_SetChannel1Data(DAC_TypeDef* DACx, uint32_t DAC_Align, uint16_t Data);
294 void DAC_SetChannel2Data(DAC_TypeDef* DACx, uint32_t DAC_Align, uint16_t Data);
295 void DAC_SetDualChannelData(DAC_TypeDef* DACx, uint32_t DAC_Align, uint16_t Data2, uint16_t Data1);
296 uint16_t DAC_GetDataOutputValue(DAC_TypeDef* DACx, uint32_t DAC_Channel);
297 
298 /* DMA management functions ***************************************************/
299 void DAC_DMACmd(DAC_TypeDef* DACx, uint32_t DAC_Channel, FunctionalState NewState);
300 
301 /* Interrupts and flags management functions **********************************/
302 void DAC_ITConfig(DAC_TypeDef* DACx, uint32_t DAC_Channel, uint32_t DAC_IT, FunctionalState NewState);
303 FlagStatus DAC_GetFlagStatus(DAC_TypeDef* DACx, uint32_t DAC_Channel, uint32_t DAC_FLAG);
304 void DAC_ClearFlag(DAC_TypeDef* DACx, uint32_t DAC_Channel, uint32_t DAC_FLAG);
305 ITStatus DAC_GetITStatus(DAC_TypeDef* DACx, uint32_t DAC_Channel, uint32_t DAC_IT);
306 void DAC_ClearITPendingBit(DAC_TypeDef* DACx, uint32_t DAC_Channel, uint32_t DAC_IT);
307 
308 #ifdef __cplusplus
309 }
310 #endif
311 
312 #endif /*__STM32F30x_DAC_H */
313 
322 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
FlagStatus
Definition: stm32f4xx.h:706
uint32_t DAC_Buffer_Switch
Definition: stm32f30x_dac.h:68
FunctionalState
Definition: stm32f4xx.h:708
void DAC_SoftwareTriggerCmd(DAC_TypeDef *DACx, uint32_t DAC_Channel, FunctionalState NewState)
Enables or disables the selected DAC channel software trigger.
void DAC_StructInit(DAC_InitTypeDef *DAC_InitStruct)
Fills each DAC_InitStruct member with its default value.
FlagStatus DAC_GetFlagStatus(DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t DAC_FLAG)
Checks whether the specified DAC flag is set or not.
Digital to Analog Converter.
Definition: stm32f4xx.h:854
void DAC_ClearITPendingBit(DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t DAC_IT)
Clears the DAC channel&#39;s interrupt pending bits.
void DAC_Cmd(DAC_TypeDef *DACx, uint32_t DAC_Channel, FunctionalState NewState)
Enables or disables the specified DAC channel.
void DAC_DMACmd(DAC_TypeDef *DACx, uint32_t DAC_Channel, FunctionalState NewState)
Enables or disables the specified DAC channel DMA request. When enabled DMA1 is generated when an ext...
void DAC_ClearFlag(DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t DAC_FLAG)
Clears the DAC channel&#39;s pending flags.
enum FlagStatus ITStatus
void DAC_SetChannel1Data(DAC_TypeDef *DACx, uint32_t DAC_Align, uint16_t Data)
Set the specified data holding register value for DAC channel1.
void DAC_DualSoftwareTriggerCmd(DAC_TypeDef *DACx, FunctionalState NewState)
Enables or disables simultaneously the two DAC channels software triggers.
void DAC_Init(DAC_TypeDef *DACx, uint32_t DAC_Channel, DAC_InitTypeDef *DAC_InitStruct)
Initializes the DAC peripheral according to the specified parameters in the DAC_InitStruct.
void DAC_SetChannel2Data(DAC_TypeDef *DACx, uint32_t DAC_Align, uint16_t Data)
Set the specified data holding register value for DAC channel2.
void DAC_WaveGenerationCmd(DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t DAC_Wave, FunctionalState NewState)
Enables or disables the selected DAC channel wave generation.
void DAC_DeInit(DAC_TypeDef *DACx)
Deinitializes the DAC peripheral registers to their default reset values.
uint16_t DAC_GetDataOutputValue(DAC_TypeDef *DACx, uint32_t DAC_Channel)
Returns the last data output value of the selected DAC channel.
ITStatus DAC_GetITStatus(DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t DAC_IT)
Checks whether the specified DAC interrupt has occurred or not.
DAC Init structure definition.
Definition: stm32f4xx_dac.h:54
void DAC_SetDualChannelData(DAC_TypeDef *DACx, uint32_t DAC_Align, uint16_t Data2, uint16_t Data1)
Set the specified data holding register value for dual channel DAC.
void DAC_ITConfig(DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t DAC_IT, FunctionalState NewState)
Enables or disables the specified DAC interrupts.


rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Oct 24 2019 03:17:19