]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL/ST_Library/stm32f7xx_hal_dac.c
Final V8.2.1 release ready for tagging:
[freertos] / FreeRTOS / Demo / CORTEX_M7_STM32F7_STM32756G-EVAL / ST_Library / stm32f7xx_hal_dac.c
diff --git a/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL/ST_Library/stm32f7xx_hal_dac.c b/FreeRTOS/Demo/CORTEX_M7_STM32F7_STM32756G-EVAL/ST_Library/stm32f7xx_hal_dac.c
deleted file mode 100644 (file)
index a243cb4..0000000
+++ /dev/null
@@ -1,948 +0,0 @@
-/**\r
-  ******************************************************************************\r
-  * @file    stm32f7xx_hal_dac.c\r
-  * @author  MCD Application Team\r
-  * @version V0.3.0\r
-  * @date    06-March-2015\r
-  * @brief   DAC HAL module driver.\r
-  *         This file provides firmware functions to manage the following \r
-  *         functionalities of the Digital to Analog Converter (DAC) peripheral:\r
-  *           + Initialization and de-initialization functions\r
-  *           + IO operation functions\r
-  *           + Peripheral Control functions\r
-  *           + Peripheral State and Errors functions      \r
-  *     \r
-  *\r
-  @verbatim      \r
-  ==============================================================================\r
-                      ##### DAC Peripheral features #####\r
-  ==============================================================================\r
-    [..]        \r
-      *** DAC Channels ***\r
-      ====================  \r
-    [..]  \r
-    The device integrates two 12-bit Digital Analog Converters that can \r
-    be used independently or simultaneously (dual mode):\r
-      (#) DAC channel1 with DAC_OUT1 (PA4) as output\r
-      (#) DAC channel2 with DAC_OUT2 (PA5) as output\r
-      \r
-      *** DAC Triggers ***\r
-      ====================\r
-    [..]\r
-    Digital to Analog conversion can be non-triggered using DAC_TRIGGER_NONE\r
-    and DAC_OUT1/DAC_OUT2 is available once writing to DHRx register. \r
-    [..] \r
-    Digital to Analog conversion can be triggered by:\r
-      (#) External event: EXTI Line 9 (any GPIOx_Pin9) using DAC_TRIGGER_EXT_IT9.\r
-          The used pin (GPIOx_Pin9) must be configured in input mode.\r
-  \r
-      (#) Timers TRGO: TIM2, TIM4, TIM5, TIM6, TIM7 and TIM8 \r
-          (DAC_TRIGGER_T2_TRGO, DAC_TRIGGER_T4_TRGO...)\r
-  \r
-      (#) Software using DAC_TRIGGER_SOFTWARE\r
-  \r
-      *** DAC Buffer mode feature ***\r
-      =============================== \r
-      [..] \r
-      Each DAC channel integrates an output buffer that can be used to \r
-      reduce the output impedance, and to drive external loads directly\r
-      without having to add an external operational amplifier.\r
-      To enable, the output buffer use  \r
-      sConfig.DAC_OutputBuffer = DAC_OUTPUTBUFFER_ENABLE;\r
-      [..]           \r
-      (@) Refer to the device datasheet for more details about output \r
-          impedance value with and without output buffer.\r
-            \r
-       *** DAC wave generation feature ***\r
-       =================================== \r
-       [..]     \r
-       Both DAC channels can be used to generate\r
-         (#) Noise wave using HAL_DACEx_NoiseWaveGenerate() \r
-         (#) Triangle wave using HAL_DACEx_TriangleWaveGenerate()\r
-            \r
-       *** DAC data format ***\r
-       =======================\r
-       [..]   \r
-       The DAC data format can be:\r
-         (#) 8-bit right alignment using DAC_ALIGN_8B_R\r
-         (#) 12-bit left alignment using DAC_ALIGN_12B_L\r
-         (#) 12-bit right alignment using DAC_ALIGN_12B_R\r
-  \r
-       *** DAC data value to voltage correspondence ***  \r
-       ================================================ \r
-       [..] \r
-       The analog output voltage on each DAC channel pin is determined\r
-       by the following equation: \r
-       DAC_OUTx = VREF+ * DOR / 4095\r
-       with  DOR is the Data Output Register\r
-          VEF+ is the input voltage reference (refer to the device datasheet)\r
-        e.g. To set DAC_OUT1 to 0.7V, use\r
-          Assuming that VREF+ = 3.3V, DAC_OUT1 = (3.3 * 868) / 4095 = 0.7V\r
-  \r
-       *** DMA requests  ***\r
-       =====================\r
-       [..]    \r
-       A DMA1 request can be generated when an external trigger (but not\r
-       a software trigger) occurs if DMA1 requests are enabled using\r
-       HAL_DAC_Start_DMA()\r
-       [..]\r
-       DMA1 requests are mapped as following:\r
-         (#) DAC channel1 : mapped on DMA1 Stream5 channel7 which must be \r
-             already configured\r
-         (#) DAC channel2 : mapped on DMA1 Stream6 channel7 which must be \r
-             already configured\r
-       \r
-    -@- For Dual mode and specific signal (Triangle and noise) generation please \r
-        refer to Extension Features Driver description        \r
-  \r
-      \r
-                      ##### How to use this driver #####\r
-  ==============================================================================\r
-    [..]          \r
-      (+) DAC APB clock must be enabled to get write access to DAC\r
-          registers using HAL_DAC_Init()\r
-      (+) Configure DAC_OUTx (DAC_OUT1: PA4, DAC_OUT2: PA5) in analog mode.\r
-      (+) Configure the DAC channel using HAL_DAC_ConfigChannel() function.\r
-      (+) Enable the DAC channel using HAL_DAC_Start() or HAL_DAC_Start_DMA functions\r
-\r
-     *** Polling mode IO operation ***\r
-     =================================\r
-     [..]    \r
-       (+) Start the DAC peripheral using HAL_DAC_Start() \r
-       (+) To read the DAC last data output value, use the HAL_DAC_GetValue() function.\r
-       (+) Stop the DAC peripheral using HAL_DAC_Stop()\r
-\r
-          \r
-     *** DMA mode IO operation ***    \r
-     ==============================\r
-     [..]    \r
-       (+) Start the DAC peripheral using HAL_DAC_Start_DMA(), at this stage the user specify the length \r
-           of data to be transferred at each end of conversion \r
-       (+) At The end of data transfer HAL_DAC_ConvCpltCallbackCh1()or HAL_DAC_ConvCpltCallbackCh2()  \r
-           function is executed and user can add his own code by customization of function pointer \r
-           HAL_DAC_ConvCpltCallbackCh1 or HAL_DAC_ConvCpltCallbackCh2\r
-       (+) In case of transfer Error, HAL_DAC_ErrorCallbackCh1() function is executed and user can \r
-            add his own code by customization of function pointer HAL_DAC_ErrorCallbackCh1\r
-       (+) Stop the DAC peripheral using HAL_DAC_Stop_DMA()\r
-\r
-                    \r
-     *** DAC HAL driver macros list ***\r
-     ============================================= \r
-     [..]\r
-       Below the list of most used macros in DAC HAL driver.\r
-       \r
-      (+) __HAL_DAC_ENABLE : Enable the DAC peripheral\r
-      (+) __HAL_DAC_DISABLE : Disable the DAC peripheral\r
-      (+) __HAL_DAC_CLEAR_FLAG: Clear the DAC's pending flags\r
-      (+) __HAL_DAC_GET_FLAG: Get the selected DAC's flag status\r
-      \r
-     [..]\r
-      (@) You can refer to the DAC HAL driver header file for more useful macros  \r
-   \r
- @endverbatim    \r
-  ******************************************************************************\r
-  * @attention\r
-  *\r
-  * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>\r
-  *\r
-  * Redistribution and use in source and binary forms, with or without modification,\r
-  * are permitted provided that the following conditions are met:\r
-  *   1. Redistributions of source code must retain the above copyright notice,\r
-  *      this list of conditions and the following disclaimer.\r
-  *   2. Redistributions in binary form must reproduce the above copyright notice,\r
-  *      this list of conditions and the following disclaimer in the documentation\r
-  *      and/or other materials provided with the distribution.\r
-  *   3. Neither the name of STMicroelectronics nor the names of its contributors\r
-  *      may be used to endorse or promote products derived from this software\r
-  *      without specific prior written permission.\r
-  *\r
-  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"\r
-  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
-  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\r
-  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\r
-  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
-  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\r
-  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\r
-  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\r
-  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\r
-  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
-  *\r
-  ******************************************************************************\r
-  */ \r
-\r
-\r
-/* Includes ------------------------------------------------------------------*/\r
-#include "stm32f7xx_hal.h"\r
-\r
-/** @addtogroup STM32F7xx_HAL_Driver\r
-  * @{\r
-  */\r
-\r
-/** @defgroup DAC DAC\r
-  * @brief DAC driver modules\r
-  * @{\r
-  */ \r
-\r
-#ifdef HAL_DAC_MODULE_ENABLED\r
-\r
-#if defined(STM32F756xx) || defined(STM32F746xx)\r
-/* Private typedef -----------------------------------------------------------*/\r
-/* Private define ------------------------------------------------------------*/\r
-/* Private macro -------------------------------------------------------------*/\r
-/* Private variables ---------------------------------------------------------*/\r
-/** @addtogroup DAC_Private_Functions\r
-  * @{\r
-  */\r
-/* Private function prototypes -----------------------------------------------*/\r
-static void DAC_DMAConvCpltCh1(DMA_HandleTypeDef *hdma);\r
-static void DAC_DMAErrorCh1(DMA_HandleTypeDef *hdma);\r
-static void DAC_DMAHalfConvCpltCh1(DMA_HandleTypeDef *hdma); \r
-/**\r
-  * @}\r
-  */\r
-\r
-/* Exported functions --------------------------------------------------------*/\r
-/** @defgroup DAC_Exported_Functions DAC Exported Functions\r
-  * @{\r
-  */\r
-\r
-/** @defgroup DAC_Exported_Functions_Group1 Initialization and de-initialization functions \r
- *  @brief    Initialization and Configuration functions \r
- *\r
-@verbatim    \r
-  ==============================================================================\r
-              ##### Initialization and de-initialization functions #####\r
-  ==============================================================================\r
-    [..]  This section provides functions allowing to:\r
-      (+) Initialize and configure the DAC. \r
-      (+) De-initialize the DAC. \r
-         \r
-@endverbatim\r
-  * @{\r
-  */\r
-\r
-/**\r
-  * @brief  Initializes the DAC peripheral according to the specified parameters\r
-  *         in the DAC_InitStruct.\r
-  * @param  hdac: pointer to a DAC_HandleTypeDef structure that contains\r
-  *         the configuration information for the specified DAC.\r
-  * @retval HAL status\r
-  */\r
-HAL_StatusTypeDef HAL_DAC_Init(DAC_HandleTypeDef* hdac)\r
-{ \r
-  /* Check DAC handle */\r
-  if(hdac == NULL)\r
-  {\r
-     return HAL_ERROR;\r
-  }\r
-  /* Check the parameters */\r
-  assert_param(IS_DAC_ALL_INSTANCE(hdac->Instance));\r
-  \r
-  if(hdac->State == HAL_DAC_STATE_RESET)\r
-  {  \r
-    /* Init the low level hardware */\r
-    HAL_DAC_MspInit(hdac);\r
-  }\r
-  \r
-  /* Initialize the DAC state*/\r
-  hdac->State = HAL_DAC_STATE_BUSY;\r
-  \r
-  /* Set DAC error code to none */\r
-  hdac->ErrorCode = HAL_DAC_ERROR_NONE;\r
-  \r
-  /* Initialize the DAC state*/\r
-  hdac->State = HAL_DAC_STATE_READY;\r
-  \r
-  /* Return function status */\r
-  return HAL_OK;\r
-}\r
-\r
-/**\r
-  * @brief  Deinitializes the DAC peripheral registers to their default reset values.\r
-  * @param  hdac: pointer to a DAC_HandleTypeDef structure that contains\r
-  *         the configuration information for the specified DAC.\r
-  * @retval HAL status\r
-  */\r
-HAL_StatusTypeDef HAL_DAC_DeInit(DAC_HandleTypeDef* hdac)\r
-{\r
-  /* Check DAC handle */\r
-  if(hdac == NULL)\r
-  {\r
-     return HAL_ERROR;\r
-  }\r
-\r
-  /* Check the parameters */\r
-  assert_param(IS_DAC_ALL_INSTANCE(hdac->Instance));\r
-\r
-  /* Change DAC state */\r
-  hdac->State = HAL_DAC_STATE_BUSY;\r
-\r
-  /* DeInit the low level hardware */\r
-  HAL_DAC_MspDeInit(hdac);\r
-\r
-  /* Set DAC error code to none */\r
-  hdac->ErrorCode = HAL_DAC_ERROR_NONE;\r
-\r
-  /* Change DAC state */\r
-  hdac->State = HAL_DAC_STATE_RESET;\r
-\r
-  /* Release Lock */\r
-  __HAL_UNLOCK(hdac);\r
-\r
-  /* Return function status */\r
-  return HAL_OK;\r
-}\r
-\r
-/**\r
-  * @brief  Initializes the DAC MSP.\r
-  * @param  hdac: pointer to a DAC_HandleTypeDef structure that contains\r
-  *         the configuration information for the specified DAC.\r
-  * @retval None\r
-  */\r
-__weak void HAL_DAC_MspInit(DAC_HandleTypeDef* hdac)\r
-{\r
-  /* NOTE : This function Should not be modified, when the callback is needed,\r
-            the HAL_DAC_MspInit could be implemented in the user file\r
-   */ \r
-}\r
-\r
-/**\r
-  * @brief  DeInitializes the DAC MSP.\r
-  * @param  hdac: pointer to a DAC_HandleTypeDef structure that contains\r
-  *         the configuration information for the specified DAC.  \r
-  * @retval None\r
-  */\r
-__weak void HAL_DAC_MspDeInit(DAC_HandleTypeDef* hdac)\r
-{\r
-  /* NOTE : This function Should not be modified, when the callback is needed,\r
-            the HAL_DAC_MspDeInit could be implemented in the user file\r
-   */ \r
-}\r
-\r
-/**\r
-  * @}\r
-  */\r
-\r
-/** @defgroup DAC_Exported_Functions_Group2 IO operation functions\r
- *  @brief    IO operation functions \r
- *\r
-@verbatim   \r
-  ==============================================================================\r
-             ##### IO operation functions #####\r
-  ==============================================================================  \r
-    [..]  This section provides functions allowing to:\r
-      (+) Start conversion.\r
-      (+) Stop conversion.\r
-      (+) Start conversion and enable DMA transfer.\r
-      (+) Stop conversion and disable DMA transfer.\r
-      (+) Get result of conversion.\r
-                     \r
-@endverbatim\r
-  * @{\r
-  */\r
-\r
-/**\r
-  * @brief  Enables DAC and starts conversion of channel.\r
-  * @param  hdac: pointer to a DAC_HandleTypeDef structure that contains\r
-  *         the configuration information for the specified DAC.\r
-  * @param  Channel: The selected DAC channel. \r
-  *          This parameter can be one of the following values:\r
-  *            @arg DAC_CHANNEL_1: DAC Channel1 selected\r
-  *            @arg DAC_CHANNEL_2: DAC Channel2 selected\r
-  * @retval HAL status\r
-  */\r
-HAL_StatusTypeDef HAL_DAC_Start(DAC_HandleTypeDef* hdac, uint32_t Channel)\r
-{\r
-  uint32_t tmp1 = 0, tmp2 = 0;\r
-  \r
-  /* Check the parameters */\r
-  assert_param(IS_DAC_CHANNEL(Channel));\r
-  \r
-  /* Process locked */\r
-  __HAL_LOCK(hdac);\r
-  \r
-  /* Change DAC state */\r
-  hdac->State = HAL_DAC_STATE_BUSY;\r
-  \r
-  /* Enable the Peripheral */\r
-  __HAL_DAC_ENABLE(hdac, Channel);\r
-  \r
-  if(Channel == DAC_CHANNEL_1)\r
-  {\r
-    tmp1 = hdac->Instance->CR & DAC_CR_TEN1;\r
-    tmp2 = hdac->Instance->CR & DAC_CR_TSEL1;\r
-    /* Check if software trigger enabled */\r
-    if((tmp1 ==  DAC_CR_TEN1) && (tmp2 ==  DAC_CR_TSEL1))\r
-    {\r
-      /* Enable the selected DAC software conversion */\r
-      hdac->Instance->SWTRIGR |= (uint32_t)DAC_SWTRIGR_SWTRIG1;\r
-    }\r
-  }\r
-  else\r
-  {\r
-    tmp1 = hdac->Instance->CR & DAC_CR_TEN2;\r
-    tmp2 = hdac->Instance->CR & DAC_CR_TSEL2;    \r
-    /* Check if software trigger enabled */\r
-    if((tmp1 == DAC_CR_TEN2) && (tmp2 == DAC_CR_TSEL2))\r
-    {\r
-      /* Enable the selected DAC software conversion*/\r
-      hdac->Instance->SWTRIGR |= (uint32_t)DAC_SWTRIGR_SWTRIG2;\r
-    }\r
-  }\r
-  \r
-  /* Change DAC state */\r
-  hdac->State = HAL_DAC_STATE_READY;\r
-  \r
-  /* Process unlocked */\r
-  __HAL_UNLOCK(hdac);\r
-    \r
-  /* Return function status */\r
-  return HAL_OK;\r
-}\r
-\r
-/**\r
-  * @brief  Disables DAC and stop conversion of channel.\r
-  * @param  hdac: pointer to a DAC_HandleTypeDef structure that contains\r
-  *         the configuration information for the specified DAC.\r
-  * @param  Channel: The selected DAC channel. \r
-  *          This parameter can be one of the following values:\r
-  *            @arg DAC_CHANNEL_1: DAC Channel1 selected\r
-  *            @arg DAC_CHANNEL_2: DAC Channel2 selected  \r
-  * @retval HAL status\r
-  */\r
-HAL_StatusTypeDef HAL_DAC_Stop(DAC_HandleTypeDef* hdac, uint32_t Channel)\r
-{\r
-  /* Check the parameters */\r
-  assert_param(IS_DAC_CHANNEL(Channel));\r
-  \r
-  /* Disable the Peripheral */\r
-  __HAL_DAC_DISABLE(hdac, Channel);\r
-  \r
-  /* Change DAC state */\r
-  hdac->State = HAL_DAC_STATE_READY;\r
-  \r
-  /* Return function status */\r
-  return HAL_OK;\r
-}\r
-\r
-/**\r
-  * @brief  Enables DAC and starts conversion of channel.\r
-  * @param  hdac: pointer to a DAC_HandleTypeDef structure that contains\r
-  *         the configuration information for the specified DAC.\r
-  * @param  Channel: The selected DAC channel. \r
-  *          This parameter can be one of the following values:\r
-  *            @arg DAC_CHANNEL_1: DAC Channel1 selected\r
-  *            @arg DAC_CHANNEL_2: DAC Channel2 selected\r
-  * @param  pData: The destination peripheral Buffer address.\r
-  * @param  Length: The length of data to be transferred from memory to DAC peripheral\r
-  * @param  Alignment: Specifies the data alignment for DAC channel.\r
-  *          This parameter can be one of the following values:\r
-  *            @arg DAC_ALIGN_8B_R: 8bit right data alignment selected\r
-  *            @arg DAC_ALIGN_12B_L: 12bit left data alignment selected\r
-  *            @arg DAC_ALIGN_12B_R: 12bit right data alignment selected\r
-  * @retval HAL status\r
-  */\r
-HAL_StatusTypeDef HAL_DAC_Start_DMA(DAC_HandleTypeDef* hdac, uint32_t Channel, uint32_t* pData, uint32_t Length, uint32_t Alignment)\r
-{\r
-  uint32_t tmpreg = 0;\r
-    \r
-  /* Check the parameters */\r
-  assert_param(IS_DAC_CHANNEL(Channel));\r
-  assert_param(IS_DAC_ALIGN(Alignment));\r
-  \r
-  /* Process locked */\r
-  __HAL_LOCK(hdac);\r
-  \r
-  /* Change DAC state */\r
-  hdac->State = HAL_DAC_STATE_BUSY;\r
-\r
-  if(Channel == DAC_CHANNEL_1)\r
-  {\r
-    /* Set the DMA transfer complete callback for channel1 */\r
-    hdac->DMA_Handle1->XferCpltCallback = DAC_DMAConvCpltCh1;\r
-\r
-    /* Set the DMA half transfer complete callback for channel1 */\r
-    hdac->DMA_Handle1->XferHalfCpltCallback = DAC_DMAHalfConvCpltCh1;\r
-\r
-    /* Set the DMA error callback for channel1 */\r
-    hdac->DMA_Handle1->XferErrorCallback = DAC_DMAErrorCh1;\r
-\r
-    /* Enable the selected DAC channel1 DMA request */\r
-    hdac->Instance->CR |= DAC_CR_DMAEN1;\r
-    \r
-    /* Case of use of channel 1 */\r
-    switch(Alignment)\r
-    {\r
-      case DAC_ALIGN_12B_R:\r
-        /* Get DHR12R1 address */\r
-        tmpreg = (uint32_t)&hdac->Instance->DHR12R1;\r
-        break;\r
-      case DAC_ALIGN_12B_L:\r
-        /* Get DHR12L1 address */\r
-        tmpreg = (uint32_t)&hdac->Instance->DHR12L1;\r
-        break;\r
-      case DAC_ALIGN_8B_R:\r
-        /* Get DHR8R1 address */\r
-        tmpreg = (uint32_t)&hdac->Instance->DHR8R1;\r
-        break;\r
-      default:\r
-        break;\r
-    }\r
-  }\r
-  else\r
-  {\r
-    /* Set the DMA transfer complete callback for channel2 */\r
-    hdac->DMA_Handle2->XferCpltCallback = DAC_DMAConvCpltCh2;\r
-\r
-    /* Set the DMA half transfer complete callback for channel2 */\r
-    hdac->DMA_Handle2->XferHalfCpltCallback = DAC_DMAHalfConvCpltCh2;\r
-\r
-    /* Set the DMA error callback for channel2 */\r
-    hdac->DMA_Handle2->XferErrorCallback = DAC_DMAErrorCh2;\r
-\r
-    /* Enable the selected DAC channel2 DMA request */\r
-    hdac->Instance->CR |= DAC_CR_DMAEN2;\r
-\r
-    /* Case of use of channel 2 */\r
-    switch(Alignment)\r
-    {\r
-      case DAC_ALIGN_12B_R:\r
-        /* Get DHR12R2 address */\r
-        tmpreg = (uint32_t)&hdac->Instance->DHR12R2;\r
-        break;\r
-      case DAC_ALIGN_12B_L:\r
-        /* Get DHR12L2 address */\r
-        tmpreg = (uint32_t)&hdac->Instance->DHR12L2;\r
-        break;\r
-      case DAC_ALIGN_8B_R:\r
-        /* Get DHR8R2 address */\r
-        tmpreg = (uint32_t)&hdac->Instance->DHR8R2;\r
-        break;\r
-      default:\r
-        break;\r
-    }\r
-  }\r
-  \r
-  /* Enable the DMA Stream */\r
-  if(Channel == DAC_CHANNEL_1)\r
-  {\r
-    /* Enable the DAC DMA underrun interrupt */\r
-    __HAL_DAC_ENABLE_IT(hdac, DAC_IT_DMAUDR1);\r
-    \r
-    /* Enable the DMA Stream */\r
-    HAL_DMA_Start_IT(hdac->DMA_Handle1, (uint32_t)pData, tmpreg, Length);\r
-  } \r
-  else\r
-  {\r
-    /* Enable the DAC DMA underrun interrupt */\r
-    __HAL_DAC_ENABLE_IT(hdac, DAC_IT_DMAUDR2);\r
-    \r
-    /* Enable the DMA Stream */\r
-    HAL_DMA_Start_IT(hdac->DMA_Handle2, (uint32_t)pData, tmpreg, Length);\r
-  }\r
-  \r
-  /* Enable the Peripheral */\r
-  __HAL_DAC_ENABLE(hdac, Channel);\r
-  \r
-  /* Process Unlocked */\r
-  __HAL_UNLOCK(hdac);\r
-  \r
-  /* Return function status */\r
-  return HAL_OK;\r
-}\r
-\r
-/**\r
-  * @brief  Disables DAC and stop conversion of channel.\r
-  * @param  hdac: pointer to a DAC_HandleTypeDef structure that contains\r
-  *         the configuration information for the specified DAC.\r
-  * @param  Channel: The selected DAC channel. \r
-  *          This parameter can be one of the following values:\r
-  *            @arg DAC_CHANNEL_1: DAC Channel1 selected\r
-  *            @arg DAC_CHANNEL_2: DAC Channel2 selected   \r
-  * @retval HAL status\r
-  */\r
-HAL_StatusTypeDef HAL_DAC_Stop_DMA(DAC_HandleTypeDef* hdac, uint32_t Channel)\r
-{\r
-  HAL_StatusTypeDef status = HAL_OK;\r
-\r
-  /* Check the parameters */\r
-  assert_param(IS_DAC_CHANNEL(Channel));\r
-  \r
-  /* Disable the selected DAC channel DMA request */\r
-   hdac->Instance->CR &= ~(DAC_CR_DMAEN1 << Channel);\r
-    \r
-  /* Disable the Peripheral */\r
-  __HAL_DAC_DISABLE(hdac, Channel);\r
-  \r
-  /* Disable the DMA Channel */\r
-  /* Channel1 is used */\r
-  if(Channel == DAC_CHANNEL_1)\r
-  { \r
-    status = HAL_DMA_Abort(hdac->DMA_Handle1);\r
-  }\r
-  else /* Channel2 is used for */\r
-  { \r
-    status = HAL_DMA_Abort(hdac->DMA_Handle2); \r
-  }\r
-\r
-  /* Check if DMA Channel effectively disabled */\r
-  if(status != HAL_OK)\r
-  {\r
-    /* Update DAC state machine to error */\r
-    hdac->State = HAL_DAC_STATE_ERROR;      \r
-  }\r
-  else\r
-  {\r
-    /* Change DAC state */\r
-    hdac->State = HAL_DAC_STATE_READY;\r
-  }\r
-\r
-  /* Return function status */\r
-  return status;\r
-}\r
-\r
-/**\r
-  * @brief  Returns the last data output value of the selected DAC channel.\r
-  * @param  hdac: pointer to a DAC_HandleTypeDef structure that contains\r
-  *         the configuration information for the specified DAC.\r
-  * @param  Channel: The selected DAC channel. \r
-  *          This parameter can be one of the following values:\r
-  *            @arg DAC_CHANNEL_1: DAC Channel1 selected\r
-  *            @arg DAC_CHANNEL_2: DAC Channel2 selected\r
-  * @retval The selected DAC channel data output value.\r
-  */\r
-uint32_t HAL_DAC_GetValue(DAC_HandleTypeDef* hdac, uint32_t Channel)\r
-{\r
-  /* Check the parameters */\r
-  assert_param(IS_DAC_CHANNEL(Channel));\r
-  \r
-  /* Returns the DAC channel data output register value */\r
-  if(Channel == DAC_CHANNEL_1)\r
-  {\r
-    return hdac->Instance->DOR1;\r
-  }\r
-  else\r
-  {\r
-    return hdac->Instance->DOR2;\r
-  }\r
-}\r
-\r
-/**\r
-  * @brief  Handles DAC interrupt request  \r
-  * @param  hdac: pointer to a DAC_HandleTypeDef structure that contains\r
-  *         the configuration information for the specified DAC.\r
-  * @retval None\r
-  */\r
-void HAL_DAC_IRQHandler(DAC_HandleTypeDef* hdac)\r
-{\r
-  /* Check underrun channel 1 flag */\r
-  if(__HAL_DAC_GET_FLAG(hdac, DAC_FLAG_DMAUDR1))\r
-  {\r
-    /* Change DAC state to error state */\r
-    hdac->State = HAL_DAC_STATE_ERROR;\r
-    \r
-    /* Set DAC error code to channel1 DMA underrun error */\r
-    hdac->ErrorCode |= HAL_DAC_ERROR_DMAUNDERRUNCH1;\r
-    \r
-    /* Clear the underrun flag */\r
-    __HAL_DAC_CLEAR_FLAG(hdac,DAC_FLAG_DMAUDR1);\r
-    \r
-    /* Disable the selected DAC channel1 DMA request */\r
-    hdac->Instance->CR &= ~DAC_CR_DMAEN1;\r
-    \r
-    /* Error callback */ \r
-    HAL_DAC_DMAUnderrunCallbackCh1(hdac);\r
-  }\r
-  /* Check underrun channel 2 flag */\r
-  if(__HAL_DAC_GET_FLAG(hdac, DAC_FLAG_DMAUDR2))\r
-  {\r
-    /* Change DAC state to error state */\r
-    hdac->State = HAL_DAC_STATE_ERROR;\r
-    \r
-    /* Set DAC error code to channel2 DMA underrun error */\r
-    hdac->ErrorCode |= HAL_DAC_ERROR_DMAUNDERRUNCH2;\r
-    \r
-    /* Clear the underrun flag */\r
-    __HAL_DAC_CLEAR_FLAG(hdac,DAC_FLAG_DMAUDR2);\r
-    \r
-    /* Disable the selected DAC channel1 DMA request */\r
-    hdac->Instance->CR &= ~DAC_CR_DMAEN2;\r
-    \r
-    /* Error callback */ \r
-    HAL_DACEx_DMAUnderrunCallbackCh2(hdac);\r
-  }\r
-}\r
-\r
-/**\r
-  * @brief  Conversion complete callback in non blocking mode for Channel1 \r
-  * @param  hdac: pointer to a DAC_HandleTypeDef structure that contains\r
-  *         the configuration information for the specified DAC.\r
-  * @retval None\r
-  */\r
-__weak void HAL_DAC_ConvCpltCallbackCh1(DAC_HandleTypeDef* hdac)\r
-{\r
-  /* NOTE : This function Should not be modified, when the callback is needed,\r
-            the HAL_DAC_ConvCpltCallback could be implemented in the user file\r
-   */\r
-}\r
-\r
-/**\r
-  * @brief  Conversion half DMA transfer callback in non blocking mode for Channel1 \r
-  * @param  hdac: pointer to a DAC_HandleTypeDef structure that contains\r
-  *         the configuration information for the specified DAC.\r
-  * @retval None\r
-  */\r
-__weak void HAL_DAC_ConvHalfCpltCallbackCh1(DAC_HandleTypeDef* hdac)\r
-{\r
-  /* NOTE : This function Should not be modified, when the callback is needed,\r
-            the HAL_DAC_ConvHalfCpltCallbackCh1 could be implemented in the user file\r
-   */\r
-}\r
-\r
-/**\r
-  * @brief  Error DAC callback for Channel1.\r
-  * @param  hdac: pointer to a DAC_HandleTypeDef structure that contains\r
-  *         the configuration information for the specified DAC.\r
-  * @retval None\r
-  */\r
-__weak void HAL_DAC_ErrorCallbackCh1(DAC_HandleTypeDef *hdac)\r
-{\r
-  /* NOTE : This function Should not be modified, when the callback is needed,\r
-            the HAL_DAC_ErrorCallbackCh1 could be implemented in the user file\r
-   */\r
-}\r
-\r
-/**\r
-  * @brief  DMA underrun DAC callback for channel1.\r
-  * @param  hdac: pointer to a DAC_HandleTypeDef structure that contains\r
-  *         the configuration information for the specified DAC.\r
-  * @retval None\r
-  */\r
-__weak void HAL_DAC_DMAUnderrunCallbackCh1(DAC_HandleTypeDef *hdac)\r
-{\r
-  /* NOTE : This function Should not be modified, when the callback is needed,\r
-            the HAL_DAC_DMAUnderrunCallbackCh1 could be implemented in the user file\r
-   */\r
-}\r
-\r
-/**\r
-  * @}\r
-  */\r
-  \r
-/** @defgroup DAC_Exported_Functions_Group3 Peripheral Control functions\r
- *  @brief     Peripheral Control functions \r
- *\r
-@verbatim   \r
-  ==============================================================================\r
-             ##### Peripheral Control functions #####\r
-  ==============================================================================  \r
-    [..]  This section provides functions allowing to:\r
-      (+) Configure channels. \r
-      (+) Set the specified data holding register value for DAC channel.\r
-      \r
-@endverbatim\r
-  * @{\r
-  */\r
-\r
-/**\r
-  * @brief  Configures the selected DAC channel.\r
-  * @param  hdac: pointer to a DAC_HandleTypeDef structure that contains\r
-  *         the configuration information for the specified DAC.\r
-  * @param  sConfig: DAC configuration structure.\r
-  * @param  Channel: The selected DAC channel. \r
-  *          This parameter can be one of the following values:\r
-  *            @arg DAC_CHANNEL_1: DAC Channel1 selected\r
-  *            @arg DAC_CHANNEL_2: DAC Channel2 selected\r
-  * @retval HAL status\r
-  */\r
-HAL_StatusTypeDef HAL_DAC_ConfigChannel(DAC_HandleTypeDef* hdac, DAC_ChannelConfTypeDef* sConfig, uint32_t Channel)\r
-{\r
-  uint32_t tmpreg1 = 0, tmpreg2 = 0;\r
-\r
-  /* Check the DAC parameters */\r
-  assert_param(IS_DAC_TRIGGER(sConfig->DAC_Trigger));\r
-  assert_param(IS_DAC_OUTPUT_BUFFER_STATE(sConfig->DAC_OutputBuffer));\r
-  assert_param(IS_DAC_CHANNEL(Channel));\r
-  \r
-  /* Process locked */\r
-  __HAL_LOCK(hdac);\r
-  \r
-  /* Change DAC state */\r
-  hdac->State = HAL_DAC_STATE_BUSY;\r
-  \r
-  /* Get the DAC CR value */\r
-  tmpreg1 = hdac->Instance->CR;\r
-  /* Clear BOFFx, TENx, TSELx, WAVEx and MAMPx bits */\r
-  tmpreg1 &= ~(((uint32_t)(DAC_CR_MAMP1 | DAC_CR_WAVE1 | DAC_CR_TSEL1 | DAC_CR_TEN1 | DAC_CR_BOFF1)) << Channel);\r
-  /* Configure for the selected DAC channel: buffer output, trigger */\r
-  /* Set TSELx and TENx bits according to DAC_Trigger value */\r
-  /* Set BOFFx bit according to DAC_OutputBuffer value */   \r
-  tmpreg2 = (sConfig->DAC_Trigger | sConfig->DAC_OutputBuffer);\r
-  /* Calculate CR register value depending on DAC_Channel */\r
-  tmpreg1 |= tmpreg2 << Channel;\r
-  /* Write to DAC CR */\r
-  hdac->Instance->CR = tmpreg1;\r
-  /* Disable wave generation */\r
-  hdac->Instance->CR &= ~(DAC_CR_WAVE1 << Channel);\r
-  \r
-  /* Change DAC state */\r
-  hdac->State = HAL_DAC_STATE_READY;\r
-  \r
-  /* Process unlocked */\r
-  __HAL_UNLOCK(hdac);\r
-  \r
-  /* Return function status */\r
-  return HAL_OK;\r
-}\r
-\r
-/**\r
-  * @brief  Set the specified data holding register value for DAC channel.\r
-  * @param  hdac: pointer to a DAC_HandleTypeDef structure that contains\r
-  *         the configuration information for the specified DAC.\r
-  * @param  Channel: The selected DAC channel. \r
-  *          This parameter can be one of the following values:\r
-  *            @arg DAC_CHANNEL_1: DAC Channel1 selected\r
-  *            @arg DAC_CHANNEL_2: DAC Channel2 selected  \r
-  * @param  Alignment: Specifies the data alignment.\r
-  *          This parameter can be one of the following values:\r
-  *            @arg DAC_ALIGN_8B_R: 8bit right data alignment selected\r
-  *            @arg DAC_ALIGN_12B_L: 12bit left data alignment selected\r
-  *            @arg DAC_ALIGN_12B_R: 12bit right data alignment selected\r
-  * @param  Data: Data to be loaded in the selected data holding register.\r
-  * @retval HAL status\r
-  */\r
-HAL_StatusTypeDef HAL_DAC_SetValue(DAC_HandleTypeDef* hdac, uint32_t Channel, uint32_t Alignment, uint32_t Data)\r
-{  \r
-  __IO uint32_t tmp = 0;\r
-  \r
-  /* Check the parameters */\r
-  assert_param(IS_DAC_CHANNEL(Channel));\r
-  assert_param(IS_DAC_ALIGN(Alignment));\r
-  assert_param(IS_DAC_DATA(Data));\r
-  \r
-  tmp = (uint32_t)hdac->Instance; \r
-  if(Channel == DAC_CHANNEL_1)\r
-  {\r
-    tmp += DAC_DHR12R1_ALIGNMENT(Alignment);\r
-  }\r
-  else\r
-  {\r
-    tmp += DAC_DHR12R2_ALIGNMENT(Alignment);\r
-  }\r
-\r
-  /* Set the DAC channel1 selected data holding register */\r
-  *(__IO uint32_t *) tmp = Data;\r
-  \r
-  /* Return function status */\r
-  return HAL_OK;\r
-}\r
-\r
-/**\r
-  * @}\r
-  */\r
-\r
-/** @defgroup DAC_Exported_Functions_Group4 Peripheral State and Errors functions\r
- *  @brief   Peripheral State and Errors functions \r
- *\r
-@verbatim   \r
-  ==============================================================================\r
-            ##### Peripheral State and Errors functions #####\r
-  ==============================================================================  \r
-    [..]\r
-    This subsection provides functions allowing to\r
-      (+) Check the DAC state.\r
-      (+) Check the DAC Errors.\r
-        \r
-@endverbatim\r
-  * @{\r
-  */\r
-\r
-/**\r
-  * @brief  return the DAC state\r
-  * @param  hdac: pointer to a DAC_HandleTypeDef structure that contains\r
-  *         the configuration information for the specified DAC.\r
-  * @retval HAL state\r
-  */\r
-HAL_DAC_StateTypeDef HAL_DAC_GetState(DAC_HandleTypeDef* hdac)\r
-{\r
-  /* Return DAC state */\r
-  return hdac->State;\r
-}\r
-\r
-\r
-/**\r
-  * @brief  Return the DAC error code\r
-  * @param  hdac: pointer to a DAC_HandleTypeDef structure that contains\r
-  *         the configuration information for the specified DAC.\r
-  * @retval DAC Error Code\r
-  */\r
-uint32_t HAL_DAC_GetError(DAC_HandleTypeDef *hdac)\r
-{\r
-  return hdac->ErrorCode;\r
-}\r
-\r
-/**\r
-  * @}\r
-  */\r
-\r
-/**\r
-  * @brief  DMA conversion complete callback. \r
-  * @param  hdma: pointer to a DMA_HandleTypeDef structure that contains\r
-  *                the configuration information for the specified DMA module.\r
-  * @retval None\r
-  */\r
-static void DAC_DMAConvCpltCh1(DMA_HandleTypeDef *hdma)   \r
-{\r
-  DAC_HandleTypeDef* hdac = ( DAC_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent;\r
-  \r
-  HAL_DAC_ConvCpltCallbackCh1(hdac); \r
-  \r
-  hdac->State= HAL_DAC_STATE_READY;\r
-}\r
-\r
-/**\r
-  * @brief  DMA half transfer complete callback. \r
-  * @param  hdma: pointer to a DMA_HandleTypeDef structure that contains\r
-  *                the configuration information for the specified DMA module.\r
-  * @retval None\r
-  */\r
-static void DAC_DMAHalfConvCpltCh1(DMA_HandleTypeDef *hdma)   \r
-{\r
-    DAC_HandleTypeDef* hdac = ( DAC_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent;\r
-    /* Conversion complete callback */\r
-    HAL_DAC_ConvHalfCpltCallbackCh1(hdac); \r
-}\r
-\r
-/**\r
-  * @brief  DMA error callback \r
-  * @param  hdma: pointer to a DMA_HandleTypeDef structure that contains\r
-  *                the configuration information for the specified DMA module.\r
-  * @retval None\r
-  */\r
-static void DAC_DMAErrorCh1(DMA_HandleTypeDef *hdma)   \r
-{\r
-  DAC_HandleTypeDef* hdac = ( DAC_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent;\r
-    \r
-  /* Set DAC error code to DMA error */\r
-  hdac->ErrorCode |= HAL_DAC_ERROR_DMA;\r
-    \r
-  HAL_DAC_ErrorCallbackCh1(hdac); \r
-    \r
-  hdac->State= HAL_DAC_STATE_READY;\r
-}\r
-\r
-/**\r
-  * @}\r
-  */\r
-#endif /* STM32F756xx || STM32F746xx */\r
-#endif /* HAL_DAC_MODULE_ENABLED */\r
-\r
-/**\r
-  * @}\r
-  */\r
-\r
-/**\r
-  * @}\r
-  */\r
-\r
-/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/\r