OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [Common/] [drivers/] [ST/] [STM32F10xFWLib/] [inc/] [stm32f10x_dac.h] - Blame information for rev 867

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 608 jeremybenn
/**
2
  ******************************************************************************
3
  * @file  stm32f10x_dac.h
4
  * @author  MCD Application Team
5
  * @version  V3.0.0
6
  * @date  04/06/2009
7
  * @brief  This file contains all the functions prototypes for the DAC firmware
8
  *         library.
9
  ******************************************************************************
10
  * @copy
11
  *
12
  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
13
  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
14
  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
15
  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
16
  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
17
  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
18
  *
19
  * <h2><center>&copy; COPYRIGHT 2009 STMicroelectronics</center></h2>
20
  */
21
 
22
/* Define to prevent recursive inclusion -------------------------------------*/
23
#ifndef __STM32F10x_DAC_H
24
#define __STM32F10x_DAC_H
25
 
26
/* Includes ------------------------------------------------------------------*/
27
#include "stm32f10x.h"
28
 
29
/** @addtogroup StdPeriph_Driver
30
  * @{
31
  */
32
 
33
/** @addtogroup DAC
34
  * @{
35
  */
36
 
37
/** @defgroup DAC_Exported_Types
38
  * @{
39
  */
40
 
41
/**
42
  * @brief  DAC Init structure definition
43
  */
44
 
45
typedef struct
46
{
47
  uint32_t DAC_Trigger;
48
  uint32_t DAC_WaveGeneration;
49
  uint32_t DAC_LFSRUnmask_TriangleAmplitude;
50
  uint32_t DAC_OutputBuffer;
51
}DAC_InitTypeDef;
52
 
53
/**
54
  * @}
55
  */
56
 
57
/** @defgroup DAC_Exported_Constants
58
  * @{
59
  */
60
 
61
/** @defgroup DAC_trigger_selection
62
  * @{
63
  */
64
 
65
#define DAC_Trigger_None                   ((uint32_t)0x00000000)
66
#define DAC_Trigger_T6_TRGO                ((uint32_t)0x00000004)
67
#define DAC_Trigger_T8_TRGO                ((uint32_t)0x0000000C)
68
#define DAC_Trigger_T7_TRGO                ((uint32_t)0x00000014)
69
#define DAC_Trigger_T5_TRGO                ((uint32_t)0x0000001C)
70
#define DAC_Trigger_T2_TRGO                ((uint32_t)0x00000024)
71
#define DAC_Trigger_T4_TRGO                ((uint32_t)0x0000002C)
72
#define DAC_Trigger_Ext_IT9                ((uint32_t)0x00000034)
73
#define DAC_Trigger_Software               ((uint32_t)0x0000003C)
74
 
75
#define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_Trigger_None) || \
76
                                 ((TRIGGER) == DAC_Trigger_T6_TRGO) || \
77
                                 ((TRIGGER) == DAC_Trigger_T8_TRGO) || \
78
                                 ((TRIGGER) == DAC_Trigger_T7_TRGO) || \
79
                                 ((TRIGGER) == DAC_Trigger_T5_TRGO) || \
80
                                 ((TRIGGER) == DAC_Trigger_T2_TRGO) || \
81
                                 ((TRIGGER) == DAC_Trigger_T4_TRGO) || \
82
                                 ((TRIGGER) == DAC_Trigger_Ext_IT9) || \
83
                                 ((TRIGGER) == DAC_Trigger_Software))
84
 
85
/**
86
  * @}
87
  */
88
 
89
/** @defgroup DAC_wave_generation
90
  * @{
91
  */
92
 
93
#define DAC_WaveGeneration_None            ((uint32_t)0x00000000)
94
#define DAC_WaveGeneration_Noise           ((uint32_t)0x00000040)
95
#define DAC_WaveGeneration_Triangle        ((uint32_t)0x00000080)
96
#define IS_DAC_GENERATE_WAVE(WAVE) (((WAVE) == DAC_WaveGeneration_None) || \
97
                                    ((WAVE) == DAC_WaveGeneration_Noise) || \
98
                                    ((WAVE) == DAC_WaveGeneration_Triangle))
99
/**
100
  * @}
101
  */
102
 
103
/** @defgroup DAC_noise_wave_generation_mask_triangle_wave_generation_max_amplitude
104
  * @{
105
  */
