STM32F0 Standard Peripheral bibliotheek  1.0
ST Microelectronics standard peripheral bibliotheek documentatie voor de STM32F0 familie
 All Data Structures Files Functions Variables Enumerations Enumerator Groups
stm32f0xx_dac.h
Go to the documentation of this file.
1 
29 /* Define to prevent recursive inclusion -------------------------------------*/
30 #ifndef __STM32F0XX_DAC_H
31 #define __STM32F0XX_DAC_H
32 
33 #ifdef __cplusplus
34  extern "C" {
35 #endif
36 
37 /* Includes ------------------------------------------------------------------*/
38 #include "stm32f0xx.h"
39 
48 /* Exported types ------------------------------------------------------------*/
49 
54 typedef struct
55 {
56  uint32_t DAC_Trigger;
59  uint32_t DAC_OutputBuffer;
62 
63 /* Exported constants --------------------------------------------------------*/
64 
73 #define DAC_Trigger_None ((uint32_t)0x00000000)
75 #define DAC_Trigger_T6_TRGO ((uint32_t)0x00000004)
76 #define DAC_Trigger_T3_TRGO ((uint32_t)0x0000000C)
77 #define DAC_Trigger_T15_TRGO ((uint32_t)0x0000001C)
78 #define DAC_Trigger_T2_TRGO ((uint32_t)0x00000024)
79 #define DAC_Trigger_Ext_IT9 ((uint32_t)0x00000034)
80 #define DAC_Trigger_Software ((uint32_t)0x0000003C)
82 #define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_Trigger_None) || \
83  ((TRIGGER) == DAC_Trigger_T6_TRGO) || \
84  ((TRIGGER) == DAC_Trigger_T3_TRGO) || \
85  ((TRIGGER) == DAC_Trigger_T15_TRGO) || \
86  ((TRIGGER) == DAC_Trigger_T2_TRGO) || \
87  ((TRIGGER) == DAC_Trigger_Ext_IT9) || \
88  ((TRIGGER) == DAC_Trigger_Software))
89 
98 #define DAC_OutputBuffer_Enable ((uint32_t)0x00000000)
99 #define DAC_OutputBuffer_Disable DAC_CR_BOFF1
100 #define IS_DAC_OUTPUT_BUFFER_STATE(STATE) (((STATE) == DAC_OutputBuffer_Enable) || \
101  ((STATE) == DAC_OutputBuffer_Disable))
102 
110 #define DAC_Channel_1 ((uint32_t)0x00000000)
111 #define IS_DAC_CHANNEL(CHANNEL) (((CHANNEL) == DAC_Channel_1))
112 
121 #define DAC_Align_12b_R ((uint32_t)0x00000000)
122 #define DAC_Align_12b_L ((uint32_t)0x00000004)
123 #define DAC_Align_8b_R ((uint32_t)0x00000008)
124 #define IS_DAC_ALIGN(ALIGN) (((ALIGN) == DAC_Align_12b_R) || \
125  ((ALIGN) == DAC_Align_12b_L) || \
126  ((ALIGN) == DAC_Align_8b_R))
127 
135 #define IS_DAC_DATA(DATA) ((DATA) <= 0xFFF0)
136 
145 #define DAC_IT_DMAUDR DAC_SR_DMAUDR1
146 #define IS_DAC_IT(IT) (((IT) == DAC_IT_DMAUDR))
147 
157 #define DAC_FLAG_DMAUDR DAC_SR_DMAUDR1
158 
159 #define IS_DAC_FLAG(FLAG) (((FLAG) == DAC_FLAG_DMAUDR))
160 
169 /* Exported macro ------------------------------------------------------------*/
170 /* Exported functions ------------------------------------------------------- */
171 
172 /* Function used to set the DAC configuration to the default reset state *****/
173 void DAC_DeInit(void);
174 
175 /* DAC channels configuration: trigger, output buffer, data format functions */
176 void DAC_Init(uint32_t DAC_Channel, DAC_InitTypeDef* DAC_InitStruct);
177 void DAC_StructInit(DAC_InitTypeDef* DAC_InitStruct);
178 void DAC_Cmd(uint32_t DAC_Channel, FunctionalState NewState);
179 void DAC_SoftwareTriggerCmd(uint32_t DAC_Channel, FunctionalState NewState);
180 void DAC_SetChannel1Data(uint32_t DAC_Align, uint16_t Data);
181 uint16_t DAC_GetDataOutputValue(uint32_t DAC_Channel);
182 
183 /* DMA management functions ***************************************************/
184 void DAC_DMACmd(uint32_t DAC_Channel, FunctionalState NewState);
185 
186 /* Interrupts and flags management functions **********************************/
187 void DAC_ITConfig(uint32_t DAC_Channel, uint32_t DAC_IT, FunctionalState NewState);
188 FlagStatus DAC_GetFlagStatus(uint32_t DAC_Channel, uint32_t DAC_FLAG);
189 void DAC_ClearFlag(uint32_t DAC_Channel, uint32_t DAC_FLAG);
190 ITStatus DAC_GetITStatus(uint32_t DAC_Channel, uint32_t DAC_IT);
191 void DAC_ClearITPendingBit(uint32_t DAC_Channel, uint32_t DAC_IT);
192 
193 #ifdef __cplusplus
194 }
195 #endif
196 
197 #endif /*__STM32F0XX_DAC_H */
198 
207 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/