Subversion Repositories LedShow

Rev

Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 9
Line 4... Line 4...
4
  * @author  MCD Application Team
4
  * @author  MCD Application Team
5
  * @brief   Header file of DAC HAL module.
5
  * @brief   Header file of DAC HAL module.
6
  ******************************************************************************
6
  ******************************************************************************
7
  * @attention
7
  * @attention
8
  *
8
  *
9
  * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
9
  * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics.
-
 
10
  * All rights reserved.</center></h2>
10
  *
11
  *
11
  * Redistribution and use in source and binary forms, with or without modification,
12
  * This software component is licensed by ST under BSD 3-Clause license,
12
  * are permitted provided that the following conditions are met:
13
  * the "License"; You may not use this file except in compliance with the
13
  *   1. Redistributions of source code must retain the above copyright notice,
-
 
14
  *      this list of conditions and the following disclaimer.
-
 
15
  *   2. Redistributions in binary form must reproduce the above copyright notice,
-
 
16
  *      this list of conditions and the following disclaimer in the documentation
-
 
17
  *      and/or other materials provided with the distribution.
14
  * License. You may obtain a copy of the License at:
18
  *   3. Neither the name of STMicroelectronics nor the names of its contributors
-
 
19
  *      may be used to endorse or promote products derived from this software
15
  *                        opensource.org/licenses/BSD-3-Clause
20
  *      without specific prior written permission.
-
 
21
  *
-
 
22
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-
 
23
  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-
 
24
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-
 
25
  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-
 
26
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-
 
27
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-
 
28
  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-
 
29
  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-
 
30
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-
 
31
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
 
32
  *
16
  *
33
  ******************************************************************************
17
  ******************************************************************************
34
  */
18
  */
35
 
19
 
36
/* Define to prevent recursive inclusion -------------------------------------*/
20
/* Define to prevent recursive inclusion -------------------------------------*/
37
#ifndef __STM32F1xx_HAL_DAC_H
21
#ifndef STM32F1xx_HAL_DAC_H
38
#define __STM32F1xx_HAL_DAC_H
22
#define STM32F1xx_HAL_DAC_H
39
 
23
 