106
 
107
#define DAC_LFSRUnmask_Bit0                ((uint32_t)0x00000000)
108
#define DAC_LFSRUnmask_Bits1_0             ((uint32_t)0x00000100)
109
#define DAC_LFSRUnmask_Bits2_0             ((uint32_t)0x00000200)
110
#define DAC_LFSRUnmask_Bits3_0             ((uint32_t)0x00000300)
111
#define DAC_LFSRUnmask_Bits4_0             ((uint32_t)0x00000400)
112
#define DAC_LFSRUnmask_Bits5_0             ((uint32_t)0x00000500)
113
#define DAC_LFSRUnmask_Bits6_0             ((uint32_t)0x00000600)
114
#define DAC_LFSRUnmask_Bits7_0             ((uint32_t)0x00000700)
115
#define DAC_LFSRUnmask_Bits8_0             ((uint32_t)0x00000800)
116
#define DAC_LFSRUnmask_Bits9_0             ((uint32_t)0x00000900)
117
#define DAC_LFSRUnmask_Bits10_0            ((uint32_t)0x00000A00)
118
#define DAC_LFSRUnmask_Bits11_0            ((uint32_t)0x00000B00)
119
#define DAC_TriangleAmplitude_1            ((uint32_t)0x00000000)
120
#define DAC_TriangleAmplitude_3            ((uint32_t)0x00000100)
121
#define DAC_TriangleAmplitude_7            ((uint32_t)0x00000200)
122
#define DAC_TriangleAmplitude_15           ((uint32_t)0x00000300)
123
#define DAC_TriangleAmplitude_31           ((uint32_t)0x00000400)
124
#define DAC_TriangleAmplitude_63           ((uint32_t)0x00000500)
125
#define DAC_TriangleAmplitude_127          ((uint32_t)0x00000600)
126
#define DAC_TriangleAmplitude_255          ((uint32_t)0x00000700)
127
#define DAC_TriangleAmplitude_511          ((uint32_t)0x00000800)
128
#define DAC_TriangleAmplitude_1023         ((uint32_t)0x00000900)
129
#define DAC_TriangleAmplitude_2047         ((uint32_t)0x00000A00)
130
#define DAC_TriangleAmplitude_4095         ((uint32_t)0x00000B00)
131
 
132
#define IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(VALUE) (((VALUE) == DAC_LFSRUnmask_Bit0) || \
133
                                                      ((VALUE) == DAC_LFSRUnmask_Bits1_0) || \
134
                                                      ((VALUE) == DAC_LFSRUnmask_Bits2_0) || \
135
                                                      ((VALUE) == DAC_LFSRUnmask_Bits3_0) || \
136
                                                      ((VALUE) == DAC_LFSRUnmask_Bits4_0) || \
137
                                                      ((VALUE) == DAC_LFSRUnmask_Bits5_0) || \
138
                                                      ((VALUE) == DAC_LFSRUnmask_Bits6_0) || \
139
                                                      ((VALUE) == DAC_LFSRUnmask_Bits7_0) || \
140
                                                      ((VALUE) == DAC_LFSRUnmask_Bits8_0) || \
141
                                                      ((VALUE) == DAC_LFSRUnmask_Bits9_0) || \
142
                                                      ((VALUE) == DAC_LFSRUnmask_Bits10_0) || \
143
                                                      ((VALUE) == DAC_LFSRUnmask_Bits11_0) || \
144
                                                      ((VALUE) == DAC_TriangleAmplitude_1) || \
145
                                                      ((VALUE) == DAC_TriangleAmplitude_3) || \
146
                                                      ((VALUE) == DAC_TriangleAmplitude_7) || \
147
                                                      ((VALUE) == DAC_TriangleAmplitude_15) || \
148
                                                      ((VALUE) == DAC_TriangleAmplitude_31) || \
149
                                                      ((VALUE) == DAC_TriangleAmplitude_63) || \
150
                                                      ((VALUE) == DAC_TriangleAmplitude_127) || \
151
                                                      ((VALUE) == DAC_TriangleAmplitude_255) || \
152
                                                      ((VALUE) == DAC_TriangleAmplitude_511) || \
153
                                                      ((VALUE) == DAC_TriangleAmplitude_1023) || \
