1 /** 2 ****************************************************************************** 3 * @file stm32f3xx_hal_dac.h 4 * @author MCD Application Team 5 * @brief Header file of DAC HAL module. 6 ****************************************************************************** 7 * @attention 8 * 9 * Copyright (c) 2016 STMicroelectronics. 10 * All rights reserved. 11 * 12 * This software is licensed under terms that can be found in the LICENSE file 13 * in the root directory of this software component. 14 * If no LICENSE file comes with this software, it is provided AS-IS. 15 * 16 ****************************************************************************** 17 */ 18 19 /* Define to prevent recursive inclusion -------------------------------------*/ 20 #ifndef STM32F3xx_HAL_DAC_H 21 #define STM32F3xx_HAL_DAC_H 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 /* Includes ------------------------------------------------------------------*/ 28 #include "stm32f3xx_hal_def.h" 29 30 /** @addtogroup STM32F3xx_HAL_Driver 31 * @{ 32 */ 33 34 /** @addtogroup DAC 35 * @{ 36 */ 37 38 /* Exported types ------------------------------------------------------------*/ 39 40 /** @defgroup DAC_Exported_Types DAC Exported Types 41 * @{ 42 */ 43 44 /** 45 * @brief HAL State structures definition 46 */ 47 typedef enum 48 { 49 HAL_DAC_STATE_RESET = 0x00U, /*!< DAC not yet initialized or disabled */ 50 HAL_DAC_STATE_READY = 0x01U, /*!< DAC initialized and ready for use */ 51 HAL_DAC_STATE_BUSY = 0x02U, /*!< DAC internal processing is ongoing */ 52 HAL_DAC_STATE_TIMEOUT = 0x03U, /*!< DAC timeout state */ 53 HAL_DAC_STATE_ERROR = 0x04U /*!< DAC error state */ 54 55 }HAL_DAC_StateTypeDef; 56 57 /** 58 * @brief DAC Configuration regular Channel structure definition 59 */ 60 typedef struct 61 { 62 uint32_t DAC_Trigger; /*!< Specifies the external trigger for the selected DAC channel. 63 This parameter can be a value of @ref DACEx_trigger_selection */ 64 65 uint32_t DAC_OutputBuffer; /*!< Specifies whether the DAC channel output buffer is enabled or disabled. 66 This parameter can be a value of @ref DAC_output_buffer 67 For a given DAC channel, is this parameter applies then DAC_OutputSwitch 68 does not apply */ 69 70 uint32_t DAC_OutputSwitch; /*!< Specifies whether the DAC channel output switch is enabled or disabled. 71 This parameter can be a value of @ref DAC_OutputSwitch 72 For a given DAC channel, is this parameter applies then DAC_OutputBuffer 73 does not apply */ 74 75 }DAC_ChannelConfTypeDef; 76 77 /** 78 * @brief DAC handle Structure definition 79 */ 80 typedef struct __DAC_HandleTypeDef 81 { 82 DAC_TypeDef *Instance; /*!< Register base address */ 83 84 __IO HAL_DAC_StateTypeDef State; /*!< DAC communication state */ 85 86 HAL_LockTypeDef Lock; /*!< DAC locking object */ 87 88 DMA_HandleTypeDef *DMA_Handle1; /*!< Pointer DMA handler for channel 1U */ 89 90 DMA_HandleTypeDef *DMA_Handle2; /*!< Pointer DMA handler for channel 2U */ 91 92 __IO uint32_t ErrorCode; /*!< DAC Error code */ 93 94 #if (USE_HAL_DAC_REGISTER_CALLBACKS == 1) 95 void (* ConvCpltCallbackCh1) (struct __DAC_HandleTypeDef *hdac); 96 void (* ConvHalfCpltCallbackCh1) (struct __DAC_HandleTypeDef *hdac); 97 void (* ErrorCallbackCh1) (struct __DAC_HandleTypeDef *hdac); 98 void (* DMAUnderrunCallbackCh1) (struct __DAC_HandleTypeDef *hdac); 99 void (* ConvCpltCallbackCh2) (struct __DAC_HandleTypeDef* hdac); 100 void (* ConvHalfCpltCallbackCh2) (struct __DAC_HandleTypeDef* hdac); 101 void (* ErrorCallbackCh2) (struct __DAC_HandleTypeDef* hdac); 102 void (* DMAUnderrunCallbackCh2) (struct __DAC_HandleTypeDef* hdac); 103 104 void (* MspInitCallback) (struct __DAC_HandleTypeDef *hdac); 105 void (* MspDeInitCallback ) (struct __DAC_HandleTypeDef *hdac); 106 #endif /* USE_HAL_DAC_REGISTER_CALLBACKS */ 107 108 }DAC_HandleTypeDef; 109 110 #if (USE_HAL_DAC_REGISTER_CALLBACKS == 1) 111 /** 112 * @brief HAL DAC Callback ID enumeration definition 113 */ 114 typedef enum 115 { 116 HAL_DAC_CH1_COMPLETE_CB_ID = 0x00U, /*!< DAC CH1 Complete Callback ID */ 117 HAL_DAC_CH1_HALF_COMPLETE_CB_ID = 0x01U, /*!< DAC CH1 half Complete Callback ID */ 118 HAL_DAC_CH1_ERROR_ID = 0x02U, /*!< DAC CH1 error Callback ID */ 119 HAL_DAC_CH1_UNDERRUN_CB_ID = 0x03U, /*!< DAC CH1 underrun Callback ID */ 120 HAL_DAC_CH2_COMPLETE_CB_ID = 0x04U, /*!< DAC CH2 Complete Callback ID */ 121 HAL_DAC_CH2_HALF_COMPLETE_CB_ID = 0x05U, /*!< DAC CH2 half Complete Callback ID */ 122 HAL_DAC_CH2_ERROR_ID = 0x06U, /*!< DAC CH2 error Callback ID */ 123 HAL_DAC_CH2_UNDERRUN_CB_ID = 0x07U, /*!< DAC CH2 underrun Callback ID */ 124 HAL_DAC_MSP_INIT_CB_ID = 0x08U, /*!< DAC MspInit Callback ID */ 125 HAL_DAC_MSP_DEINIT_CB_ID = 0x09U, /*!< DAC MspDeInit Callback ID */ 126 HAL_DAC_ALL_CB_ID = 0x0AU /*!< DAC All ID */ 127 }HAL_DAC_CallbackIDTypeDef; 128 129 /** 130 * @brief HAL DAC Callback pointer definition 131 */ 132 typedef void (*pDAC_CallbackTypeDef)(DAC_HandleTypeDef *hdac); 133 #endif /* USE_HAL_DAC_REGISTER_CALLBACKS */ 134 135 /** 136 * @} 137 */ 138 139 /* Exported constants --------------------------------------------------------*/ 140 /** @defgroup DAC_Exported_Constants DAC Exported Constants 141 * @{ 142 */ 143 144 /** @defgroup DAC_Error_Code DAC Error Code 145 * @{ 146 */ 147 #define HAL_DAC_ERROR_NONE 0x00U /*!< No error */ 148 #define HAL_DAC_ERROR_DMAUNDERRUNCH1 0x01U /*!< DAC channel1 DMA underrun error */ 149 #define HAL_DAC_ERROR_DMAUNDERRUNCH2 0x02U /*!< DAC channel2 DMA underrun error */ 150 #define HAL_DAC_ERROR_DMA 0x04U /*!< DMA error */ 151 #if (USE_HAL_DAC_REGISTER_CALLBACKS == 1) 152 #define HAL_DAC_ERROR_INVALID_CALLBACK 0x10U /*!< Invalid callback error */ 153 #endif /* USE_HAL_DAC_REGISTER_CALLBACKS */ 154 /** 155 * @} 156 */ 157 158 /** @defgroup DAC_lfsrunmask_triangleamplitude DAC lfsrunmask triangleamplitude 159 * @{ 160 */ 161 #define DAC_LFSRUNMASK_BIT0 (0x00000000U) /*!< Unmask DAC channel LFSR bit0 for noise wave generation */ 162 #define DAC_LFSRUNMASK_BITS1_0 ((uint32_t)DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[1:0] for noise wave generation */ 163 #define DAC_LFSRUNMASK_BITS2_0 ((uint32_t)DAC_CR_MAMP1_1) /*!< Unmask DAC channel LFSR bit[2:0] for noise wave generation */ 164 #define DAC_LFSRUNMASK_BITS3_0 ((uint32_t)DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0)/*!< Unmask DAC channel LFSR bit[3:0] for noise wave generation */ 165 #define DAC_LFSRUNMASK_BITS4_0 ((uint32_t)DAC_CR_MAMP1_2) /*!< Unmask DAC channel LFSR bit[4:0] for noise wave generation */ 166 #define DAC_LFSRUNMASK_BITS5_0 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[5:0] for noise wave generation */ 167 #define DAC_LFSRUNMASK_BITS6_0 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1) /*!< Unmask DAC channel LFSR bit[6:0] for noise wave generation */ 168 #define DAC_LFSRUNMASK_BITS7_0 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[7:0] for noise wave generation */ 169 #define DAC_LFSRUNMASK_BITS8_0 ((uint32_t)DAC_CR_MAMP1_3) /*!< Unmask DAC channel LFSR bit[8:0] for noise wave generation */ 170 #define DAC_LFSRUNMASK_BITS9_0 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[9:0] for noise wave generation */ 171 #define DAC_LFSRUNMASK_BITS10_0 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1) /*!< Unmask DAC channel LFSR bit[10:0] for noise wave generation */ 172 #define DAC_LFSRUNMASK_BITS11_0 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[11:0] for noise wave generation */ 173 #define DAC_TRIANGLEAMPLITUDE_1 (0x00000000U) /*!< Select max triangle amplitude of 1U */ 174 #define DAC_TRIANGLEAMPLITUDE_3 ((uint32_t)DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 3U */ 175 #define DAC_TRIANGLEAMPLITUDE_7 ((uint32_t)DAC_CR_MAMP1_1) /*!< Select max triangle amplitude of 7U */ 176 #define DAC_TRIANGLEAMPLITUDE_15 ((uint32_t)DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 15U */ 177 #define DAC_TRIANGLEAMPLITUDE_31 ((uint32_t)DAC_CR_MAMP1_2) /*!< Select max triangle amplitude of 31U */ 178 #define DAC_TRIANGLEAMPLITUDE_63 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 63U */ 179 #define DAC_TRIANGLEAMPLITUDE_127 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1) /*!< Select max triangle amplitude of 127U */ 180 #define DAC_TRIANGLEAMPLITUDE_255 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 255U */ 181 #define DAC_TRIANGLEAMPLITUDE_511 ((uint32_t)DAC_CR_MAMP1_3) /*!< Select max triangle amplitude of 511U */ 182 #define DAC_TRIANGLEAMPLITUDE_1023 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 1023U */ 183 #define DAC_TRIANGLEAMPLITUDE_2047 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1) /*!< Select max triangle amplitude of 2047U */ 184 #define DAC_TRIANGLEAMPLITUDE_4095 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 4095U */ 185 186 /** 187 * @} 188 */ 189 190 /** @defgroup DAC_output_buffer DAC output buffer 191 * @{ 192 */ 193 #define DAC_OUTPUTBUFFER_ENABLE (0x00000000U) 194 #define DAC_OUTPUTBUFFER_DISABLE ((uint32_t)DAC_CR_BOFF1) 195 196 /** 197 * @} 198 */ 199 200 #if defined(DAC_CR_OUTEN1) 201 /** @defgroup DAC_output_switch DAC output switch 202 * @{ 203 */ 204 #define DAC_OUTPUTSWITCH_DISABLE (0x00000000U) 205 #define DAC_OUTPUTSWITCH_ENABLE ((uint32_t)DAC_CR_OUTEN1) 206 207 /** 208 * @} 209 */ 210 211 #endif /* DAC_CR_OUTEN1 */ 212 /** @defgroup DAC_data_alignment DAC data alignment 213 * @{ 214 */ 215 #define DAC_ALIGN_12B_R (0x00000000U) 216 #define DAC_ALIGN_12B_L (0x00000004U) 217 #define DAC_ALIGN_8B_R (0x00000008U) 218 219 /** 220 * @} 221 */ 222 223 /** @defgroup DAC_flags_definition DAC flags definition 224 * @{ 225 */ 226 #define DAC_FLAG_DMAUDR1 ((uint32_t)DAC_SR_DMAUDR1) 227 #define DAC_FLAG_DMAUDR2 ((uint32_t)DAC_SR_DMAUDR2) 228 /** 229 * @} 230 */ 231 232 /** @defgroup DAC_interrupts_definition DAC interrupts definition 233 * @{ 234 */ 235 #define DAC_IT_DMAUDR1 ((uint32_t)DAC_CR_DMAUDRIE1) 236 #define DAC_IT_DMAUDR2 ((uint32_t)DAC_CR_DMAUDRIE2) 237 238 /** 239 * @} 240 */ 241 242 /** 243 * @} 244 */ 245 246 /* Exported macro ------------------------------------------------------------*/ 247 248 /** @defgroup DAC_Exported_Macros DAC Exported Macros 249 * @{ 250 */ 251 252 /** @brief Reset DAC handle state 253 * @param __HANDLE__ specifies the DAC handle. 254 * @retval None 255 */ 256 #if (USE_HAL_DAC_REGISTER_CALLBACKS == 1) 257 #define __HAL_DAC_RESET_HANDLE_STATE(__HANDLE__) do { \ 258 (__HANDLE__)->State = HAL_DAC_STATE_RESET; \ 259 (__HANDLE__)->MspInitCallback = NULL; \ 260 (__HANDLE__)->MspDeInitCallback = NULL; \ 261 } while(0) 262 #else 263 #define __HAL_DAC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DAC_STATE_RESET) 264 #endif /* USE_HAL_DAC_REGISTER_CALLBACKS */ 265 266 /** @brief Enable the DAC channel 267 * @param __HANDLE__ specifies the DAC handle. 268 * @param __DAC_Channel__ specifies the DAC channel 269 * @retval None 270 */ 271 #define __HAL_DAC_ENABLE(__HANDLE__, __DAC_Channel__) \ 272 ((__HANDLE__)->Instance->CR |= (DAC_CR_EN1 << (__DAC_Channel__))) 273 274 /** @brief Disable the DAC channel 275 * @param __HANDLE__ specifies the DAC handle 276 * @param __DAC_Channel__ specifies the DAC channel. 277 * @retval None 278 */ 279 #define __HAL_DAC_DISABLE(__HANDLE__, __DAC_Channel__) \ 280 ((__HANDLE__)->Instance->CR &= ~(DAC_CR_EN1 << (__DAC_Channel__))) 281 282 /** @brief Set DHR12R1 alignment 283 * @param __ALIGNMENT__ specifies the DAC alignment 284 * @retval None 285 */ 286 #define DAC_DHR12R1_ALIGNMENT(__ALIGNMENT__) ((0x00000008U) + (__ALIGNMENT__)) 287 288 /** @brief Set DHR12R2 alignment 289 * @param __ALIGNMENT__ specifies the DAC alignment 290 * @retval None 291 */ 292 #define DAC_DHR12R2_ALIGNMENT(__ALIGNMENT__) ((0x00000014U) + (__ALIGNMENT__)) 293 294 /** @brief Set DHR12RD alignment 295 * @param __ALIGNMENT__ specifies the DAC alignment 296 * @retval None 297 */ 298 #define DAC_DHR12RD_ALIGNMENT(__ALIGNMENT__) ((0x00000020U) + (__ALIGNMENT__)) 299 300 /** @brief Enable the DAC interrupt 301 * @param __HANDLE__ specifies the DAC handle 302 * @param __INTERRUPT__ specifies the DAC interrupt. 303 * This parameter can be any combination of the following values: 304 * @arg DAC_IT_DMAUDR1: DAC channel 1 DMA underrun interrupt 305 * @arg DAC_IT_DMAUDR2: DAC channel 2 DMA underrun interrupt 306 * @retval None 307 */ 308 #define __HAL_DAC_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR) |= (__INTERRUPT__)) 309 310 /** @brief Disable the DAC interrupt 311 * @param __HANDLE__ specifies the DAC handle 312 * @param __INTERRUPT__ specifies the DAC interrupt. 313 * This parameter can be any combination of the following values: 314 * @arg DAC_IT_DMAUDR1: DAC channel 1 DMA underrun interrupt 315 * @arg DAC_IT_DMAUDR2: DAC channel 2 DMA underrun interrupt 316 * @retval None 317 */ 318 #define __HAL_DAC_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR) &= ~(__INTERRUPT__)) 319 320 /** @brief Check whether the specified DAC interrupt source is enabled or not 321 * @param __HANDLE__ DAC handle 322 * @param __INTERRUPT__ DAC interrupt source to check 323 * This parameter can be any combination of the following values: 324 * @arg DAC_IT_DMAUDR1: DAC channel 1 DMA underrun interrupt 325 * @arg DAC_IT_DMAUDR2: DAC channel 2 DMA underrun interrupt 326 * @retval State of interruption (SET or RESET) 327 */ 328 #define __HAL_DAC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR & (__INTERRUPT__)) == (__INTERRUPT__)) 329 330 /** @brief Get the selected DAC's flag status 331 * @param __HANDLE__ specifies the DAC handle. 332 * @param __FLAG__ specifies the DAC flag to get. 333 * This parameter can be any combination of the following values: 334 * @arg DAC_FLAG_DMAUDR1: DAC channel 1 DMA underrun flag 335 * @arg DAC_FLAG_DMAUDR2: DAC channel 2 DMA underrun flag 336 * @retval None 337 */ 338 #define __HAL_DAC_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__)) 339 340 /** @brief Clear the DAC's flag 341 * @param __HANDLE__ specifies the DAC handle. 342 * @param __FLAG__ specifies the DAC flag to clear. 343 * This parameter can be any combination of the following values: 344 * @arg DAC_FLAG_DMAUDR1: DAC channel 1 DMA underrun flag 345 * @arg DAC_FLAG_DMAUDR2: DAC channel 2 DMA underrun flag 346 * @retval None 347 */ 348 #define __HAL_DAC_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR) = (__FLAG__)) 349 350 /** 351 * @} 352 */ 353 354 /* Private macro -------------------------------------------------------------*/ 355 356 /** @addtogroup DAC_Private_Macros 357 * @{ 358 */ 359 360 #define IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(VALUE) (((VALUE) == DAC_LFSRUNMASK_BIT0) || \ 361 ((VALUE) == DAC_LFSRUNMASK_BITS1_0) || \ 362 ((VALUE) == DAC_LFSRUNMASK_BITS2_0) || \ 363 ((VALUE) == DAC_LFSRUNMASK_BITS3_0) || \ 364 ((VALUE) == DAC_LFSRUNMASK_BITS4_0) || \ 365 ((VALUE) == DAC_LFSRUNMASK_BITS5_0) || \ 366 ((VALUE) == DAC_LFSRUNMASK_BITS6_0) || \ 367 ((VALUE) == DAC_LFSRUNMASK_BITS7_0) || \ 368 ((VALUE) == DAC_LFSRUNMASK_BITS8_0) || \ 369 ((VALUE) == DAC_LFSRUNMASK_BITS9_0) || \ 370 ((VALUE) == DAC_LFSRUNMASK_BITS10_0) || \ 371 ((VALUE) == DAC_LFSRUNMASK_BITS11_0) || \ 372 ((VALUE) == DAC_TRIANGLEAMPLITUDE_1) || \ 373 ((VALUE) == DAC_TRIANGLEAMPLITUDE_3) || \ 374 ((VALUE) == DAC_TRIANGLEAMPLITUDE_7) || \ 375 ((VALUE) == DAC_TRIANGLEAMPLITUDE_15) || \ 376 ((VALUE) == DAC_TRIANGLEAMPLITUDE_31) || \ 377 ((VALUE) == DAC_TRIANGLEAMPLITUDE_63) || \ 378 ((VALUE) == DAC_TRIANGLEAMPLITUDE_127) || \ 379 ((VALUE) == DAC_TRIANGLEAMPLITUDE_255) || \ 380 ((VALUE) == DAC_TRIANGLEAMPLITUDE_511) || \ 381 ((VALUE) == DAC_TRIANGLEAMPLITUDE_1023) || \ 382 ((VALUE) == DAC_TRIANGLEAMPLITUDE_2047) || \ 383 ((VALUE) == DAC_TRIANGLEAMPLITUDE_4095)) 384 385 #define IS_DAC_OUTPUT_BUFFER_STATE(STATE) (((STATE) == DAC_OUTPUTBUFFER_ENABLE) || \ 386 ((STATE) == DAC_OUTPUTBUFFER_DISABLE)) 387 388 #if defined(DAC_CR_OUTEN1) 389 #define IS_DAC_OUTPUT_SWITCH_STATE(STATE) (((STATE) == DAC_OUTPUTSWITCH_DISABLE) || \ 390 ((STATE) == DAC_OUTPUTSWITCH_ENABLE)) 391 392 #endif /* DAC_CR_OUTEN1 */ 393 #define IS_DAC_ALIGN(ALIGN) (((ALIGN) == DAC_ALIGN_12B_R) || \ 394 ((ALIGN) == DAC_ALIGN_12B_L) || \ 395 ((ALIGN) == DAC_ALIGN_8B_R)) 396 397 #define IS_DAC_DATA(DATA) ((DATA) <= 0xFFF0U) 398 399 400 401 /** 402 * @} 403 */ 404 405 406 /* Include DAC HAL Extended module */ 407 #include "stm32f3xx_hal_dac_ex.h" 408 409 /* Exported functions --------------------------------------------------------*/ 410 411 /** @addtogroup DAC_Exported_Functions 412 * @{ 413 */ 414 415 /** @addtogroup DAC_Exported_Functions_Group1 416 * @{ 417 */ 418 /* Initialization and de-initialization functions *****************************/ 419 HAL_StatusTypeDef HAL_DAC_Init(DAC_HandleTypeDef* hdac); 420 HAL_StatusTypeDef HAL_DAC_DeInit(DAC_HandleTypeDef* hdac); 421 void HAL_DAC_MspInit(DAC_HandleTypeDef* hdac); 422 void HAL_DAC_MspDeInit(DAC_HandleTypeDef* hdac); 423 424 /** 425 * @} 426 */ 427 428 /** @addtogroup DAC_Exported_Functions_Group2 429 * @{ 430 */ 431 /* IO operation functions *****************************************************/ 432 HAL_StatusTypeDef HAL_DAC_Start(DAC_HandleTypeDef* hdac, uint32_t Channel); 433 HAL_StatusTypeDef HAL_DAC_Stop(DAC_HandleTypeDef* hdac, uint32_t Channel); 434 HAL_StatusTypeDef HAL_DAC_Start_DMA(DAC_HandleTypeDef* hdac, uint32_t Channel, uint32_t* pData, uint32_t Length, uint32_t Alignment); 435 HAL_StatusTypeDef HAL_DAC_Stop_DMA(DAC_HandleTypeDef* hdac, uint32_t Channel); 436 uint32_t HAL_DAC_GetValue(DAC_HandleTypeDef* hdac, uint32_t Channel); 437 HAL_StatusTypeDef HAL_DAC_ConfigChannel(DAC_HandleTypeDef* hdac, DAC_ChannelConfTypeDef* sConfig, uint32_t Channel); 438 439 void HAL_DAC_IRQHandler(DAC_HandleTypeDef* hdac); 440 void HAL_DAC_ConvCpltCallbackCh1(DAC_HandleTypeDef* hdac); 441 void HAL_DAC_ConvHalfCpltCallbackCh1(DAC_HandleTypeDef* hdac); 442 void HAL_DAC_ErrorCallbackCh1(DAC_HandleTypeDef *hdac); 443 void HAL_DAC_DMAUnderrunCallbackCh1(DAC_HandleTypeDef *hdac); 444 445 #if (USE_HAL_DAC_REGISTER_CALLBACKS == 1) 446 /* DAC callback registering/unregistering */ 447 HAL_StatusTypeDef HAL_DAC_RegisterCallback (DAC_HandleTypeDef *hdac, HAL_DAC_CallbackIDTypeDef CallbackId, pDAC_CallbackTypeDef pCallback); 448 HAL_StatusTypeDef HAL_DAC_UnRegisterCallback (DAC_HandleTypeDef *hdac, HAL_DAC_CallbackIDTypeDef CallbackId); 449 #endif /* USE_HAL_DAC_REGISTER_CALLBACKS */ 450 451 /** 452 * @} 453 */ 454 455 /** @addtogroup DAC_Exported_Functions_Group3 456 * @{ 457 */ 458 /* Peripheral Control functions ***********************************************/ 459 HAL_StatusTypeDef HAL_DAC_SetValue(DAC_HandleTypeDef* hdac, uint32_t Channel, uint32_t Alignment, uint32_t Data); 460 461 /** 462 * @} 463 */ 464 465 /** @addtogroup DAC_Exported_Functions_Group4 466 * @{ 467 */ 468 /* Peripheral State and Error functions ***************************************/ 469 HAL_DAC_StateTypeDef HAL_DAC_GetState(DAC_HandleTypeDef* hdac); 470 uint32_t HAL_DAC_GetError(DAC_HandleTypeDef *hdac); 471 472 /** 473 * @} 474 */ 475 476 /** 477 * @} 478 */ 479 480 /** 481 * @} 482 */ 483 484 /** 485 * @} 486 */ 487 488 #ifdef __cplusplus 489 } 490 #endif 491 492 #endif /* STM32F3xx_HAL_DAC_H */ 493 494