40
#ifdef __cplusplus
24
#ifdef __cplusplus
41
 extern "C" {
25
extern "C" {
42
#endif
26
#endif
43
 
27
 
44
#if defined (STM32F100xB) || defined (STM32F100xE) || defined (STM32F101xE) || defined (STM32F101xG) || defined (STM32F103xE) || defined (STM32F103xG) || defined (STM32F105xC) || defined (STM32F107xC)
-
 
45
   
-
 
46
/* Includes ------------------------------------------------------------------*/
-
 
47
#include "stm32f1xx_hal_def.h"
-
 
48
 
-
 
49
/** @addtogroup STM32F1xx_HAL_Driver
28
/** @addtogroup STM32F1xx_HAL_Driver
50
  * @{
29
  * @{
51
  */
30
  */
52
 
31
 
-
 
32
/* Includes ------------------------------------------------------------------*/
-
 
33
#include "stm32f1xx_hal_def.h"
-
 
34
 
-
 
35
#if defined(DAC)
-
 
36
 
53
/** @addtogroup DAC
37
/** @addtogroup DAC
54
  * @{
38
  * @{
55
  */
39
  */
56
 
40
 
57
/* Exported types ------------------------------------------------------------*/
41
/* Exported types ------------------------------------------------------------*/
58
 
42
 
59
/** @defgroup DAC_Exported_Types DAC Exported Types
43
/** @defgroup DAC_Exported_Types DAC Exported Types
60
  * @{
44
  * @{
61
  */
45
  */
62
 
46
 
63
/**
47
/**
64
  * @brief  HAL State structures definition  
48
  * @brief  HAL State structures definition
65
  */
49
  */
66
typedef enum
50
typedef enum
67
{
51
{
68
  HAL_DAC_STATE_RESET             = 0x00U,  /*!< DAC not yet initialized or disabled  */
52
  HAL_DAC_STATE_RESET             = 0x00U,  /*!< DAC not yet initialized or disabled  */
69
  HAL_DAC_STATE_READY             = 0x01U,  /*!< DAC initialized and ready for use    */
53
  HAL_DAC_STATE_READY             = 0x01U,  /*!< DAC initialized and ready for use    */
70
  HAL_DAC_STATE_BUSY              = 0x02U,  /*!< DAC internal processing is ongoing   */
54
  HAL_DAC_STATE_BUSY              = 0x02U,  /*!< DAC internal processing is ongoing   */
71
  HAL_DAC_STATE_TIMEOUT           = 0x03U,  /*!< DAC timeout state                    */
55
  HAL_DAC_STATE_TIMEOUT           = 0x03U,  /*!< DAC timeout state                    */
72
  HAL_DAC_STATE_ERROR             = 0x04U   /*!< DAC error state                      */
56
  HAL_DAC_STATE_ERROR             = 0x04U   /*!< DAC error state                      */
73
 
57
 
74
}HAL_DAC_StateTypeDef;
58
} HAL_DAC_StateTypeDef;
75
 
59
 
76
/**
60
/**
77
  * @brief  DAC handle Structure definition  
61
  * @brief  DAC handle Structure definition
78
  */
62
  */
-
 
63
#if (USE_HAL_DAC_REGISTER_CALLBACKS == 1)
-
 
64
typedef struct __DAC_HandleTypeDef
-
 
65
#else
79
typedef struct
66
typedef struct
-
 
67
#endif
80
{
68
{
81
  DAC_TypeDef                 *Instance;     /*!< Register base address             */
69
  DAC_TypeDef                 *Instance;     /*!< Register base address             */
82
 
70
 
83
  __IO HAL_DAC_StateTypeDef   State;         /*!< DAC communication state           */
71
  __IO HAL_DAC_StateTypeDef   State;         /*!< DAC communication state           */
84
 
72
 
85
  HAL_LockTypeDef             Lock;          /*!< DAC locking object                */
73
  HAL_LockTypeDef             Lock;          /*!< DAC locking object                */
86
 
74
 
87
  DMA_HandleTypeDef           *DMA_Handle1;  /*!< Pointer DMA handler for channel 1 */
75
  DMA_HandleTypeDef           *DMA_Handle1;  /*!< Pointer DMA handler for channel 1 */
88
 
76
 
89
  DMA_HandleTypeDef           *DMA_Handle2;  /*!< Pointer DMA handler for channel 2 */
77
  DMA_HandleTypeDef           *DMA_Handle2;  /*!< Pointer DMA handler for channel 2 */
90
 
78
 
91
  __IO uint32_t               ErrorCode;     /*!< DAC Error code                    */
79
  __IO uint32_t               ErrorCode;     /*!< DAC Error code                    */
92
 
-
 
93
}DAC_HandleTypeDef;
-
 
94
 
80
 
-
 
81
#if (USE_HAL_DAC_REGISTER_CALLBACKS == 1)
-
 
82
  void (* ConvCpltCallbackCh1)            (struct __DAC_HandleTypeDef *hdac);
-
 
83
  void (* ConvHalfCpltCallbackCh1)        (struct __DAC_HandleTypeDef *hdac);
-
 
84
  void (* ErrorCallbackCh1)               (struct __DAC_HandleTypeDef *hdac);
-
 
85
  void (* DMAUnderrunCallbackCh1)         (struct __DAC_HandleTypeDef *hdac);
-
 
86
  void (* ConvCpltCallbackCh2)            (struct __DAC_HandleTypeDef *hdac);
-
 
87
  void (* ConvHalfCpltCallbackCh2)        (struct __DAC_HandleTypeDef *hdac);
-
 
88
  void (* ErrorCallbackCh2)               (struct __DAC_HandleTypeDef *hdac);
-
 
89
  void (* DMAUnderrunCallbackCh2)         (struct __DAC_HandleTypeDef *hdac);
-
 
90
 
-
 
91
  void (* MspInitCallback)                (struct __DAC_HandleTypeDef *hdac);
-
 
92
  void (* MspDeInitCallback )             (struct __DAC_HandleTypeDef *hdac);
-
 
93
#endif /* USE_HAL_DAC_REGISTER_CALLBACKS */
-
 
94
 
-
 
95
} DAC_HandleTypeDef;
-
 
96
 
-
 
97
 
95
/**
98
/**
96
  * @brief   DAC Configuration regular Channel structure definition  
99
  * @brief   DAC Configuration regular Channel structure definition
97
  */
100
  */
98
typedef struct
101
typedef struct
99
{
102
{
100
  uint32_t DAC_Trigger;       /*!< Specifies the external trigger for the selected DAC channel.
103
  uint32_t DAC_Trigger;                  /*!< Specifies the external trigger for the selected DAC channel.
101
                                   This parameter can be a value of @ref DACEx_trigger_selection
104
                                              This parameter can be a value of @ref DAC_trigger_selection */
102
                                   Note: For STM32F100x high-density value line devices, additional trigger sources are available. */
-
 
103
 
105
 
104
  uint32_t DAC_OutputBuffer;  /*!< Specifies whether the DAC channel output buffer is enabled or disabled.
106
  uint32_t DAC_OutputBuffer;             /*!< Specifies whether the DAC channel output buffer is enabled or disabled.
105
                                   This parameter can be a value of @ref DAC_output_buffer */
107
                                               This parameter can be a value of @ref DAC_output_buffer */
106
 
108
 
107
}DAC_ChannelConfTypeDef;
109
} DAC_ChannelConfTypeDef;
-
 
110
 
-
 
111
#if (USE_HAL_DAC_REGISTER_CALLBACKS == 1)
-
 
112
/**
-
 
113
  * @brief  HAL DAC Callback ID enumeration definition
-
 
114
  */
-
 
115
typedef enum
-
 
116
{
-
 
117
  HAL_DAC_CH1_COMPLETE_CB_ID                 = 0x00U,  /*!< DAC CH1 Complete Callback ID      */
-
 
118
  HAL_DAC_CH1_HALF_COMPLETE_CB_ID            = 0x01U,  /*!< DAC CH1 half Complete Callback ID */
-
 
119
  HAL_DAC_CH1_ERROR_ID                       = 0x02U,  /*!< DAC CH1 error Callback ID         */
-
 
120
  HAL_DAC_CH1_UNDERRUN_CB_ID                 = 0x03U,  /*!< DAC CH1 underrun Callback ID      */
-
 
121
  HAL_DAC_CH2_COMPLETE_CB_ID                 = 0x04U,  /*!< DAC CH2 Complete Callback ID      */
-
 
122
  HAL_DAC_CH2_HALF_COMPLETE_CB_ID            = 0x05U,  /*!< DAC CH2 half Complete Callback ID */
-
 
123
  HAL_DAC_CH2_ERROR_ID                       = 0x06U,  /*!< DAC CH2 error Callback ID         */
-
 
124
  HAL_DAC_CH2_UNDERRUN_CB_ID                 = 0x07U,  /*!< DAC CH2 underrun Callback ID      */
-
 
125
  HAL_DAC_MSPINIT_CB_ID                      = 0x08U,  /*!< DAC MspInit Callback ID           */
-
 
126
  HAL_DAC_MSPDEINIT_CB_ID                    = 0x09U,  /*!< DAC MspDeInit Callback ID         */
-
 
127
  HAL_DAC_ALL_CB_ID                          = 0x0AU   /*!< DAC All ID                        */
-
 
128
} HAL_DAC_CallbackIDTypeDef;
-
 
129
 
-
 
130
/**
-
 
131
  * @brief  HAL DAC Callback pointer definition
-
 
132
  */
-
 
133
typedef void (*pDAC_CallbackTypeDef)(DAC_HandleTypeDef *hdac);
-
 
134
#endif /* USE_HAL_DAC_REGISTER_CALLBACKS */
108
 
135
 
109
/**
136
/**
110
  * @}
137
  * @}
111
  */
138
  */
112
 
139
 
Line 117... Line 144...
117
  */
144
  */
118
 
145
 
119
/** @defgroup DAC_Error_Code DAC Error Code
146
/** @defgroup DAC_Error_Code DAC Error Code
120
  * @{
147
  * @{
121
  */
148
  */
122
#define  HAL_DAC_ERROR_NONE              0x00000000U    /*!< No error                          */
149
#define  HAL_DAC_ERROR_NONE              0x00U    /*!< No error                          */
123
#define  HAL_DAC_ERROR_DMAUNDERRUNCH1    0x00000001U    /*!< DAC channel1 DMA underrun error   */
150
#define  HAL_DAC_ERROR_DMAUNDERRUNCH1    0x01U    /*!< DAC channel1 DMA underrun error   */
124
#define  HAL_DAC_ERROR_DMAUNDERRUNCH2    0x00000002U    /*!< DAC channel2 DMA underrun error   */
151
#define  HAL_DAC_ERROR_DMAUNDERRUNCH2    0x02U    /*!< DAC channel2 DMA underrun error   */
125
#define  HAL_DAC_ERROR_DMA               0x00000004U    /*!< DMA error                         */   
152
#define  HAL_DAC_ERROR_DMA               0x04U    /*!< DMA error                         */
-
 
153
#define  HAL_DAC_ERROR_TIMEOUT           0x08U    /*!< Timeout error                     */
-
 
154
#if (USE_HAL_DAC_REGISTER_CALLBACKS == 1)
-
 
155
#define HAL_DAC_ERROR_INVALID_CALLBACK   0x10U    /*!< Invalid callback error            */
-
 
156
#endif /* USE_HAL_DAC_REGISTER_CALLBACKS */
-
 
157
 
126
/**
158
/**
127
  * @}
159
  * @}
128
  */
160
  */
129
 
161
 
130
/** @defgroup DAC_output_buffer DAC output buffer
162
/** @defgroup DAC_output_buffer DAC output buffer
131
  * @{
163
  * @{
132
  */
164
  */
133
#define DAC_OUTPUTBUFFER_ENABLE            0x00000000U
165
#define DAC_OUTPUTBUFFER_ENABLE            0x00000000U
134
#define DAC_OUTPUTBUFFER_DISABLE           ((uint32_t)DAC_CR_BOFF1)
166
#define DAC_OUTPUTBUFFER_DISABLE           (DAC_CR_BOFF1)
135
 
167
 
136
/**
168
/**
137
  * @}
169
  * @}
138
  */
170
  */
139
 
171
 
140
/** @defgroup DAC_Channel_selection DAC Channel selection
172
/** @defgroup DAC_Channel_selection DAC Channel selection
141
  * @{
173
  * @{
142
  */
174
  */
143
#define DAC_CHANNEL_1                      0x00000000U
175
#define DAC_CHANNEL_1                      0x00000000U
144
#define DAC_CHANNEL_2                      0x00000010U
176
#define DAC_CHANNEL_2                      0x00000010U
145
 
-
 
146
/**
177
/**
147
  * @}
178
  * @}
148
  */
179
  */
149
 
180
 
150
/** @defgroup DAC_data_alignement DAC data alignement
181
/** @defgroup DAC_data_alignment DAC data alignment
151
  * @{
182
  * @{
152
  */
183
  */
153
#define DAC_ALIGN_12B_R                    0x00000000U
184
#define DAC_ALIGN_12B_R                    0x00000000U
154
#define DAC_ALIGN_12B_L                    0x00000004U
185
#define DAC_ALIGN_12B_L                    0x00000004U
155
#define DAC_ALIGN_8B_R                     0x00000008U
186
#define DAC_ALIGN_8B_R                     0x00000008U
156
 
187
 
157
/**
188
/**
158
  * @}
189
  * @}
159
  */
190
  */
160
 
191
 
-
 
192
/** @defgroup DAC_flags_definition DAC flags definition
-
 
193
  * @{
-
 
194
  */
-
 
195
#define DAC_FLAG_DMAUDR1                   (DAC_SR_DMAUDR1)
-
 
196
#define DAC_FLAG_DMAUDR2                   (DAC_SR_DMAUDR2)
-
 
197
 
-
 
198
/**
-
 
199
  * @}
-
 
200
  */
-
 
201
 
-
 
202
/** @defgroup DAC_IT_definition  DAC IT definition
-
 
203
  * @{
-
 
204
  */
-
 
205
#define DAC_IT_DMAUDR1                   (DAC_SR_DMAUDR1)
-
 
206
#define DAC_IT_DMAUDR2                   (DAC_SR_DMAUDR2)
-
 
207
 
-
 
208
/**
-
 
209
  * @}
-
 
210
  */
-
 
211
 
161
/**
212
/**
162
  * @}
213
  * @}
163
  */
214
  */
164
 
215
 
165
/* Exported macro ------------------------------------------------------------*/
216
/* Exported macro ------------------------------------------------------------*/
166
 
217
 
167
/** @defgroup DAC_Exported_Macros DAC Exported Macros
218
/** @defgroup DAC_Exported_Macros DAC Exported Macros
168
  * @{
219
  * @{
169
  */
220
  */
170
 
221
 
171
/** @brief Reset DAC handle state
222
/** @brief Reset DAC handle state.
172
  * @param  __HANDLE__: specifies the DAC handle.
223
  * @param  __HANDLE__ specifies the DAC handle.
173
  * @retval None
224
  * @retval None
174
  */
225
  */
-
 
226
#if (USE_HAL_DAC_REGISTER_CALLBACKS == 1)
-
 
227
#define __HAL_DAC_RESET_HANDLE_STATE(__HANDLE__) do {                                                        \
-
 
228
                                                      (__HANDLE__)->State             = HAL_DAC_STATE_RESET; \
-
 
229
                                                      (__HANDLE__)->MspInitCallback   = NULL;                \
-
 
230
                                                      (__HANDLE__)->MspDeInitCallback = NULL;                \
-
 
231
                                                     } while(0)
-
 
232
#else
175
#define __HAL_DAC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DAC_STATE_RESET)
233
#define __HAL_DAC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DAC_STATE_RESET)
-
 
234
#endif /* USE_HAL_DAC_REGISTER_CALLBACKS */
176
 
235
 
177
/** @brief Enable the DAC channel
236
/** @brief Enable the DAC channel.
178
  * @param  __HANDLE__: specifies the DAC handle.
237
  * @param  __HANDLE__ specifies the DAC handle.
179
  * @param  __DAC_Channel__: specifies the DAC channel
238
  * @param  __DAC_Channel__ specifies the DAC channel
180
  * @retval None
239
  * @retval None
181
  */
240
  */
182
#define __HAL_DAC_ENABLE(__HANDLE__, __DAC_Channel__) \
241
#define __HAL_DAC_ENABLE(__HANDLE__, __DAC_Channel__) \
183
((__HANDLE__)->Instance->CR |=  (DAC_CR_EN1 << (__DAC_Channel__)))
242
  ((__HANDLE__)->Instance->CR |=  (DAC_CR_EN1 << ((__DAC_Channel__) & 0x10UL)))
184
 
243
 
185
/** @brief Disable the DAC channel
244
/** @brief Disable the DAC channel.
186
  * @param  __HANDLE__: specifies the DAC handle
245
  * @param  __HANDLE__ specifies the DAC handle
187
  * @param  __DAC_Channel__: specifies the DAC channel.
246
  * @param  __DAC_Channel__ specifies the DAC channel.
188
  * @retval None
247
  * @retval None
189
  */
248
  */
190
#define __HAL_DAC_DISABLE(__HANDLE__, __DAC_Channel__) \
249
#define __HAL_DAC_DISABLE(__HANDLE__, __DAC_Channel__) \
191
((__HANDLE__)->Instance->CR &=  ~(DAC_CR_EN1 << (__DAC_Channel__)))
250
  ((__HANDLE__)->Instance->CR &=  ~(DAC_CR_EN1 << ((__DAC_Channel__) & 0x10UL)))
-
 
251
 
-
 
252
/** @brief Set DHR12R1 alignment.
-
 
253
  * @param  __ALIGNMENT__ specifies the DAC alignment
-
 
254
  * @retval None
-
 
255
  */
-
 
256
#define DAC_DHR12R1_ALIGNMENT(__ALIGNMENT__) (0x00000008U + (__ALIGNMENT__))
-
 
257
 
-
 
258
/** @brief  Set DHR12R2 alignment.
-
 
259
  * @param  __ALIGNMENT__ specifies the DAC alignment
-
 
260
  * @retval None
-
 
261
  */
-
 
262
#define DAC_DHR12R2_ALIGNMENT(__ALIGNMENT__) (0x00000014U + (__ALIGNMENT__))
-
 
263
 
-
 
264
/** @brief  Set DHR12RD alignment.
-
 
265
  * @param  __ALIGNMENT__ specifies the DAC alignment
-
 
266
  * @retval None
-
 
267
  */
-
 
268
#define DAC_DHR12RD_ALIGNMENT(__ALIGNMENT__) (0x00000020U + (__ALIGNMENT__))
-
 
269
 
-
 
270
/** @brief Enable the DAC interrupt.
-
 
271
  * @param  __HANDLE__ specifies the DAC handle
-
 
272
  * @param  __INTERRUPT__ specifies the DAC interrupt.
-
 
273
  *          This parameter can be any combination of the following values:
-
 
274
  *            @arg DAC_IT_DMAUDR1: DAC channel 1 DMA underrun interrupt
-
 
275
  *            @arg DAC_IT_DMAUDR2: DAC channel 2 DMA underrun interrupt
-
 
276
  * @retval None
-
 
277
  */
-
 
278
#define __HAL_DAC_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR) |= (__INTERRUPT__))
-
 
279
 
-
 
280
/** @brief Disable the DAC interrupt.
-
 
281
  * @param  __HANDLE__ specifies the DAC handle
-
 
282
  * @param  __INTERRUPT__ specifies the DAC interrupt.
-
 
283
  *          This parameter can be any combination of the following values:
-
 
284
  *            @arg DAC_IT_DMAUDR1: DAC channel 1 DMA underrun interrupt
-
 
285
  *            @arg DAC_IT_DMAUDR2: DAC channel 2 DMA underrun interrupt
-
 
286
  * @retval None
-
 
287
  */
-
 
288
#define __HAL_DAC_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR) &= ~(__INTERRUPT__))
-
 
289
 
-
 
290
/** @brief  Check whether the specified DAC interrupt source is enabled or not.
-
 
291
  * @param __HANDLE__ DAC handle
-
 
292
  * @param __INTERRUPT__ DAC interrupt source to check
-
 
293
  *          This parameter can be any combination of the following values:
-
 
294
  *            @arg DAC_IT_DMAUDR1: DAC channel 1 DMA underrun interrupt
-
 
295
  *            @arg DAC_IT_DMAUDR2: DAC channel 2 DMA underrun interrupt
-
 
296
  * @retval State of interruption (SET or RESET)
-
 
297
  */
-
 
298
#define __HAL_DAC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR & (__INTERRUPT__)) == (__INTERRUPT__))
-
 
299
 
-
 
300
/** @brief  Get the selected DAC's flag status.
-
 
301
  * @param  __HANDLE__ specifies the DAC handle.
-
 
302
  * @param  __FLAG__ specifies the DAC flag to get.
-
 
303
  *          This parameter can be any combination of the following values:
-
 
304
  *            @arg DAC_FLAG_DMAUDR1: DAC channel 1 DMA underrun flag
-
 
305
  *            @arg DAC_FLAG_DMAUDR2: DAC channel 2 DMA underrun flag
-
 
306
  * @retval None
-
 
307
  */
-
 
308
#define __HAL_DAC_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__))
192
 
309
 
-
 
310
/** @brief  Clear the DAC's flag.
-
 
311
  * @param  __HANDLE__ specifies the DAC handle.
-
 
312
  * @param  __FLAG__ specifies the DAC flag to clear.
-
 
313
  *          This parameter can be any combination of the following values:
-
 
314
  *            @arg DAC_FLAG_DMAUDR1: DAC channel 1 DMA underrun flag
-
 
315
  *            @arg DAC_FLAG_DMAUDR2: DAC channel 2 DMA underrun flag
-
 
316
  * @retval None
-
 
317
  */
-
 
318
#define __HAL_DAC_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR) = (__FLAG__))
193
 
319
 
194
/**
320
/**
195
  * @}
321
  * @}
196
  */
322
  */
197
 
323
 
198
/* Private macro -------------------------------------------------------------*/
324
/* Private macro -------------------------------------------------------------*/
199
 
325
 
200
/** @defgroup DAC_Private_Macros DAC Private Macros
326
/** @defgroup DAC_Private_Macros DAC Private Macros
201
  * @{
327
  * @{
Line 210... Line 336...
210
                             ((ALIGN) == DAC_ALIGN_12B_L) || \
336
                             ((ALIGN) == DAC_ALIGN_12B_L) || \
211
                             ((ALIGN) == DAC_ALIGN_8B_R))
337
                             ((ALIGN) == DAC_ALIGN_8B_R))
212
 
338
 
213
#define IS_DAC_DATA(DATA) ((DATA) <= 0xFFF0U)
339
#define IS_DAC_DATA(DATA) ((DATA) <= 0xFFF0U)
214
 
340
 
215
#define DAC_DHR12R1_ALIGNMENT(__ALIGNMENT__) (0x00000008U + (__ALIGNMENT__))
-
 
216
 
-
 
217
#define DAC_DHR12R2_ALIGNMENT(__ALIGNMENT__) (0x00000014U + (__ALIGNMENT__))
-
 
218
 
-
 
219
#define DAC_DHR12RD_ALIGNMENT(__ALIGNMENT__) (0x00000020U + (__ALIGNMENT__))
-
 
220
 
-
 
221
/**
341
/**
222
  * @}
342
  * @}
223
  */
343
  */
224
 
-
 
225
 
344
 
226
/* Include DAC HAL Extension module */
345
/* Include DAC HAL Extended module */
227
#include "stm32f1xx_hal_dac_ex.h"
346
#include "stm32f1xx_hal_dac_ex.h"
228
 
347
 
229
/* Exported functions --------------------------------------------------------*/
348
/* Exported functions --------------------------------------------------------*/
230
 
349
 
231
/** @addtogroup DAC_Exported_Functions
350
/** @addtogroup DAC_Exported_Functions
Line 233... Line 352...
233
  */
352
  */
234
 
353
 
235
/** @addtogroup DAC_Exported_Functions_Group1
354
/** @addtogroup DAC_Exported_Functions_Group1
236
  * @{
355
  * @{
237
  */
356
  */
238
/* Initialization and de-initialization functions *****************************/
357
/* Initialization and de-initialization functions *****************************/
239
HAL_StatusTypeDef HAL_DAC_Init(DAC_HandleTypeDef* hdac);
358
HAL_StatusTypeDef HAL_DAC_Init(DAC_HandleTypeDef *hdac);
240
HAL_StatusTypeDef HAL_DAC_DeInit(DAC_HandleTypeDef* hdac);
359
HAL_StatusTypeDef HAL_DAC_DeInit(DAC_HandleTypeDef *hdac);
241
void HAL_DAC_MspInit(DAC_HandleTypeDef* hdac);
360
void HAL_DAC_MspInit(DAC_HandleTypeDef *hdac);
242
void HAL_DAC_MspDeInit(DAC_HandleTypeDef* hdac);
361
void HAL_DAC_MspDeInit(DAC_HandleTypeDef *hdac);
243
 
362
 
244
/**
363
/**
245
  * @}
364
  * @}
246
  */
365
  */
247
 
366
 
248
/** @addtogroup DAC_Exported_Functions_Group2
367
/** @addtogroup DAC_Exported_Functions_Group2
249
  * @{
368
  * @{
250
  */
369
  */
251
/* IO operation functions *****************************************************/
370
/* IO operation functions *****************************************************/
252
HAL_StatusTypeDef HAL_DAC_Start(DAC_HandleTypeDef* hdac, uint32_t Channel);
371
HAL_StatusTypeDef HAL_DAC_Start(DAC_HandleTypeDef *hdac, uint32_t Channel);
253
HAL_StatusTypeDef HAL_DAC_Stop(DAC_HandleTypeDef* hdac, uint32_t Channel);
372
HAL_StatusTypeDef HAL_DAC_Stop(DAC_HandleTypeDef *hdac, uint32_t Channel);
254
HAL_StatusTypeDef HAL_DAC_Start_DMA(DAC_HandleTypeDef* hdac, uint32_t Channel, uint32_t* pData, uint32_t Length, uint32_t Alignment);
373
HAL_StatusTypeDef HAL_DAC_Start_DMA(DAC_HandleTypeDef *hdac, uint32_t Channel, uint32_t *pData, uint32_t Length,
-
 
374
                                    uint32_t Alignment);
255
HAL_StatusTypeDef HAL_DAC_Stop_DMA(DAC_HandleTypeDef* hdac, uint32_t Channel);
375
HAL_StatusTypeDef HAL_DAC_Stop_DMA(DAC_HandleTypeDef *hdac, uint32_t Channel);
-
 
376
 
-
 
377
void HAL_DAC_IRQHandler(DAC_HandleTypeDef *hdac);
-
 
378
 
256
HAL_StatusTypeDef HAL_DAC_SetValue(DAC_HandleTypeDef* hdac, uint32_t Channel, uint32_t Alignment, uint32_t Data);
379
HAL_StatusTypeDef HAL_DAC_SetValue(DAC_HandleTypeDef *hdac, uint32_t Channel, uint32_t Alignment, uint32_t Data);
-
 
380
 
-
 
381
void HAL_DAC_ConvCpltCallbackCh1(DAC_HandleTypeDef *hdac);
-
 
382
void HAL_DAC_ConvHalfCpltCallbackCh1(DAC_HandleTypeDef *hdac);
257
uint32_t HAL_DAC_GetValue(DAC_HandleTypeDef* hdac, uint32_t Channel);
383
void HAL_DAC_ErrorCallbackCh1(DAC_HandleTypeDef *hdac);
-
 
384
void HAL_DAC_DMAUnderrunCallbackCh1(DAC_HandleTypeDef *hdac);
-
 
385
 
-
 
386
#if (USE_HAL_DAC_REGISTER_CALLBACKS == 1)
-
 
387
/* DAC callback registering/unregistering */
-
 
388
HAL_StatusTypeDef     HAL_DAC_RegisterCallback(DAC_HandleTypeDef *hdac, HAL_DAC_CallbackIDTypeDef CallbackID,
-
 
389
                                               pDAC_CallbackTypeDef pCallback);
-
 
390
HAL_StatusTypeDef     HAL_DAC_UnRegisterCallback(DAC_HandleTypeDef *hdac, HAL_DAC_CallbackIDTypeDef CallbackID);
-
 
391
#endif /* USE_HAL_DAC_REGISTER_CALLBACKS */
258
 
392
 
259
/**
393
/**
260
  * @}
394
  * @}
261
  */
395
  */
262
 
396
 
263
/** @addtogroup DAC_Exported_Functions_Group3
397
/** @addtogroup DAC_Exported_Functions_Group3
264
  * @{
398
  * @{
265
  */
399
  */
266
/* Peripheral Control functions ***********************************************/
400
/* Peripheral Control functions ***********************************************/
267
HAL_StatusTypeDef HAL_DAC_ConfigChannel(DAC_HandleTypeDef* hdac, DAC_ChannelConfTypeDef* sConfig, uint32_t Channel);
401
uint32_t HAL_DAC_GetValue(DAC_HandleTypeDef *hdac, uint32_t Channel);
268
 
402
 
-
 
403
HAL_StatusTypeDef HAL_DAC_ConfigChannel(DAC_HandleTypeDef *hdac, DAC_ChannelConfTypeDef *sConfig, uint32_t Channel);
269
/**
404
/**
270
  * @}
405
  * @}
271
  */
406
  */
272
 
407
 
273
/** @addtogroup DAC_Exported_Functions_Group4
408
/** @addtogroup DAC_Exported_Functions_Group4
274
  * @{
409
  * @{
275
  */
410
  */
276
/* Peripheral State functions *************************************************/
411
/* Peripheral State and Error functions ***************************************/
277
HAL_DAC_StateTypeDef HAL_DAC_GetState(DAC_HandleTypeDef* hdac);
412
HAL_DAC_StateTypeDef HAL_DAC_GetState(DAC_HandleTypeDef *hdac);
278
uint32_t HAL_DAC_GetError(DAC_HandleTypeDef *hdac);
413
uint32_t HAL_DAC_GetError(DAC_HandleTypeDef *hdac);
279
 
414
 
280
void HAL_DAC_ConvCpltCallbackCh1(DAC_HandleTypeDef* hdac);
-
 
281
void HAL_DAC_ConvHalfCpltCallbackCh1(DAC_HandleTypeDef* hdac);
-
 
282
void HAL_DAC_ErrorCallbackCh1(DAC_HandleTypeDef *hdac);
-
 
283
 
-
 
284
 
-
 
285
/**
415
/**
286
  * @}
416
  * @}
287
  */
417
  */
288
 
418
 
289
/**
419
/**
290
  * @}
420
  * @}
291
  */
421
  */
292
 
422
 
293
/** @addtogroup DAC_Private_Functions DAC Private Functions
423
/** @defgroup DAC_Private_Functions DAC Private Functions
294
  * @{
424
  * @{
295
  */
425
  */
296
void DAC_DMAConvCpltCh1(DMA_HandleTypeDef *hdma);
426
void DAC_DMAConvCpltCh1(DMA_HandleTypeDef *hdma);
297
void DAC_DMAHalfConvCpltCh1(DMA_HandleTypeDef *hdma);
-
 
298
void DAC_DMAErrorCh1(DMA_HandleTypeDef *hdma);
427
void DAC_DMAErrorCh1(DMA_HandleTypeDef *hdma);
299
 
-
 
-
 
428
void DAC_DMAHalfConvCpltCh1(DMA_HandleTypeDef *hdma);
300
/**
429
/**
301
  * @}
430
  * @}
302
  */
431
  */
303
 
432
 
304
/**
433
/**
305
  * @}
434
  * @}
306
  */
435
  */
307
 
436
 
-
 
437
#endif /* DAC */
-
 
438
 
308
/**
439
/**
309
  * @}
440
  * @}
310
  */
441
  */
311
 
-
 
312
#endif /* STM32F100xB || STM32F100xE || STM32F101xE || STM32F101xG || STM32F103xE || STM32F103xG || STM32F105xC || STM32F107xC */
-
 
313
 
442
 
314
#ifdef __cplusplus
443
#ifdef __cplusplus
315
}
444
}
316
#endif
445
#endif
317
 
446
 
318
 
447
 
319
#endif /*__STM32F1xx_HAL_DAC_H */
448
#endif /*STM32F1xx_HAL_DAC_H */
320
 
449
 
321
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
450
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
322
 
451