The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
AnnaBridge
Date:
Fri May 26 12:30:20 2017 +0100
Revision:
143:86740a56073b
Parent:
134:ad3be0349dc5
Release 143 of the mbed library.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 85:024bf7f99721 1 /**
bogdanm 85:024bf7f99721 2 ******************************************************************************
bogdanm 85:024bf7f99721 3 * @file stm32f0xx_hal_dac.h
bogdanm 85:024bf7f99721 4 * @author MCD Application Team
<> 134:ad3be0349dc5 5 * @version V1.5.0
<> 134:ad3be0349dc5 6 * @date 04-November-2016
bogdanm 85:024bf7f99721 7 * @brief Header file of DAC HAL module.
bogdanm 85:024bf7f99721 8 ******************************************************************************
bogdanm 85:024bf7f99721 9 * @attention
bogdanm 85:024bf7f99721 10 *
Kojto 122:f9eeca106725 11 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
bogdanm 85:024bf7f99721 12 *
bogdanm 85:024bf7f99721 13 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 85:024bf7f99721 14 * are permitted provided that the following conditions are met:
bogdanm 85:024bf7f99721 15 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 85:024bf7f99721 16 * this list of conditions and the following disclaimer.
bogdanm 85:024bf7f99721 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 85:024bf7f99721 18 * this list of conditions and the following disclaimer in the documentation
bogdanm 85:024bf7f99721 19 * and/or other materials provided with the distribution.
bogdanm 85:024bf7f99721 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 85:024bf7f99721 21 * may be used to endorse or promote products derived from this software
bogdanm 85:024bf7f99721 22 * without specific prior written permission.
bogdanm 85:024bf7f99721 23 *
bogdanm 85:024bf7f99721 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 85:024bf7f99721 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 85:024bf7f99721 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 85:024bf7f99721 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 85:024bf7f99721 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 85:024bf7f99721 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 85:024bf7f99721 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 85:024bf7f99721 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 85:024bf7f99721 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 85:024bf7f99721 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 85:024bf7f99721 34 *
bogdanm 85:024bf7f99721 35 ******************************************************************************
bogdanm 85:024bf7f99721 36 */
bogdanm 85:024bf7f99721 37
bogdanm 85:024bf7f99721 38 /* Define to prevent recursive inclusion -------------------------------------*/
bogdanm 85:024bf7f99721 39 #ifndef __STM32F0xx_HAL_DAC_H
bogdanm 85:024bf7f99721 40 #define __STM32F0xx_HAL_DAC_H
bogdanm 85:024bf7f99721 41
bogdanm 85:024bf7f99721 42 #ifdef __cplusplus
bogdanm 85:024bf7f99721 43 extern "C" {
bogdanm 85:024bf7f99721 44 #endif
bogdanm 85:024bf7f99721 45
Kojto 108:34e6b704fe68 46 /** @addtogroup STM32F0xx_HAL_Driver
Kojto 108:34e6b704fe68 47 * @{
Kojto 108:34e6b704fe68 48 */
Kojto 108:34e6b704fe68 49
bogdanm 85:024bf7f99721 50 #if defined(STM32F051x8) || defined(STM32F058xx) || \
bogdanm 92:4fc01daae5a5 51 defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
bogdanm 92:4fc01daae5a5 52 defined(STM32F091xC) || defined(STM32F098xx)
bogdanm 85:024bf7f99721 53
bogdanm 85:024bf7f99721 54 /* Includes ------------------------------------------------------------------*/
bogdanm 85:024bf7f99721 55 #include "stm32f0xx_hal_def.h"
bogdanm 85:024bf7f99721 56
bogdanm 85:024bf7f99721 57 /** @addtogroup DAC
bogdanm 85:024bf7f99721 58 * @{
bogdanm 85:024bf7f99721 59 */
bogdanm 85:024bf7f99721 60
bogdanm 85:024bf7f99721 61 /* Exported types ------------------------------------------------------------*/
bogdanm 85:024bf7f99721 62
bogdanm 92:4fc01daae5a5 63 /** @defgroup DAC_Exported_Types DAC Exported Types
bogdanm 92:4fc01daae5a5 64 * @{
bogdanm 92:4fc01daae5a5 65 */
bogdanm 92:4fc01daae5a5 66
bogdanm 85:024bf7f99721 67 /**
bogdanm 85:024bf7f99721 68 * @brief HAL State structures definition
bogdanm 85:024bf7f99721 69 */
bogdanm 85:024bf7f99721 70 typedef enum
bogdanm 85:024bf7f99721 71 {
<> 134:ad3be0349dc5 72 HAL_DAC_STATE_RESET = 0x00U, /*!< DAC not yet initialized or disabled */
<> 134:ad3be0349dc5 73 HAL_DAC_STATE_READY = 0x01U, /*!< DAC initialized and ready for use */
<> 134:ad3be0349dc5 74 HAL_DAC_STATE_BUSY = 0x02U, /*!< DAC internal processing is ongoing */
<> 134:ad3be0349dc5 75 HAL_DAC_STATE_TIMEOUT = 0x03U, /*!< DAC timeout state */
<> 134:ad3be0349dc5 76 HAL_DAC_STATE_ERROR = 0x04U /*!< DAC error state */
bogdanm 85:024bf7f99721 77
bogdanm 85:024bf7f99721 78 }HAL_DAC_StateTypeDef;
bogdanm 85:024bf7f99721 79
bogdanm 85:024bf7f99721 80 /**
bogdanm 85:024bf7f99721 81 * @brief DAC handle Structure definition
bogdanm 85:024bf7f99721 82 */
bogdanm 85:024bf7f99721 83 typedef struct
bogdanm 85:024bf7f99721 84 {
bogdanm 85:024bf7f99721 85 DAC_TypeDef *Instance; /*!< Register base address */
bogdanm 85:024bf7f99721 86
bogdanm 85:024bf7f99721 87 __IO HAL_DAC_StateTypeDef State; /*!< DAC communication state */
bogdanm 85:024bf7f99721 88
bogdanm 85:024bf7f99721 89 HAL_LockTypeDef Lock; /*!< DAC locking object */
bogdanm 85:024bf7f99721 90
bogdanm 85:024bf7f99721 91 DMA_HandleTypeDef *DMA_Handle1; /*!< Pointer DMA handler for channel 1 */
bogdanm 85:024bf7f99721 92
bogdanm 85:024bf7f99721 93 DMA_HandleTypeDef *DMA_Handle2; /*!< Pointer DMA handler for channel 2 */
bogdanm 85:024bf7f99721 94
bogdanm 85:024bf7f99721 95 __IO uint32_t ErrorCode; /*!< DAC Error code */
bogdanm 85:024bf7f99721 96
bogdanm 85:024bf7f99721 97 }DAC_HandleTypeDef;
bogdanm 85:024bf7f99721 98
bogdanm 85:024bf7f99721 99 /**
bogdanm 85:024bf7f99721 100 * @brief DAC Configuration regular Channel structure definition
bogdanm 85:024bf7f99721 101 */
bogdanm 85:024bf7f99721 102 typedef struct
bogdanm 85:024bf7f99721 103 {
bogdanm 85:024bf7f99721 104 uint32_t DAC_Trigger; /*!< Specifies the external trigger for the selected DAC channel.
bogdanm 85:024bf7f99721 105 This parameter can be a value of @ref DAC_trigger_selection */
bogdanm 85:024bf7f99721 106
bogdanm 85:024bf7f99721 107 uint32_t DAC_OutputBuffer; /*!< Specifies whether the DAC channel output buffer is enabled or disabled.
bogdanm 85:024bf7f99721 108 This parameter can be a value of @ref DAC_output_buffer */
bogdanm 85:024bf7f99721 109
bogdanm 85:024bf7f99721 110 }DAC_ChannelConfTypeDef;
bogdanm 85:024bf7f99721 111
bogdanm 92:4fc01daae5a5 112 /**
bogdanm 92:4fc01daae5a5 113 * @}
bogdanm 92:4fc01daae5a5 114 */
bogdanm 92:4fc01daae5a5 115
bogdanm 85:024bf7f99721 116 /* Exported constants --------------------------------------------------------*/
bogdanm 85:024bf7f99721 117
bogdanm 92:4fc01daae5a5 118 /** @defgroup DAC_Exported_Constants DAC Exported Constants
bogdanm 92:4fc01daae5a5 119 * @{
bogdanm 92:4fc01daae5a5 120 */
bogdanm 92:4fc01daae5a5 121
bogdanm 92:4fc01daae5a5 122 /** @defgroup DAC_Error_Code DAC Error Code
bogdanm 85:024bf7f99721 123 * @{
bogdanm 85:024bf7f99721 124 */
<> 134:ad3be0349dc5 125 #define HAL_DAC_ERROR_NONE 0x00U /*!< No error */
<> 134:ad3be0349dc5 126 #define HAL_DAC_ERROR_DMAUNDERRUNCH1 0x01U /*!< DAC channel1 DMA underrun error */
<> 134:ad3be0349dc5 127 #define HAL_DAC_ERROR_DMAUNDERRUNCH2 0x02U /*!< DAC channel2 DMA underrun error */
<> 134:ad3be0349dc5 128 #define HAL_DAC_ERROR_DMA 0x04U /*!< DMA error */
bogdanm 85:024bf7f99721 129 /**
bogdanm 85:024bf7f99721 130 * @}
bogdanm 85:024bf7f99721 131 */
bogdanm 85:024bf7f99721 132
bogdanm 92:4fc01daae5a5 133 /** @defgroup DAC_output_buffer DAC output buffer
bogdanm 85:024bf7f99721 134 * @{
bogdanm 85:024bf7f99721 135 */
<> 134:ad3be0349dc5 136 #define DAC_OUTPUTBUFFER_ENABLE (0x00000000U)
bogdanm 85:024bf7f99721 137 #define DAC_OUTPUTBUFFER_DISABLE ((uint32_t)DAC_CR_BOFF1)
bogdanm 85:024bf7f99721 138
bogdanm 85:024bf7f99721 139 /**
bogdanm 85:024bf7f99721 140 * @}
bogdanm 85:024bf7f99721 141 */
bogdanm 85:024bf7f99721 142
Kojto 108:34e6b704fe68 143 /** @defgroup DAC_data_alignment DAC data alignment
bogdanm 85:024bf7f99721 144 * @{
bogdanm 85:024bf7f99721 145 */
<> 134:ad3be0349dc5 146 #define DAC_ALIGN_12B_R (0x00000000U)
<> 134:ad3be0349dc5 147 #define DAC_ALIGN_12B_L (0x00000004U)
<> 134:ad3be0349dc5 148 #define DAC_ALIGN_8B_R (0x00000008U)
bogdanm 85:024bf7f99721 149
bogdanm 85:024bf7f99721 150 /**
bogdanm 85:024bf7f99721 151 * @}
bogdanm 85:024bf7f99721 152 */
bogdanm 85:024bf7f99721 153
bogdanm 92:4fc01daae5a5 154 /** @defgroup DAC_flags_definition DAC flags definition
bogdanm 85:024bf7f99721 155 * @{
bogdanm 85:024bf7f99721 156 */
bogdanm 85:024bf7f99721 157 #define DAC_FLAG_DMAUDR1 ((uint32_t)DAC_SR_DMAUDR1)
bogdanm 85:024bf7f99721 158 #define DAC_FLAG_DMAUDR2 ((uint32_t)DAC_SR_DMAUDR2)
bogdanm 85:024bf7f99721 159 /**
bogdanm 85:024bf7f99721 160 * @}
bogdanm 85:024bf7f99721 161 */
bogdanm 85:024bf7f99721 162
bogdanm 92:4fc01daae5a5 163 /** @defgroup DAC_IT_definition DAC IT definition
bogdanm 85:024bf7f99721 164 * @{
bogdanm 85:024bf7f99721 165 */
bogdanm 85:024bf7f99721 166 #define DAC_IT_DMAUDR1 ((uint32_t)DAC_SR_DMAUDR1)
bogdanm 85:024bf7f99721 167 #define DAC_IT_DMAUDR2 ((uint32_t)DAC_SR_DMAUDR2)
bogdanm 92:4fc01daae5a5 168 /**
bogdanm 92:4fc01daae5a5 169 * @}
bogdanm 92:4fc01daae5a5 170 */
bogdanm 92:4fc01daae5a5 171
bogdanm 85:024bf7f99721 172 /**
bogdanm 85:024bf7f99721 173 * @}
bogdanm 85:024bf7f99721 174 */
bogdanm 85:024bf7f99721 175
bogdanm 92:4fc01daae5a5 176 /* Exported macro ------------------------------------------------------------*/
bogdanm 92:4fc01daae5a5 177
bogdanm 92:4fc01daae5a5 178 /** @defgroup DAC_Exported_Macros DAC Exported Macros
bogdanm 92:4fc01daae5a5 179 * @{
bogdanm 92:4fc01daae5a5 180 */
bogdanm 85:024bf7f99721 181
bogdanm 85:024bf7f99721 182 /** @brief Reset DAC handle state
bogdanm 92:4fc01daae5a5 183 * @param __HANDLE__: specifies the DAC handle.
bogdanm 85:024bf7f99721 184 * @retval None
bogdanm 85:024bf7f99721 185 */
bogdanm 85:024bf7f99721 186 #define __HAL_DAC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DAC_STATE_RESET)
bogdanm 85:024bf7f99721 187
bogdanm 92:4fc01daae5a5 188 /** @brief Enable the DAC channel
bogdanm 92:4fc01daae5a5 189 * @param __HANDLE__: specifies the DAC handle.
bogdanm 92:4fc01daae5a5 190 * @param __DAC_Channel__: specifies the DAC channel
bogdanm 92:4fc01daae5a5 191 * @retval None
bogdanm 92:4fc01daae5a5 192 */
bogdanm 85:024bf7f99721 193 #define __HAL_DAC_ENABLE(__HANDLE__, __DAC_Channel__) \
bogdanm 85:024bf7f99721 194 ((__HANDLE__)->Instance->CR |= (DAC_CR_EN1 << (__DAC_Channel__)))
bogdanm 85:024bf7f99721 195
bogdanm 92:4fc01daae5a5 196 /** @brief Disable the DAC channel
bogdanm 92:4fc01daae5a5 197 * @param __HANDLE__: specifies the DAC handle
bogdanm 92:4fc01daae5a5 198 * @param __DAC_Channel__: specifies the DAC channel.
bogdanm 92:4fc01daae5a5 199 * @retval None
bogdanm 92:4fc01daae5a5 200 */
bogdanm 85:024bf7f99721 201 #define __HAL_DAC_DISABLE(__HANDLE__, __DAC_Channel__) \
bogdanm 85:024bf7f99721 202 ((__HANDLE__)->Instance->CR &= ~(DAC_CR_EN1 << (__DAC_Channel__)))
bogdanm 85:024bf7f99721 203
bogdanm 92:4fc01daae5a5 204 /** @brief Enable the DAC interrupt
bogdanm 92:4fc01daae5a5 205 * @param __HANDLE__: specifies the DAC handle
bogdanm 92:4fc01daae5a5 206 * @param __INTERRUPT__: specifies the DAC interrupt.
Kojto 108:34e6b704fe68 207 * This parameter can be any combination of the following values:
Kojto 108:34e6b704fe68 208 * @arg DAC_IT_DMAUDR1: DAC channel 1 DMA underrun interrupt
Kojto 108:34e6b704fe68 209 * @arg DAC_IT_DMAUDR2: DAC channel 2 DMA underrun interrupt
bogdanm 92:4fc01daae5a5 210 * @retval None
bogdanm 92:4fc01daae5a5 211 */
bogdanm 85:024bf7f99721 212 #define __HAL_DAC_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR) |= (__INTERRUPT__))
bogdanm 85:024bf7f99721 213
bogdanm 92:4fc01daae5a5 214 /** @brief Disable the DAC interrupt
bogdanm 92:4fc01daae5a5 215 * @param __HANDLE__: specifies the DAC handle
bogdanm 92:4fc01daae5a5 216 * @param __INTERRUPT__: specifies the DAC interrupt.
Kojto 108:34e6b704fe68 217 * This parameter can be any combination of the following values:
Kojto 108:34e6b704fe68 218 * @arg DAC_IT_DMAUDR1: DAC channel 1 DMA underrun interrupt
bogdanm 92:4fc01daae5a5 219 * @retval None
bogdanm 92:4fc01daae5a5 220 */
bogdanm 85:024bf7f99721 221 #define __HAL_DAC_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR) &= ~(__INTERRUPT__))
bogdanm 85:024bf7f99721 222
Kojto 108:34e6b704fe68 223 /** @brief Check whether the specified DAC interrupt source is enabled or not
Kojto 108:34e6b704fe68 224 * @param __HANDLE__: DAC handle
Kojto 108:34e6b704fe68 225 * @param __INTERRUPT__: DAC interrupt source to check
Kojto 108:34e6b704fe68 226 * This parameter can be any combination of the following values:
Kojto 108:34e6b704fe68 227 * @arg DAC_IT_DMAUDR1: DAC channel 1 DMA underrun interrupt
Kojto 108:34e6b704fe68 228 * @arg DAC_IT_DMAUDR2: DAC channel 2 DMA underrun interrupt
Kojto 108:34e6b704fe68 229 * @retval State of interruption (SET or RESET)
Kojto 108:34e6b704fe68 230 */
Kojto 108:34e6b704fe68 231 #define __HAL_DAC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR & (__INTERRUPT__)) == (__INTERRUPT__))
Kojto 108:34e6b704fe68 232
Kojto 108:34e6b704fe68 233 /** @brief Get the selected DAC's flag status
bogdanm 92:4fc01daae5a5 234 * @param __HANDLE__: specifies the DAC handle.
Kojto 108:34e6b704fe68 235 * @param __FLAG__: specifies the DAC flag to get.
Kojto 108:34e6b704fe68 236 * This parameter can be any combination of the following values:
Kojto 108:34e6b704fe68 237 * @arg DAC_FLAG_DMAUDR1: DAC channel 1 DMA underrun flag
bogdanm 92:4fc01daae5a5 238 * @retval None
bogdanm 92:4fc01daae5a5 239 */
bogdanm 85:024bf7f99721 240 #define __HAL_DAC_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__))
bogdanm 85:024bf7f99721 241
Kojto 108:34e6b704fe68 242 /** @brief Clear the DAC's flag
bogdanm 92:4fc01daae5a5 243 * @param __HANDLE__: specifies the DAC handle.
Kojto 108:34e6b704fe68 244 * @param __FLAG__: specifies the DAC flag to clear.
Kojto 108:34e6b704fe68 245 * This parameter can be any combination of the following values:
Kojto 108:34e6b704fe68 246 * @arg DAC_FLAG_DMAUDR1: DAC channel 1 DMA underrun flag
bogdanm 92:4fc01daae5a5 247 * @retval None
bogdanm 92:4fc01daae5a5 248 */
bogdanm 92:4fc01daae5a5 249 #define __HAL_DAC_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR) = (__FLAG__))
bogdanm 92:4fc01daae5a5 250
bogdanm 92:4fc01daae5a5 251 /**
bogdanm 92:4fc01daae5a5 252 * @}
bogdanm 92:4fc01daae5a5 253 */
bogdanm 92:4fc01daae5a5 254
Kojto 108:34e6b704fe68 255 /* Private macro -------------------------------------------------------------*/
Kojto 108:34e6b704fe68 256
Kojto 108:34e6b704fe68 257 /** @addtogroup DAC_Private_Macros
Kojto 108:34e6b704fe68 258 * @{
Kojto 108:34e6b704fe68 259 */
Kojto 108:34e6b704fe68 260 #define IS_DAC_OUTPUT_BUFFER_STATE(STATE) (((STATE) == DAC_OUTPUTBUFFER_ENABLE) || \
Kojto 108:34e6b704fe68 261 ((STATE) == DAC_OUTPUTBUFFER_DISABLE))
Kojto 108:34e6b704fe68 262
Kojto 108:34e6b704fe68 263
Kojto 108:34e6b704fe68 264 #if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) || \
Kojto 108:34e6b704fe68 265 defined(STM32F091xC) || defined(STM32F098xx)
Kojto 108:34e6b704fe68 266
Kojto 108:34e6b704fe68 267 #define IS_DAC_CHANNEL(CHANNEL) (((CHANNEL) == DAC_CHANNEL_1) || \
Kojto 108:34e6b704fe68 268 ((CHANNEL) == DAC_CHANNEL_2))
Kojto 108:34e6b704fe68 269
Kojto 108:34e6b704fe68 270 #endif /* STM32F071xB || STM32F072xB || STM32F078xx || */
Kojto 108:34e6b704fe68 271 /* STM32F091xC || STM32F098xx */
Kojto 108:34e6b704fe68 272
Kojto 108:34e6b704fe68 273 #if defined(STM32F051x8) || defined(STM32F058xx)
Kojto 108:34e6b704fe68 274
Kojto 108:34e6b704fe68 275 #define IS_DAC_CHANNEL(CHANNEL) (((CHANNEL) == DAC_CHANNEL_1))
Kojto 108:34e6b704fe68 276
Kojto 108:34e6b704fe68 277 #endif /* STM32F051x8 || STM32F058xx */
Kojto 108:34e6b704fe68 278
Kojto 108:34e6b704fe68 279
Kojto 108:34e6b704fe68 280 #define IS_DAC_ALIGN(ALIGN) (((ALIGN) == DAC_ALIGN_12B_R) || \
Kojto 108:34e6b704fe68 281 ((ALIGN) == DAC_ALIGN_12B_L) || \
Kojto 108:34e6b704fe68 282 ((ALIGN) == DAC_ALIGN_8B_R))
Kojto 108:34e6b704fe68 283
<> 134:ad3be0349dc5 284 #define IS_DAC_DATA(DATA) ((DATA) <= 0xFFF0U)
Kojto 108:34e6b704fe68 285
Kojto 108:34e6b704fe68 286 /** @brief Set DHR12R1 alignment
Kojto 108:34e6b704fe68 287 * @param __ALIGNMENT__: specifies the DAC alignment
Kojto 108:34e6b704fe68 288 * @retval None
Kojto 108:34e6b704fe68 289 */
<> 134:ad3be0349dc5 290 #define DAC_DHR12R1_ALIGNMENT(__ALIGNMENT__) ((0x00000008U) + (__ALIGNMENT__))
Kojto 108:34e6b704fe68 291
Kojto 108:34e6b704fe68 292 /** @brief Set DHR12R2 alignment
Kojto 108:34e6b704fe68 293 * @param __ALIGNMENT__: specifies the DAC alignment
Kojto 108:34e6b704fe68 294 * @retval None
Kojto 108:34e6b704fe68 295 */
<> 134:ad3be0349dc5 296 #define DAC_DHR12R2_ALIGNMENT(__ALIGNMENT__) ((0x00000014U) + (__ALIGNMENT__))
Kojto 108:34e6b704fe68 297
Kojto 108:34e6b704fe68 298 /** @brief Set DHR12RD alignment
Kojto 108:34e6b704fe68 299 * @param __ALIGNMENT__: specifies the DAC alignment
Kojto 108:34e6b704fe68 300 * @retval None
Kojto 108:34e6b704fe68 301 */
<> 134:ad3be0349dc5 302 #define DAC_DHR12RD_ALIGNMENT(__ALIGNMENT__) ((0x00000020U) + (__ALIGNMENT__))
Kojto 108:34e6b704fe68 303
Kojto 108:34e6b704fe68 304 /**
Kojto 108:34e6b704fe68 305 * @}
Kojto 108:34e6b704fe68 306 */
bogdanm 85:024bf7f99721 307
bogdanm 85:024bf7f99721 308 /* Include DAC HAL Extension module */
bogdanm 85:024bf7f99721 309 #include "stm32f0xx_hal_dac_ex.h"
bogdanm 85:024bf7f99721 310
bogdanm 85:024bf7f99721 311 /* Exported functions --------------------------------------------------------*/
bogdanm 92:4fc01daae5a5 312
bogdanm 92:4fc01daae5a5 313 /** @addtogroup DAC_Exported_Functions
bogdanm 92:4fc01daae5a5 314 * @{
bogdanm 92:4fc01daae5a5 315 */
bogdanm 92:4fc01daae5a5 316
bogdanm 92:4fc01daae5a5 317 /** @addtogroup DAC_Exported_Functions_Group1
bogdanm 92:4fc01daae5a5 318 * @{
bogdanm 92:4fc01daae5a5 319 */
bogdanm 85:024bf7f99721 320 /* Initialization and de-initialization functions *****************************/
bogdanm 85:024bf7f99721 321 HAL_StatusTypeDef HAL_DAC_Init(DAC_HandleTypeDef* hdac);
bogdanm 85:024bf7f99721 322 HAL_StatusTypeDef HAL_DAC_DeInit(DAC_HandleTypeDef* hdac);
bogdanm 85:024bf7f99721 323 void HAL_DAC_MspInit(DAC_HandleTypeDef* hdac);
bogdanm 85:024bf7f99721 324 void HAL_DAC_MspDeInit(DAC_HandleTypeDef* hdac);
bogdanm 85:024bf7f99721 325
bogdanm 92:4fc01daae5a5 326 /**
bogdanm 92:4fc01daae5a5 327 * @}
bogdanm 92:4fc01daae5a5 328 */
bogdanm 92:4fc01daae5a5 329
bogdanm 92:4fc01daae5a5 330 /** @addtogroup DAC_Exported_Functions_Group2
bogdanm 92:4fc01daae5a5 331 * @{
bogdanm 92:4fc01daae5a5 332 */
bogdanm 85:024bf7f99721 333 /* IO operation functions *****************************************************/
bogdanm 85:024bf7f99721 334 HAL_StatusTypeDef HAL_DAC_Start(DAC_HandleTypeDef* hdac, uint32_t Channel);
bogdanm 85:024bf7f99721 335 HAL_StatusTypeDef HAL_DAC_Stop(DAC_HandleTypeDef* hdac, uint32_t Channel);
bogdanm 85:024bf7f99721 336 HAL_StatusTypeDef HAL_DAC_Start_DMA(DAC_HandleTypeDef* hdac, uint32_t Channel, uint32_t* pData, uint32_t Length, uint32_t Alignment);
bogdanm 85:024bf7f99721 337 HAL_StatusTypeDef HAL_DAC_Stop_DMA(DAC_HandleTypeDef* hdac, uint32_t Channel);
bogdanm 85:024bf7f99721 338
Kojto 108:34e6b704fe68 339 void HAL_DAC_IRQHandler(DAC_HandleTypeDef* hdac);
Kojto 108:34e6b704fe68 340
Kojto 108:34e6b704fe68 341 HAL_StatusTypeDef HAL_DAC_SetValue(DAC_HandleTypeDef* hdac, uint32_t Channel, uint32_t Alignment, uint32_t Data);
Kojto 108:34e6b704fe68 342
bogdanm 92:4fc01daae5a5 343 void HAL_DAC_ConvCpltCallbackCh1(DAC_HandleTypeDef* hdac);
bogdanm 92:4fc01daae5a5 344 void HAL_DAC_ConvHalfCpltCallbackCh1(DAC_HandleTypeDef* hdac);
bogdanm 92:4fc01daae5a5 345 void HAL_DAC_ErrorCallbackCh1(DAC_HandleTypeDef *hdac);
bogdanm 92:4fc01daae5a5 346 void HAL_DAC_DMAUnderrunCallbackCh1(DAC_HandleTypeDef *hdac);
bogdanm 92:4fc01daae5a5 347 /**
bogdanm 92:4fc01daae5a5 348 * @}
bogdanm 92:4fc01daae5a5 349 */
bogdanm 92:4fc01daae5a5 350
bogdanm 92:4fc01daae5a5 351 /** @addtogroup DAC_Exported_Functions_Group3
bogdanm 92:4fc01daae5a5 352 * @{
bogdanm 92:4fc01daae5a5 353 */
bogdanm 85:024bf7f99721 354 /* Peripheral Control functions ***********************************************/
Kojto 108:34e6b704fe68 355 uint32_t HAL_DAC_GetValue(DAC_HandleTypeDef* hdac, uint32_t Channel);
Kojto 108:34e6b704fe68 356
bogdanm 85:024bf7f99721 357 HAL_StatusTypeDef HAL_DAC_ConfigChannel(DAC_HandleTypeDef* hdac, DAC_ChannelConfTypeDef* sConfig, uint32_t Channel);
bogdanm 92:4fc01daae5a5 358 /**
bogdanm 92:4fc01daae5a5 359 * @}
bogdanm 92:4fc01daae5a5 360 */
bogdanm 85:024bf7f99721 361
bogdanm 92:4fc01daae5a5 362 /** @addtogroup DAC_Exported_Functions_Group4
bogdanm 92:4fc01daae5a5 363 * @{
bogdanm 92:4fc01daae5a5 364 */
bogdanm 85:024bf7f99721 365 /* Peripheral State and Error functions ***************************************/
bogdanm 85:024bf7f99721 366 HAL_DAC_StateTypeDef HAL_DAC_GetState(DAC_HandleTypeDef* hdac);
bogdanm 85:024bf7f99721 367 uint32_t HAL_DAC_GetError(DAC_HandleTypeDef *hdac);
bogdanm 85:024bf7f99721 368
bogdanm 92:4fc01daae5a5 369 /**
bogdanm 92:4fc01daae5a5 370 * @}
bogdanm 92:4fc01daae5a5 371 */
bogdanm 85:024bf7f99721 372
bogdanm 85:024bf7f99721 373 /**
bogdanm 85:024bf7f99721 374 * @}
bogdanm 85:024bf7f99721 375 */
bogdanm 85:024bf7f99721 376
bogdanm 85:024bf7f99721 377 /**
bogdanm 85:024bf7f99721 378 * @}
bogdanm 85:024bf7f99721 379 */
bogdanm 85:024bf7f99721 380
Kojto 108:34e6b704fe68 381 #endif /* STM32F051x8 || STM32F058xx || */
Kojto 108:34e6b704fe68 382 /* STM32F071xB || STM32F072xB || STM32F078xx || */
Kojto 108:34e6b704fe68 383 /* STM32F091xC || STM32F098xx */
Kojto 108:34e6b704fe68 384
bogdanm 92:4fc01daae5a5 385 /**
bogdanm 92:4fc01daae5a5 386 * @}
bogdanm 92:4fc01daae5a5 387 */
bogdanm 92:4fc01daae5a5 388
bogdanm 85:024bf7f99721 389 #ifdef __cplusplus
bogdanm 85:024bf7f99721 390 }
bogdanm 92:4fc01daae5a5 391 #endif
bogdanm 85:024bf7f99721 392
bogdanm 85:024bf7f99721 393
bogdanm 85:024bf7f99721 394 #endif /*__STM32F0xx_HAL_DAC_H */
bogdanm 85:024bf7f99721 395
bogdanm 85:024bf7f99721 396 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
bogdanm 92:4fc01daae5a5 397