154
                                                      ((VALUE) == DAC_TriangleAmplitude_2047) || \
155
                                                      ((VALUE) == DAC_TriangleAmplitude_4095))
156
/**
157
  * @}
158
  */
159
 
160
/** @defgroup DAC_output_buffer
161
  * @{
162
  */
163
 
164
#define DAC_OutputBuffer_Enable            ((uint32_t)0x00000000)
165
#define DAC_OutputBuffer_Disable           ((uint32_t)0x00000002)
166
#define IS_DAC_OUTPUT_BUFFER_STATE(STATE) (((STATE) == DAC_OutputBuffer_Enable) || \
167
                                           ((STATE) == DAC_OutputBuffer_Disable))
168
/**
169
  * @}
170
  */
171
 
172
/** @defgroup DAC_Channel_selection
173
  * @{
174
  */
175
 
176
#define DAC_Channel_1                      ((uint32_t)0x00000000)
177
#define DAC_Channel_2                      ((uint32_t)0x00000010)
178
#define IS_DAC_CHANNEL(CHANNEL) (((CHANNEL) == DAC_Channel_1) || \
179
                                 ((CHANNEL) == DAC_Channel_2))
180
/**
181
  * @}
182
  */
183
 
184
/** @defgroup DAC_data_alignement
185
  * @{
186
  */
187
 
188
#define DAC_Align_12b_R                    ((uint32_t)0x00000000)
189
#define DAC_Align_12b_L                    ((uint32_t)0x00000004)
190
#define DAC_Align_8b_R                     ((uint32_t)0x00000008)
191
#define IS_DAC_ALIGN(ALIGN) (((ALIGN) == DAC_Align_12b_R) || \
192
                             ((ALIGN) == DAC_Align_12b_L) || \
193
                             ((ALIGN) == DAC_Align_8b_R))
194
/**
195
  * @}
196
  */
197
 
198
/** @defgroup DAC_wave_generation
199
  * @{
200
  */
201
 
202
#define DAC_Wave_Noise                     ((uint32_t)0x00000040)
203
#define DAC_Wave_Triangle                  ((uint32_t)0x00000080)
204
#define IS_DAC_WAVE(WAVE) (((WAVE) == DAC_Wave_Noise) || \
205
                           ((WAVE) == DAC_Wave_Triangle))
206
/**
207
  * @}
208
  */
209
 
210
/** @defgroup DAC_data
211
  * @{
212
  */
213
 
214
#define IS_DAC_DATA(DATA) ((DATA) <= 0xFFF0) 
215
/**
216
  * @}
217
  */
218
 
219
/**
220
  * @}
221
  */
222
 
223
/** @defgroup DAC_Exported_Macros
224
  * @{
225
  */
226
 
227
/**
228
  * @}
229
  */
230
 
231
/** @defgroup DAC_Exported_Functions
232
  * @{
233
  */
234
 
235
void DAC_DeInit(void);
236
void DAC_Init(uint32_t DAC_Channel, DAC_InitTypeDef* DAC_InitStruct);
237
void DAC_StructInit(DAC_InitTypeDef* DAC_InitStruct);
238
void DAC_Cmd(uint32_t DAC_Channel, FunctionalState NewState);
239
void DAC_DMACmd(uint32_t DAC_Channel, FunctionalState NewState);
240
void DAC_SoftwareTriggerCmd(uint32_t DAC_Channel, FunctionalState NewState);
241
void DAC_DualSoftwareTriggerCmd(FunctionalState NewState);
242
void DAC_WaveGenerationCmd(uint32_t DAC_Channel, uint32_t DAC_Wave, FunctionalState NewState);
243
void DAC_SetChannel1Data(uint32_t DAC_Align, uint16_t Data);
244
void DAC_SetChannel2Data(uint32_t DAC_Align, uint16_t Data);
245
void DAC_SetDualChannelData(uint32_t DAC_Align, uint16_t Data2, uint16_t Data1);
246
uint16_t DAC_GetDataOutputValue(uint32_t DAC_Channel);
247
 
248
#endif /*__STM32F10x_DAC_H */
249
/**
250
  * @}
251
  */
252
 
253
/**
254
  * @}
255
  */
256
 
257
/**
258
  * @}
259
  */
260
 
261
/******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.