Merge pull request #11189 from klutvott123/move-telemetry-displayport-init
[betaflight.git] / lib / main / STM32F3 / Drivers / STM32F3xx_HAL_Driver / Src / stm32f3xx_hal_dac.c
blob15941680004ac2635080f03497dff58975f72b1b
1 /**
2 ******************************************************************************
3 * @file stm32f3xx_hal_dac.c
4 * @author MCD Application Team
5 * @brief DAC HAL module driver.
6 * This file provides firmware functions to manage the following
7 * functionalities of the Digital to Analog Converter (DAC) peripheral:
8 * + Initialization and de-initialization functions
9 * + IO operation functions
10 * + Peripheral Control functions
11 * + Peripheral State and Errors functions
14 @verbatim
15 ==============================================================================
16 ##### DAC Peripheral features #####
17 ==============================================================================
18 [..]
19 *** DAC Channels ***
20 ====================
21 [..]
22 The device integrates up to 3 12-bit Digital Analog Converters that can
23 be used independently or simultaneously (dual mode):
24 (#) DAC1 channel1 with DAC1_OUT1 (PA4) as output
25 (#) DAC1 channel2 with DAC1_OUT2 (PA5) as output
26 (for STM32F3 devices having 2 channels on DAC1)
27 (#) DAC2 channel1 with DAC2_OUT1 (PA6) as output
28 (for STM32F3 devices having 2 DAC)
30 *** DAC Triggers ***
31 ====================
32 [..]
33 Digital to Analog conversion can be non-triggered using DAC_TRIGGER_NONE
34 and DAC1_OUT1/DAC1_OUT2/DAC2_OUT1 is available once writing to DHRx register.
35 [..]
36 Digital to Analog conversion can be triggered by:
37 (#) External event: EXTI Line 9 (any GPIOx_PIN_9) using DAC_TRIGGER_EXT_IT9.
38 The used pin (GPIOx_PIN_9) must be configured in input mode.
40 (#) Timers TRGO: TIM2, TIM4, TIM5, TIM6, TIM7 and TIM8
41 (DAC_TRIGGER_T2_TRGO, DAC_TRIGGER_T4_TRGO...)
43 (#) Software using DAC_TRIGGER_SOFTWARE
45 *** DAC Buffer mode feature ***
46 ===============================
47 [..]
48 Each DAC channel integrates an output buffer that can be used to
49 reduce the output impedance, and to drive external loads directly
50 without having to add an external operational amplifier.
51 To enable, the output buffer use
52 sConfig.DAC_OutputBuffer = DAC_OUTPUTBUFFER_ENABLE;
54 An output switch
55 (in STM32F303x4, STM32F303x6, STM32F303x8
56 c, STM32F334x6, STM32F334x8
57 & STM32F334xx).
58 To enable, the output switch
59 sConfig.DAC_OutputSwitch = DAC_OUTPUTSWITCH_ENABLE;
60 [..]
61 (@) Refer to the device datasheet for more details about output
62 impedance value with and without output buffer.
64 *** GPIO configurations guidelines ***
65 =====================
66 [..]
67 When a DAC channel is used (ex channel1 on PA4) and the other is not
68 (ex channel2 on PA5 is configured in Analog and disabled).
69 Channel1 may disturb channel2 as coupling effect.
70 Note that there is no coupling on channel2 as soon as channel2 is turned on.
71 Coupling on adjacent channel could be avoided as follows:
72 when unused PA5 is configured as INPUT PULL-UP or DOWN.
73 PA5 is configured in ANALOG just before it is turned on.
76 *** DAC wave generation feature ***
77 ===================================
78 [..]
79 Both DAC channels of DAC1 can be used to generate
80 note that wave generation is not available in DAC2.
81 (#) Noise wave
82 (#) Triangle wave
84 Wave generation is NOT available in DAC2.
86 *** DAC data format ***
87 =======================
88 [..]
89 The DAC data format can be:
90 (#) 8-bit right alignment using DAC_ALIGN_8B_R
91 (#) 12-bit left alignment using DAC_ALIGN_12B_L
92 (#) 12-bit right alignment using DAC_ALIGN_12B_R
94 *** DAC data value to voltage correspondance ***
95 ================================================
96 [..]
97 The analog output voltage on each DAC channel pin is determined
98 by the following equation:
99 [..]
100 DAC_OUTx = VREF+ * DOR / 4095
101 (+) with DOR is the Data Output Register
102 [..]
103 VEF+ is the input voltage reference (refer to the device datasheet)
104 [..]
105 e.g. To set DAC_OUT1 to 0.7V, use
106 (+) Assuming that VREF+ = 3.3V, DAC_OUT1 = (3.3U * 868U) / 4095U = 0.7V
108 *** DMA requests ***
109 =====================
110 [..]
111 A DMA1 or DMA2 request can be generated when an external trigger
112 (but not a software trigger) occurs if DMA1 or DMA2 requests are
113 enabled using HAL_DAC_Start_DMA().
114 [..]
115 DMA1 requests are mapped as following:
116 (#) DAC1 channel1: mapped either on
117 (++) DMA1 channel3
118 (++) or DMA2 channel3 (for STM32F3 devices having 2 DMA)
119 which must be already configured
120 (#) DAC1 channel2:
121 (for STM32F3 devices having 2 channels on DAC1)
122 mapped either on
123 (++) DMA1 channel4
124 (++) or DMA2 channel4 (for STM32F3 devices having 2 DMA)
125 which must be already configured
127 (#) DAC2 channel1: mapped either on
128 (for STM32F3 devices having 2 DAC)
129 (++) DMA1 channel4
130 (++) or DMA2 channel4 (for STM32F3 devices having 2 DMA)
131 which must be already configured
134 (@) For Dual mode and specific signal (Triangle and noise) generation please
135 refer to Extended Features Driver description
137 ##### How to use this driver #####
138 ==============================================================================
139 [..]
140 (+) DAC APB clock must be enabled to get write access to DAC
141 registers using HAL_DAC_Init()
142 (+) Configure DAC_OUTx (DAC_OUT1: PA4, DAC_OUT2: PA5) in analog mode.
143 (+) Configure the DAC channel using HAL_DAC_ConfigChannel() function.
144 (+) Enable the DAC channel using HAL_DAC_Start() or HAL_DAC_Start_DMA() functions
146 *** Polling mode IO operation ***
147 =================================
148 [..]
149 (+) Start the DAC peripheral using HAL_DAC_Start()
150 (+) To read the DAC last data output value, use the HAL_DAC_GetValue() function.
151 (+) Stop the DAC peripheral using HAL_DAC_Stop()
153 *** DMA mode IO operation ***
154 ==============================
155 [..]
156 (+) Start the DAC peripheral using HAL_DAC_Start_DMA(), at this stage the user specify the length
157 of data to be transferred at each end of conversion
158 (+) At the middle of data transfer HAL_DAC_ConvHalfCpltCallbackCh1() or HAL_DACEx_ConvHalfCpltCallbackCh2()
159 function is executed and user can add his own code by customization of function pointer
160 HAL_DAC_ConvHalfCpltCallbackCh1() or HAL_DACEx_ConvHalfCpltCallbackCh2()
161 (+) At The end of data transfer HAL_DAC_ConvCpltCallbackCh1() or HAL_DACEx_ConvHalfCpltCallbackCh2()
162 function is executed and user can add his own code by customization of function pointer
163 HAL_DAC_ConvCpltCallbackCh1() or HAL_DACEx_ConvHalfCpltCallbackCh2()
164 (+) In case of transfer Error, HAL_DAC_ErrorCallbackCh1() function is executed and user can
165 add his own code by customization of function pointer HAL_DAC_ErrorCallbackCh1
166 (+) In case of DMA underrun, DAC interruption triggers and execute internal function HAL_DAC_IRQHandler.
167 HAL_DAC_DMAUnderrunCallbackCh1() or HAL_DACEx_DMAUnderrunCallbackCh2()
168 function is executed and user can add his own code by customization of function pointer
169 HAL_DAC_DMAUnderrunCallbackCh1() or HAL_DACEx_DMAUnderrunCallbackCh2() and
170 add his own code by customization of function pointer HAL_DAC_ErrorCallbackCh1()
171 (+) Stop the DAC peripheral using HAL_DAC_Stop_DMA()
173 *** DAC HAL driver macros list ***
174 =============================================
175 [..]
176 Below the list of most used macros in DAC HAL driver.
178 (+) __HAL_DAC_ENABLE : Enable the DAC peripheral
179 (+) __HAL_DAC_DISABLE : Disable the DAC peripheral
180 (+) __HAL_DAC_CLEAR_FLAG: Clear the DAC's pending flags
181 (+) __HAL_DAC_GET_FLAG: Get the selected DAC's flag status
183 [..]
184 (@) You can refer to the DAC HAL driver header file for more useful macros
186 @endverbatim
187 ******************************************************************************
188 * @attention
190 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
192 * Redistribution and use in source and binary forms, with or without modification,
193 * are permitted provided that the following conditions are met:
194 * 1. Redistributions of source code must retain the above copyright notice,
195 * this list of conditions and the following disclaimer.
196 * 2. Redistributions in binary form must reproduce the above copyright notice,
197 * this list of conditions and the following disclaimer in the documentation
198 * and/or other materials provided with the distribution.
199 * 3. Neither the name of STMicroelectronics nor the names of its contributors
200 * may be used to endorse or promote products derived from this software
201 * without specific prior written permission.
203 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
204 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
205 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
206 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
207 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
208 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
209 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
210 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
211 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
212 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
214 ******************************************************************************
218 /* Includes ------------------------------------------------------------------*/
219 #include "stm32f3xx_hal.h"
221 /** @addtogroup STM32F3xx_HAL_Driver
222 * @{
225 /** @defgroup DAC DAC
226 * @brief DAC HAL module driver
227 * @{
230 #ifdef HAL_DAC_MODULE_ENABLED
232 /* Private typedef -----------------------------------------------------------*/
233 /* Private define ------------------------------------------------------------*/
234 /* Private macro -------------------------------------------------------------*/
235 /** @defgroup DAC_Private_Macros DAC Private Macros
236 * @{
239 * @}
242 /* Private variables ---------------------------------------------------------*/
243 /* Private function prototypes -----------------------------------------------*/
244 /** @defgroup DAC_Private_Functions DAC Private Functions
245 * @{
248 * @}
251 /* Exported functions -------------------------------------------------------*/
253 /** @defgroup DAC_Exported_Functions DAC Exported Functions
254 * @{
257 /** @defgroup DAC_Exported_Functions_Group1 Initialization and de-initialization functions
258 * @brief Initialization and Configuration functions
260 @verbatim
261 ==============================================================================
262 ##### Initialization and de-initialization functions #####
263 ==============================================================================
264 [..] This section provides functions allowing to:
265 (+) Initialize and configure the DAC.
266 (+) De-initialize the DAC.
268 @endverbatim
269 * @{
273 * @brief Initialize the DAC peripheral according to the specified parameters
274 * in the DAC_InitStruct and initialize the associated handle.
275 * @param hdac pointer to a DAC_HandleTypeDef structure that contains
276 * the configuration information for the specified DAC.
277 * @retval HAL status
279 HAL_StatusTypeDef HAL_DAC_Init(DAC_HandleTypeDef* hdac)
281 /* Check DAC handle */
282 if(hdac == NULL)
284 return HAL_ERROR;
286 /* Check the parameters */
287 assert_param(IS_DAC_ALL_INSTANCE(hdac->Instance));
289 if(hdac->State == HAL_DAC_STATE_RESET)
291 /* Allocate lock resource and initialize it */
292 hdac->Lock = HAL_UNLOCKED;
294 /* Init the low level hardware */
295 HAL_DAC_MspInit(hdac);
298 /* Initialize the DAC state*/
299 hdac->State = HAL_DAC_STATE_BUSY;
301 /* Set DAC error code to none */
302 hdac->ErrorCode = HAL_DAC_ERROR_NONE;
304 /* Initialize the DAC state*/
305 hdac->State = HAL_DAC_STATE_READY;
307 /* Return function status */
308 return HAL_OK;
312 * @brief Deinitialize the DAC peripheral registers to their default reset values.
313 * @param hdac pointer to a DAC_HandleTypeDef structure that contains
314 * the configuration information for the specified DAC.
315 * @retval HAL status
317 HAL_StatusTypeDef HAL_DAC_DeInit(DAC_HandleTypeDef* hdac)
319 /* Check DAC handle */
320 if(hdac == NULL)
322 return HAL_ERROR;
325 /* Check the parameters */
326 assert_param(IS_DAC_ALL_INSTANCE(hdac->Instance));
328 /* Change DAC state */
329 hdac->State = HAL_DAC_STATE_BUSY;
331 /* DeInit the low level hardware */
332 HAL_DAC_MspDeInit(hdac);
334 /* Set DAC error code to none */
335 hdac->ErrorCode = HAL_DAC_ERROR_NONE;
337 /* Change DAC state */
338 hdac->State = HAL_DAC_STATE_RESET;
340 /* Release Lock */
341 __HAL_UNLOCK(hdac);
343 /* Return function status */
344 return HAL_OK;
348 * @brief Initialize the DAC MSP.
349 * @param hdac pointer to a DAC_HandleTypeDef structure that contains
350 * the configuration information for the specified DAC.
351 * @retval None
353 __weak void HAL_DAC_MspInit(DAC_HandleTypeDef* hdac)
355 /* Prevent unused argument(s) compilation warning */
356 UNUSED(hdac);
358 /* NOTE : This function should not be modified, when the callback is needed,
359 the HAL_DAC_MspInit could be implemented in the user file
364 * @brief DeInitialize the DAC MSP.
365 * @param hdac pointer to a DAC_HandleTypeDef structure that contains
366 * the configuration information for the specified DAC.
367 * @retval None
369 __weak void HAL_DAC_MspDeInit(DAC_HandleTypeDef* hdac)
371 /* Prevent unused argument(s) compilation warning */
372 UNUSED(hdac);
374 /* NOTE : This function should not be modified, when the callback is needed,
375 the HAL_DAC_MspDeInit could be implemented in the user file
380 * @}
383 /** @defgroup DAC_Exported_Functions_Group2 Input and Output operation functions
384 * @brief IO operation functions
386 @verbatim
387 ==============================================================================
388 ##### IO operation functions #####
389 ==============================================================================
390 [..] This section provides functions allowing to:
391 (+) Start conversion.
392 (+) Stop conversion.
393 (+) Start conversion and enable DMA transfer.
394 (+) Stop conversion and disable DMA transfer.
395 (+) Get result of conversion.
396 (+) Get result of dual mode conversion.
398 @endverbatim
399 * @{
403 * @brief Enables DAC and starts conversion of channel.
404 * @param hdac pointer to a DAC_HandleTypeDef structure that contains
405 * the configuration information for the specified DAC.
406 * @param Channel The selected DAC channel.
407 * This parameter can be one of the following values:
408 * @arg DAC_CHANNEL_1: DAC1 Channel1 selected
409 * @arg DAC_CHANNEL_2: DAC1 Channel2 selected
410 * @arg DAC_CHANNEL_1: DAC2 Channel1 selected
411 * @retval HAL status
413 __weak HAL_StatusTypeDef HAL_DAC_Start(DAC_HandleTypeDef* hdac, uint32_t Channel)
415 /* Prevent unused argument(s) compilation warning */
416 UNUSED(hdac);
417 UNUSED(Channel);
419 /* Note : This function is defined into this file for library reference */
420 /* Function content is located into file stm32f3xx_hal_dac_ex.c */
422 /* Return function status */
423 return HAL_ERROR;
427 * @brief Disables DAC and stop conversion of channel.
428 * @param hdac pointer to a DAC_HandleTypeDef structure that contains
429 * the configuration information for the specified DAC.
430 * @param Channel The selected DAC channel.
431 * This parameter can be one of the following values:
432 * @arg DAC_CHANNEL_1: DAC1 Channel1 selected
433 * @arg DAC_CHANNEL_2: DAC1 Channel2 selected
434 * @arg DAC_CHANNEL_1: DAC2 Channel1 selected
435 * @retval HAL status
437 HAL_StatusTypeDef HAL_DAC_Stop(DAC_HandleTypeDef* hdac, uint32_t Channel)
439 /* Check the parameters */
440 assert_param(IS_DAC_CHANNEL_INSTANCE(hdac->Instance, Channel));
442 /* Disable the Peripheral */
443 __HAL_DAC_DISABLE(hdac, Channel);
445 /* Change DAC state */
446 hdac->State = HAL_DAC_STATE_READY;
448 /* Return function status */
449 return HAL_OK;
453 * @brief Disables DAC and stop conversion of channel.
454 * @param hdac pointer to a DAC_HandleTypeDef structure that contains
455 * the configuration information for the specified DAC.
456 * @param Channel The selected DAC channel.
457 * This parameter can be one of the following values:
458 * @arg DAC_CHANNEL_1: DAC1 Channel1 selected
459 * @arg DAC_CHANNEL_2: DAC1 Channel2 selected
460 * @arg DAC_CHANNEL_1: DAC2 Channel1 selected
461 * @retval HAL status
463 HAL_StatusTypeDef HAL_DAC_Stop_DMA(DAC_HandleTypeDef* hdac, uint32_t Channel)
465 HAL_StatusTypeDef status = HAL_OK;
467 /* Check the parameters */
468 assert_param(IS_DAC_CHANNEL_INSTANCE(hdac->Instance, Channel));
470 /* Disable the selected DAC channel DMA request */
471 hdac->Instance->CR &= ~(DAC_CR_DMAEN1 << Channel);
473 /* Disable the Peripheral */
474 __HAL_DAC_DISABLE(hdac, Channel);
476 /* Disable the DMA channel */
477 /* Channel1 is used */
478 if (Channel == DAC_CHANNEL_1)
480 /* Disable the DMA channel */
481 status = HAL_DMA_Abort(hdac->DMA_Handle1);
483 /* Disable the DAC DMA underrun interrupt */
484 __HAL_DAC_DISABLE_IT(hdac, DAC_IT_DMAUDR1);
486 #if defined(STM32F303xE) || defined(STM32F398xx) || \
487 defined(STM32F303xC) || defined(STM32F358xx) || \
488 defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx) || \
489 defined(STM32F373xC) || defined(STM32F378xx)
491 /* For all products including channel 2U */
492 /* DAC channel 2 is available on top of DAC channel 1U */
493 else /* Channel2 is used for */
495 /* Disable the DMA channel */
496 status = HAL_DMA_Abort(hdac->DMA_Handle2);
498 /* Disable the DAC DMA underrun interrupt */
499 __HAL_DAC_DISABLE_IT(hdac, DAC_IT_DMAUDR2);
501 #endif
503 /* Check if DMA Channel effectively disabled */
504 if (status != HAL_OK)
506 /* Update DAC state machine to error */
507 hdac->State = HAL_DAC_STATE_ERROR;
509 else
511 /* Change DAC state */
512 hdac->State = HAL_DAC_STATE_READY;
515 /* Return function status */
516 return status;
520 * @brief Returns the last data output value of the selected DAC channel.
521 * @param hdac pointer to a DAC_HandleTypeDef structure that contains
522 * the configuration information for the specified DAC.
523 * @param Channel The selected DAC channel.
524 * This parameter can be one of the following values:
525 * @arg DAC_CHANNEL_1: DAC1 Channel1 selected
526 * @arg DAC_CHANNEL_2: DAC1 Channel2 selected
527 * @arg DAC_CHANNEL_1: DAC2 Channel1 selected
528 * @retval The selected DAC channel data output value.
530 __weak uint32_t HAL_DAC_GetValue(DAC_HandleTypeDef* hdac, uint32_t Channel)
532 /* Prevent unused argument(s) compilation warning */
533 UNUSED(hdac);
534 UNUSED(Channel);
536 /* Note : This function is defined into this file for library reference */
537 /* Function content is located into file stm32f3xx_hal_dac_ex.c */
539 /* Return function status */
540 return HAL_OK;
544 * @brief Returns the last data output value of the selected DAC channel.
545 * @param hdac pointer to a DAC_HandleTypeDef structure that contains
546 * the configuration information for the specified DAC.
547 * @retval The selected DAC channel data output value.
549 __weak uint32_t HAL_DACEx_DualGetValue(DAC_HandleTypeDef* hdac)
551 /* Prevent unused argument(s) compilation warning */
552 UNUSED(hdac);
554 /* Note : This function is defined into this file for library reference */
555 /* Function content is located into file stm32f3xx_hal_dac_ex.c */
557 /* Return function status */
558 return HAL_OK;
562 * @}
565 /** @defgroup DAC_Exported_Functions_Group3 Peripheral Control functions
566 * @brief Peripheral Control functions
568 @verbatim
569 ==============================================================================
570 ##### Peripheral Control functions #####
571 ==============================================================================
572 [..] This section provides functions allowing to:
573 (+) Configure channels.
574 (+) Configure Triangle wave generation.
575 (+) Configure Noise wave generation.
576 (+) Set the specified data holding register value for DAC channel.
577 (+) Set the specified data holding register value for Dual DAC channels.
579 @endverbatim
580 * @{
584 * @brief Configures the selected DAC channel.
585 * @param hdac pointer to a DAC_HandleTypeDef structure that contains
586 * the configuration information for the specified DAC.
587 * @param sConfig DAC configuration structure.
588 * @param Channel The selected DAC channel.
589 * This parameter can be one of the following values:
590 * @arg DAC_CHANNEL_1: DAC1 Channel1 selected
591 * @arg DAC_CHANNEL_2: DAC1 Channel2 selected
592 * @arg DAC_CHANNEL_1: DAC2 Channel1 selected
593 * @retval HAL status
596 __weak HAL_StatusTypeDef HAL_DAC_ConfigChannel(DAC_HandleTypeDef* hdac, DAC_ChannelConfTypeDef* sConfig, uint32_t Channel)
598 /* Prevent unused argument(s) compilation warning */
599 UNUSED(hdac);
600 UNUSED(sConfig);
601 UNUSED(Channel);
603 /* Return function status */
604 return HAL_OK;
607 __weak HAL_StatusTypeDef HAL_DAC_SetValue(DAC_HandleTypeDef* hdac, uint32_t Channel, uint32_t Alignment, uint32_t Data)
609 /* Prevent unused argument(s) compilation warning */
610 UNUSED(hdac);
611 UNUSED(Channel);
612 UNUSED(Alignment);
613 UNUSED(Data);
615 /* Note : This function is defined into this file for library reference */
616 /* Function content is located into file stm32f3xx_hal_dac_ex.c */
618 /* Return function status */
619 return HAL_ERROR;
622 __weak HAL_StatusTypeDef HAL_DACEx_DualSetValue(DAC_HandleTypeDef* hdac, uint32_t Alignment, uint32_t Data1, uint32_t Data2)
624 /* Prevent unused argument(s) compilation warning */
625 UNUSED(hdac);
626 UNUSED(Alignment);
627 UNUSED(Data1);
628 UNUSED(Data2);
630 /* Note : This function is defined into this file for library reference */
631 /* Function content is located into file stm32f3xx_hal_dac_ex.c */
633 /* Return function status */
634 return HAL_ERROR;
638 * @}
641 /** @defgroup DAC_Exported_Functions_Group4 Peripheral State and Error functions
642 * @brief DAC Peripheral State and Error functions
644 @verbatim
645 ==============================================================================
646 ##### DAC Peripheral State and Error functions #####
647 ==============================================================================
648 [..]
649 This subsection provides functions allowing to
650 (+) Check the DAC state.
651 (+) Check the DAC Errors.
654 @endverbatim
655 * @{
659 * @brief return the DAC handle state
660 * @param hdac pointer to a DAC_HandleTypeDef structure that contains
661 * the configuration information for the specified DAC.
662 * @retval HAL state
664 HAL_DAC_StateTypeDef HAL_DAC_GetState(DAC_HandleTypeDef* hdac)
666 /* Return DAC handle state */
667 return hdac->State;
671 * @brief Return the DAC error code
672 * @param hdac pointer to a DAC_HandleTypeDef structure that contains
673 * the configuration information for the specified DAC.
674 * @retval DAC Error Code
676 uint32_t HAL_DAC_GetError(DAC_HandleTypeDef *hdac)
678 return hdac->ErrorCode;
682 * @}
685 /** @addtogroup DAC_Exported_Functions_Group2 Input and Output operation functions
686 * @{
690 * @brief Conversion complete callback in non blocking mode for Channel1
691 * @param hdac pointer to a DAC_HandleTypeDef structure that contains
692 * the configuration information for the specified DAC.
693 * @retval None
695 __weak void HAL_DAC_ConvCpltCallbackCh1(DAC_HandleTypeDef* hdac)
697 /* Prevent unused argument(s) compilation warning */
698 UNUSED(hdac);
700 /* NOTE : This function Should not be modified, when the callback is needed,
701 the HAL_DAC_ConvCpltCallback1 could be implemented in the user file
706 * @brief Conversion half DMA transfer callback in non blocking mode for Channel1
707 * @param hdac pointer to a DAC_HandleTypeDef structure that contains
708 * the configuration information for the specified DAC.
709 * @retval None
711 __weak void HAL_DAC_ConvHalfCpltCallbackCh1(DAC_HandleTypeDef* hdac)
713 /* Prevent unused argument(s) compilation warning */
714 UNUSED(hdac);
716 /* NOTE : This function Should not be modified, when the callback is needed,
717 the HAL_DAC_ConvHalfCpltCallbackCh1 could be implemented in the user file
722 * @brief Error DAC callback for Channel1.
723 * @param hdac pointer to a DAC_HandleTypeDef structure that contains
724 * the configuration information for the specified DAC.
725 * @retval None
727 __weak void HAL_DAC_ErrorCallbackCh1(DAC_HandleTypeDef *hdac)
729 /* Prevent unused argument(s) compilation warning */
730 UNUSED(hdac);
732 /* NOTE : This function Should not be modified, when the callback is needed,
733 the HAL_DAC_ErrorCallback could be implemented in the user file
739 * @brief DMA underrun DAC callback for Channel1.
740 * @param hdac pointer to a DAC_HandleTypeDef structure that contains
741 * the configuration information for the specified DAC.
742 * @retval None
744 __weak void HAL_DAC_DMAUnderrunCallbackCh1(DAC_HandleTypeDef *hdac)
746 /* Prevent unused argument(s) compilation warning */
747 UNUSED(hdac);
749 /* NOTE : This function Should not be modified, when the callback is needed,
750 the HAL_DAC_DMAUnderrunCallbackCh1 could be implemented in the user file
755 * @}
759 * @}
762 #endif /* HAL_DAC_MODULE_ENABLED */
765 * @}
769 * @}
772 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/