mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

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

Committer:
mbed_official
Date:
Fri Aug 14 13:15:17 2015 +0100
Revision:
610:813dcc80987e
Synchronized with git revision 6d84db41c6833e0b9b024741eb0616a5f62d5599

Full URL: https://github.com/mbedmicro/mbed/commit/6d84db41c6833e0b9b024741eb0616a5f62d5599/

DISCO_F746NG - Improvements

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 610:813dcc80987e 1 /**
mbed_official 610:813dcc80987e 2 ******************************************************************************
mbed_official 610:813dcc80987e 3 * @file stm32l4xx_hal_dac_ex.c
mbed_official 610:813dcc80987e 4 * @author MCD Application Team
mbed_official 610:813dcc80987e 5 * @version V1.0.0
mbed_official 610:813dcc80987e 6 * @date 26-June-2015
mbed_official 610:813dcc80987e 7 * @brief DAC HAL module driver.
mbed_official 610:813dcc80987e 8 * This file provides firmware functions to manage the extended
mbed_official 610:813dcc80987e 9 * functionalities of the DAC peripheral.
mbed_official 610:813dcc80987e 10 *
mbed_official 610:813dcc80987e 11 *
mbed_official 610:813dcc80987e 12 @verbatim
mbed_official 610:813dcc80987e 13 ==============================================================================
mbed_official 610:813dcc80987e 14 ##### How to use this driver #####
mbed_official 610:813dcc80987e 15 ==============================================================================
mbed_official 610:813dcc80987e 16 [..]
mbed_official 610:813dcc80987e 17 (+) When Dual mode is enabled (i.e. DAC Channel1 and Channel2 are used simultaneously) :
mbed_official 610:813dcc80987e 18 Use HAL_DACEx_DualGetValue() to get digital data to be converted and use
mbed_official 610:813dcc80987e 19 HAL_DACEx_DualSetValue() to set digital value to converted simultaneously in Channel 1 and Channel 2.
mbed_official 610:813dcc80987e 20 (+) Use HAL_DACEx_TriangleWaveGenerate() to generate Triangle signal.
mbed_official 610:813dcc80987e 21 (+) Use HAL_DACEx_NoiseWaveGenerate() to generate Noise signal.
mbed_official 610:813dcc80987e 22
mbed_official 610:813dcc80987e 23 (+) HAL_DACEx_SelfCalibrate to calibrate one DAC channel.
mbed_official 610:813dcc80987e 24 (+) HAL_DACEx_SetUserTrimming to set user trimming value.
mbed_official 610:813dcc80987e 25 (+) HAL_DACEx_GetTrimOffset to retrieve trimming value (factory setting
mbed_official 610:813dcc80987e 26 after reset, user setting if HAL_DACEx_SetUserTrimming have been used
mbed_official 610:813dcc80987e 27 at least one time after reset).
mbed_official 610:813dcc80987e 28
mbed_official 610:813dcc80987e 29 @endverbatim
mbed_official 610:813dcc80987e 30 ******************************************************************************
mbed_official 610:813dcc80987e 31 * @attention
mbed_official 610:813dcc80987e 32 *
mbed_official 610:813dcc80987e 33 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
mbed_official 610:813dcc80987e 34 *
mbed_official 610:813dcc80987e 35 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 610:813dcc80987e 36 * are permitted provided that the following conditions are met:
mbed_official 610:813dcc80987e 37 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 610:813dcc80987e 38 * this list of conditions and the following disclaimer.
mbed_official 610:813dcc80987e 39 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 610:813dcc80987e 40 * this list of conditions and the following disclaimer in the documentation
mbed_official 610:813dcc80987e 41 * and/or other materials provided with the distribution.
mbed_official 610:813dcc80987e 42 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 610:813dcc80987e 43 * may be used to endorse or promote products derived from this software
mbed_official 610:813dcc80987e 44 * without specific prior written permission.
mbed_official 610:813dcc80987e 45 *
mbed_official 610:813dcc80987e 46 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 610:813dcc80987e 47 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 610:813dcc80987e 48 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 610:813dcc80987e 49 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 610:813dcc80987e 50 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 610:813dcc80987e 51 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 610:813dcc80987e 52 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 610:813dcc80987e 53 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 610:813dcc80987e 54 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 610:813dcc80987e 55 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 610:813dcc80987e 56 *
mbed_official 610:813dcc80987e 57 ******************************************************************************
mbed_official 610:813dcc80987e 58 */
mbed_official 610:813dcc80987e 59
mbed_official 610:813dcc80987e 60
mbed_official 610:813dcc80987e 61 /* Includes ------------------------------------------------------------------*/
mbed_official 610:813dcc80987e 62 #include "stm32l4xx_hal.h"
mbed_official 610:813dcc80987e 63
mbed_official 610:813dcc80987e 64 /** @addtogroup STM32L4xx_HAL_Driver
mbed_official 610:813dcc80987e 65 * @{
mbed_official 610:813dcc80987e 66 */
mbed_official 610:813dcc80987e 67
mbed_official 610:813dcc80987e 68 /** @defgroup DACEx DACEx
mbed_official 610:813dcc80987e 69 * @brief DAC Extended HAL module driver
mbed_official 610:813dcc80987e 70 * @{
mbed_official 610:813dcc80987e 71 */
mbed_official 610:813dcc80987e 72
mbed_official 610:813dcc80987e 73 #ifdef HAL_DAC_MODULE_ENABLED
mbed_official 610:813dcc80987e 74
mbed_official 610:813dcc80987e 75 /* Private typedef -----------------------------------------------------------*/
mbed_official 610:813dcc80987e 76 /* Private define ------------------------------------------------------------*/
mbed_official 610:813dcc80987e 77 /* Private macro -------------------------------------------------------------*/
mbed_official 610:813dcc80987e 78 /* Private variables ---------------------------------------------------------*/
mbed_official 610:813dcc80987e 79 /* Private function prototypes -----------------------------------------------*/
mbed_official 610:813dcc80987e 80 /* Exported functions --------------------------------------------------------*/
mbed_official 610:813dcc80987e 81
mbed_official 610:813dcc80987e 82 /** @defgroup DACEx_Exported_Functions DACEx Exported Functions
mbed_official 610:813dcc80987e 83 * @{
mbed_official 610:813dcc80987e 84 */
mbed_official 610:813dcc80987e 85
mbed_official 610:813dcc80987e 86 /** @defgroup DACEx_Exported_Functions_Group2 IO operation functions
mbed_official 610:813dcc80987e 87 * @brief Extended IO operation functions
mbed_official 610:813dcc80987e 88 *
mbed_official 610:813dcc80987e 89 @verbatim
mbed_official 610:813dcc80987e 90 ==============================================================================
mbed_official 610:813dcc80987e 91 ##### Extended features functions #####
mbed_official 610:813dcc80987e 92 ==============================================================================
mbed_official 610:813dcc80987e 93 [..] This section provides functions allowing to:
mbed_official 610:813dcc80987e 94 (+) Start conversion.
mbed_official 610:813dcc80987e 95 (+) Stop conversion.
mbed_official 610:813dcc80987e 96 (+) Start conversion and enable DMA transfer.
mbed_official 610:813dcc80987e 97 (+) Stop conversion and disable DMA transfer.
mbed_official 610:813dcc80987e 98 (+) Get result of conversion.
mbed_official 610:813dcc80987e 99 (+) Get result of dual mode conversion.
mbed_official 610:813dcc80987e 100
mbed_official 610:813dcc80987e 101 @endverbatim
mbed_official 610:813dcc80987e 102 * @{
mbed_official 610:813dcc80987e 103 */
mbed_official 610:813dcc80987e 104
mbed_official 610:813dcc80987e 105 /**
mbed_official 610:813dcc80987e 106 * @brief Enable or disable the selected DAC channel wave generation.
mbed_official 610:813dcc80987e 107 * @param hdac: pointer to a DAC_HandleTypeDef structure that contains
mbed_official 610:813dcc80987e 108 * the configuration information for the specified DAC.
mbed_official 610:813dcc80987e 109 * @param Channel: The selected DAC channel.
mbed_official 610:813dcc80987e 110 * This parameter can be one of the following values:
mbed_official 610:813dcc80987e 111 * DAC_CHANNEL_1 / DAC_CHANNEL_2
mbed_official 610:813dcc80987e 112 * @param Amplitude: Select max triangle amplitude.
mbed_official 610:813dcc80987e 113 * This parameter can be one of the following values:
mbed_official 610:813dcc80987e 114 * @arg DAC_TRIANGLEAMPLITUDE_1: Select max triangle amplitude of 1
mbed_official 610:813dcc80987e 115 * @arg DAC_TRIANGLEAMPLITUDE_3: Select max triangle amplitude of 3
mbed_official 610:813dcc80987e 116 * @arg DAC_TRIANGLEAMPLITUDE_7: Select max triangle amplitude of 7
mbed_official 610:813dcc80987e 117 * @arg DAC_TRIANGLEAMPLITUDE_15: Select max triangle amplitude of 15
mbed_official 610:813dcc80987e 118 * @arg DAC_TRIANGLEAMPLITUDE_31: Select max triangle amplitude of 31
mbed_official 610:813dcc80987e 119 * @arg DAC_TRIANGLEAMPLITUDE_63: Select max triangle amplitude of 63
mbed_official 610:813dcc80987e 120 * @arg DAC_TRIANGLEAMPLITUDE_127: Select max triangle amplitude of 127
mbed_official 610:813dcc80987e 121 * @arg DAC_TRIANGLEAMPLITUDE_255: Select max triangle amplitude of 255
mbed_official 610:813dcc80987e 122 * @arg DAC_TRIANGLEAMPLITUDE_511: Select max triangle amplitude of 511
mbed_official 610:813dcc80987e 123 * @arg DAC_TRIANGLEAMPLITUDE_1023: Select max triangle amplitude of 1023
mbed_official 610:813dcc80987e 124 * @arg DAC_TRIANGLEAMPLITUDE_2047: Select max triangle amplitude of 2047
mbed_official 610:813dcc80987e 125 * @arg DAC_TRIANGLEAMPLITUDE_4095: Select max triangle amplitude of 4095
mbed_official 610:813dcc80987e 126 * @retval HAL status
mbed_official 610:813dcc80987e 127 */
mbed_official 610:813dcc80987e 128 HAL_StatusTypeDef HAL_DACEx_TriangleWaveGenerate(DAC_HandleTypeDef* hdac, uint32_t Channel, uint32_t Amplitude)
mbed_official 610:813dcc80987e 129 {
mbed_official 610:813dcc80987e 130 /* Check the parameters */
mbed_official 610:813dcc80987e 131 assert_param(IS_DAC_CHANNEL(Channel));
mbed_official 610:813dcc80987e 132 assert_param(IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(Amplitude));
mbed_official 610:813dcc80987e 133
mbed_official 610:813dcc80987e 134 /* Process locked */
mbed_official 610:813dcc80987e 135 __HAL_LOCK(hdac);
mbed_official 610:813dcc80987e 136
mbed_official 610:813dcc80987e 137 /* Change DAC state */
mbed_official 610:813dcc80987e 138 hdac->State = HAL_DAC_STATE_BUSY;
mbed_official 610:813dcc80987e 139
mbed_official 610:813dcc80987e 140 /* Enable the triangle wave generation for the selected DAC channel */
mbed_official 610:813dcc80987e 141 MODIFY_REG(hdac->Instance->CR, ((DAC_CR_WAVE1)|(DAC_CR_MAMP1))<<Channel, (DAC_CR_WAVE1_1 | Amplitude) << Channel);
mbed_official 610:813dcc80987e 142
mbed_official 610:813dcc80987e 143 /* Change DAC state */
mbed_official 610:813dcc80987e 144 hdac->State = HAL_DAC_STATE_READY;
mbed_official 610:813dcc80987e 145
mbed_official 610:813dcc80987e 146 /* Process unlocked */
mbed_official 610:813dcc80987e 147 __HAL_UNLOCK(hdac);
mbed_official 610:813dcc80987e 148
mbed_official 610:813dcc80987e 149 /* Return function status */
mbed_official 610:813dcc80987e 150 return HAL_OK;
mbed_official 610:813dcc80987e 151 }
mbed_official 610:813dcc80987e 152
mbed_official 610:813dcc80987e 153 /**
mbed_official 610:813dcc80987e 154 * @brief Enable or disable the selected DAC channel wave generation.
mbed_official 610:813dcc80987e 155 * @param hdac: pointer to a DAC_HandleTypeDef structure that contains
mbed_official 610:813dcc80987e 156 * the configuration information for the specified DAC.
mbed_official 610:813dcc80987e 157 * @param Channel: The selected DAC channel.
mbed_official 610:813dcc80987e 158 * This parameter can be one of the following values:
mbed_official 610:813dcc80987e 159 * DAC_CHANNEL_1 / DAC_CHANNEL_2
mbed_official 610:813dcc80987e 160 * @param Amplitude: Unmask DAC channel LFSR for noise wave generation.
mbed_official 610:813dcc80987e 161 * This parameter can be one of the following values:
mbed_official 610:813dcc80987e 162 * @arg DAC_LFSRUNMASK_BIT0: Unmask DAC channel LFSR bit0 for noise wave generation
mbed_official 610:813dcc80987e 163 * @arg DAC_LFSRUNMASK_BITS1_0: Unmask DAC channel LFSR bit[1:0] for noise wave generation
mbed_official 610:813dcc80987e 164 * @arg DAC_LFSRUNMASK_BITS2_0: Unmask DAC channel LFSR bit[2:0] for noise wave generation
mbed_official 610:813dcc80987e 165 * @arg DAC_LFSRUNMASK_BITS3_0: Unmask DAC channel LFSR bit[3:0] for noise wave generation
mbed_official 610:813dcc80987e 166 * @arg DAC_LFSRUNMASK_BITS4_0: Unmask DAC channel LFSR bit[4:0] for noise wave generation
mbed_official 610:813dcc80987e 167 * @arg DAC_LFSRUNMASK_BITS5_0: Unmask DAC channel LFSR bit[5:0] for noise wave generation
mbed_official 610:813dcc80987e 168 * @arg DAC_LFSRUNMASK_BITS6_0: Unmask DAC channel LFSR bit[6:0] for noise wave generation
mbed_official 610:813dcc80987e 169 * @arg DAC_LFSRUNMASK_BITS7_0: Unmask DAC channel LFSR bit[7:0] for noise wave generation
mbed_official 610:813dcc80987e 170 * @arg DAC_LFSRUNMASK_BITS8_0: Unmask DAC channel LFSR bit[8:0] for noise wave generation
mbed_official 610:813dcc80987e 171 * @arg DAC_LFSRUNMASK_BITS9_0: Unmask DAC channel LFSR bit[9:0] for noise wave generation
mbed_official 610:813dcc80987e 172 * @arg DAC_LFSRUNMASK_BITS10_0: Unmask DAC channel LFSR bit[10:0] for noise wave generation
mbed_official 610:813dcc80987e 173 * @arg DAC_LFSRUNMASK_BITS11_0: Unmask DAC channel LFSR bit[11:0] for noise wave generation
mbed_official 610:813dcc80987e 174 * @retval HAL status
mbed_official 610:813dcc80987e 175 */
mbed_official 610:813dcc80987e 176 HAL_StatusTypeDef HAL_DACEx_NoiseWaveGenerate(DAC_HandleTypeDef* hdac, uint32_t Channel, uint32_t Amplitude)
mbed_official 610:813dcc80987e 177 {
mbed_official 610:813dcc80987e 178 /* Check the parameters */
mbed_official 610:813dcc80987e 179 assert_param(IS_DAC_CHANNEL(Channel));
mbed_official 610:813dcc80987e 180 assert_param(IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(Amplitude));
mbed_official 610:813dcc80987e 181
mbed_official 610:813dcc80987e 182 /* Process locked */
mbed_official 610:813dcc80987e 183 __HAL_LOCK(hdac);
mbed_official 610:813dcc80987e 184
mbed_official 610:813dcc80987e 185 /* Change DAC state */
mbed_official 610:813dcc80987e 186 hdac->State = HAL_DAC_STATE_BUSY;
mbed_official 610:813dcc80987e 187
mbed_official 610:813dcc80987e 188 /* Enable the noise wave generation for the selected DAC channel */
mbed_official 610:813dcc80987e 189 MODIFY_REG(hdac->Instance->CR, ((DAC_CR_WAVE1)|(DAC_CR_MAMP1))<<Channel, (DAC_CR_WAVE1_0 | Amplitude) << Channel);
mbed_official 610:813dcc80987e 190
mbed_official 610:813dcc80987e 191 /* Change DAC state */
mbed_official 610:813dcc80987e 192 hdac->State = HAL_DAC_STATE_READY;
mbed_official 610:813dcc80987e 193
mbed_official 610:813dcc80987e 194 /* Process unlocked */
mbed_official 610:813dcc80987e 195 __HAL_UNLOCK(hdac);
mbed_official 610:813dcc80987e 196
mbed_official 610:813dcc80987e 197 /* Return function status */
mbed_official 610:813dcc80987e 198 return HAL_OK;
mbed_official 610:813dcc80987e 199 }
mbed_official 610:813dcc80987e 200
mbed_official 610:813dcc80987e 201
mbed_official 610:813dcc80987e 202
mbed_official 610:813dcc80987e 203 /**
mbed_official 610:813dcc80987e 204 * @brief Set the specified data holding register value for dual DAC channel.
mbed_official 610:813dcc80987e 205 * @param hdac: pointer to a DAC_HandleTypeDef structure that contains
mbed_official 610:813dcc80987e 206 * the configuration information for the specified DAC.
mbed_official 610:813dcc80987e 207 * @param Alignment: Specifies the data alignment for dual channel DAC.
mbed_official 610:813dcc80987e 208 * This parameter can be one of the following values:
mbed_official 610:813dcc80987e 209 * DAC_ALIGN_8B_R: 8bit right data alignment selected
mbed_official 610:813dcc80987e 210 * DAC_ALIGN_12B_L: 12bit left data alignment selected
mbed_official 610:813dcc80987e 211 * DAC_ALIGN_12B_R: 12bit right data alignment selected
mbed_official 610:813dcc80987e 212 * @param Data1: Data for DAC Channel2 to be loaded in the selected data holding register.
mbed_official 610:813dcc80987e 213 * @param Data2: Data for DAC Channel1 to be loaded in the selected data holding register.
mbed_official 610:813dcc80987e 214 * @note In dual mode, a unique register access is required to write in both
mbed_official 610:813dcc80987e 215 * DAC channels at the same time.
mbed_official 610:813dcc80987e 216 * @retval HAL status
mbed_official 610:813dcc80987e 217 */
mbed_official 610:813dcc80987e 218 HAL_StatusTypeDef HAL_DACEx_DualSetValue(DAC_HandleTypeDef* hdac, uint32_t Alignment, uint32_t Data1, uint32_t Data2)
mbed_official 610:813dcc80987e 219 {
mbed_official 610:813dcc80987e 220 uint32_t data = 0, tmp = 0;
mbed_official 610:813dcc80987e 221
mbed_official 610:813dcc80987e 222 /* Check the parameters */
mbed_official 610:813dcc80987e 223 assert_param(IS_DAC_ALIGN(Alignment));
mbed_official 610:813dcc80987e 224 assert_param(IS_DAC_DATA(Data1));
mbed_official 610:813dcc80987e 225 assert_param(IS_DAC_DATA(Data2));
mbed_official 610:813dcc80987e 226
mbed_official 610:813dcc80987e 227 /* Calculate and set dual DAC data holding register value */
mbed_official 610:813dcc80987e 228 if (Alignment == DAC_ALIGN_8B_R)
mbed_official 610:813dcc80987e 229 {
mbed_official 610:813dcc80987e 230 data = ((uint32_t)Data2 << 8) | Data1;
mbed_official 610:813dcc80987e 231 }
mbed_official 610:813dcc80987e 232 else
mbed_official 610:813dcc80987e 233 {
mbed_official 610:813dcc80987e 234 data = ((uint32_t)Data2 << 16) | Data1;
mbed_official 610:813dcc80987e 235 }
mbed_official 610:813dcc80987e 236
mbed_official 610:813dcc80987e 237 tmp = (uint32_t)hdac->Instance;
mbed_official 610:813dcc80987e 238 tmp += DAC_DHR12RD_ALIGNMENT(Alignment);
mbed_official 610:813dcc80987e 239
mbed_official 610:813dcc80987e 240 /* Set the dual DAC selected data holding register */
mbed_official 610:813dcc80987e 241 *(__IO uint32_t *)tmp = data;
mbed_official 610:813dcc80987e 242
mbed_official 610:813dcc80987e 243 /* Return function status */
mbed_official 610:813dcc80987e 244 return HAL_OK;
mbed_official 610:813dcc80987e 245 }
mbed_official 610:813dcc80987e 246
mbed_official 610:813dcc80987e 247 /**
mbed_official 610:813dcc80987e 248 * @brief Conversion complete callback in non-blocking mode for Channel2.
mbed_official 610:813dcc80987e 249 * @param hdac: pointer to a DAC_HandleTypeDef structure that contains
mbed_official 610:813dcc80987e 250 * the configuration information for the specified DAC.
mbed_official 610:813dcc80987e 251 * @retval None
mbed_official 610:813dcc80987e 252 */
mbed_official 610:813dcc80987e 253 __weak void HAL_DACEx_ConvCpltCallbackCh2(DAC_HandleTypeDef* hdac)
mbed_official 610:813dcc80987e 254 {
mbed_official 610:813dcc80987e 255 /* NOTE : This function should not be modified, when the callback is needed,
mbed_official 610:813dcc80987e 256 the HAL_DACEx_ConvCpltCallbackCh2 could be implemented in the user file
mbed_official 610:813dcc80987e 257 */
mbed_official 610:813dcc80987e 258 }
mbed_official 610:813dcc80987e 259
mbed_official 610:813dcc80987e 260 /**
mbed_official 610:813dcc80987e 261 * @brief Conversion half DMA transfer callback in non-blocking mode for Channel2.
mbed_official 610:813dcc80987e 262 * @param hdac: pointer to a DAC_HandleTypeDef structure that contains
mbed_official 610:813dcc80987e 263 * the configuration information for the specified DAC.
mbed_official 610:813dcc80987e 264 * @retval None
mbed_official 610:813dcc80987e 265 */
mbed_official 610:813dcc80987e 266 __weak void HAL_DACEx_ConvHalfCpltCallbackCh2(DAC_HandleTypeDef* hdac)
mbed_official 610:813dcc80987e 267 {
mbed_official 610:813dcc80987e 268 /* NOTE : This function should not be modified, when the callback is needed,
mbed_official 610:813dcc80987e 269 the HAL_DACEx_ConvHalfCpltCallbackCh2 could be implemented in the user file
mbed_official 610:813dcc80987e 270 */
mbed_official 610:813dcc80987e 271 }
mbed_official 610:813dcc80987e 272
mbed_official 610:813dcc80987e 273 /**
mbed_official 610:813dcc80987e 274 * @brief Error DAC callback for Channel2.
mbed_official 610:813dcc80987e 275 * @param hdac: pointer to a DAC_HandleTypeDef structure that contains
mbed_official 610:813dcc80987e 276 * the configuration information for the specified DAC.
mbed_official 610:813dcc80987e 277 * @retval None
mbed_official 610:813dcc80987e 278 */
mbed_official 610:813dcc80987e 279 __weak void HAL_DACEx_ErrorCallbackCh2(DAC_HandleTypeDef *hdac)
mbed_official 610:813dcc80987e 280 {
mbed_official 610:813dcc80987e 281 /* NOTE : This function should not be modified, when the callback is needed,
mbed_official 610:813dcc80987e 282 the HAL_DACEx_ErrorCallbackCh2 could be implemented in the user file
mbed_official 610:813dcc80987e 283 */
mbed_official 610:813dcc80987e 284 }
mbed_official 610:813dcc80987e 285
mbed_official 610:813dcc80987e 286 /**
mbed_official 610:813dcc80987e 287 * @brief DMA underrun DAC callback for Channel2.
mbed_official 610:813dcc80987e 288 * @param hdac: pointer to a DAC_HandleTypeDef structure that contains
mbed_official 610:813dcc80987e 289 * the configuration information for the specified DAC.
mbed_official 610:813dcc80987e 290 * @retval None
mbed_official 610:813dcc80987e 291 */
mbed_official 610:813dcc80987e 292 __weak void HAL_DACEx_DMAUnderrunCallbackCh2(DAC_HandleTypeDef *hdac)
mbed_official 610:813dcc80987e 293 {
mbed_official 610:813dcc80987e 294 /* NOTE : This function should not be modified, when the callback is needed,
mbed_official 610:813dcc80987e 295 the HAL_DACEx_DMAUnderrunCallbackCh2 could be implemented in the user file
mbed_official 610:813dcc80987e 296 */
mbed_official 610:813dcc80987e 297 }
mbed_official 610:813dcc80987e 298
mbed_official 610:813dcc80987e 299 /**
mbed_official 610:813dcc80987e 300 * @brief Run the self calibration of one DAC channel.
mbed_official 610:813dcc80987e 301 * @param hdac: pointer to a DAC_HandleTypeDef structure that contains
mbed_official 610:813dcc80987e 302 * the configuration information for the specified DAC.
mbed_official 610:813dcc80987e 303 * @param sConfig: DAC channel configuration structure.
mbed_official 610:813dcc80987e 304 * @param Channel: The selected DAC channel.
mbed_official 610:813dcc80987e 305 * This parameter can be one of the following values:
mbed_official 610:813dcc80987e 306 * @arg DAC_CHANNEL_1: DAC Channel1 selected
mbed_official 610:813dcc80987e 307 * @arg DAC_CHANNEL_2: DAC Channel2 selected
mbed_official 610:813dcc80987e 308 * @retval Updates DAC_TrimmingValue. , DAC_UserTrimming set to DAC_UserTrimming
mbed_official 610:813dcc80987e 309 * @retval HAL status
mbed_official 610:813dcc80987e 310 * @note Calibration runs about 7 ms.
mbed_official 610:813dcc80987e 311 */
mbed_official 610:813dcc80987e 312
mbed_official 610:813dcc80987e 313 HAL_StatusTypeDef HAL_DACEx_SelfCalibrate (DAC_HandleTypeDef* hdac, DAC_ChannelConfTypeDef* sConfig, uint32_t Channel)
mbed_official 610:813dcc80987e 314 {
mbed_official 610:813dcc80987e 315 HAL_StatusTypeDef status = HAL_OK;
mbed_official 610:813dcc80987e 316
mbed_official 610:813dcc80987e 317 __IO uint32_t tmp = 0;
mbed_official 610:813dcc80987e 318 uint32_t trimmingvalue = 0;
mbed_official 610:813dcc80987e 319 uint32_t delta;
mbed_official 610:813dcc80987e 320
mbed_official 610:813dcc80987e 321 /* store/restore channel configuration structure purpose */
mbed_official 610:813dcc80987e 322 uint32_t oldmodeconfiguration = 0;
mbed_official 610:813dcc80987e 323
mbed_official 610:813dcc80987e 324 /* Check the parameters */
mbed_official 610:813dcc80987e 325 assert_param(IS_DAC_CHANNEL(Channel));
mbed_official 610:813dcc80987e 326
mbed_official 610:813dcc80987e 327 /* Check the DAC handle allocation */
mbed_official 610:813dcc80987e 328 /* Check if DAC running */
mbed_official 610:813dcc80987e 329 if((hdac == NULL) || (hdac->State == HAL_DAC_STATE_BUSY))
mbed_official 610:813dcc80987e 330 {
mbed_official 610:813dcc80987e 331 status = HAL_ERROR;
mbed_official 610:813dcc80987e 332 }
mbed_official 610:813dcc80987e 333
mbed_official 610:813dcc80987e 334 /* Process locked */
mbed_official 610:813dcc80987e 335 __HAL_LOCK(hdac);
mbed_official 610:813dcc80987e 336
mbed_official 610:813dcc80987e 337 /* Store configuration */
mbed_official 610:813dcc80987e 338 oldmodeconfiguration = (hdac->Instance->MCR & (DAC_MCR_MODE1 << Channel));
mbed_official 610:813dcc80987e 339
mbed_official 610:813dcc80987e 340 /* Disable the selected DAC channel */
mbed_official 610:813dcc80987e 341 CLEAR_BIT ((hdac->Instance->CR), (DAC_CR_EN1 << Channel));
mbed_official 610:813dcc80987e 342
mbed_official 610:813dcc80987e 343 /* Set mode in MCR for calibration */
mbed_official 610:813dcc80987e 344 MODIFY_REG(hdac->Instance->MCR, (DAC_MCR_MODE1 << Channel), 0);
mbed_official 610:813dcc80987e 345
mbed_official 610:813dcc80987e 346 /* Set DAC Channel1 DHR register to the middle value */
mbed_official 610:813dcc80987e 347 /* HAL_DAC_SetValue(hdac, Channel, DAC_ALIGN_12B_R, 0x0800); */
mbed_official 610:813dcc80987e 348 tmp = (uint32_t)hdac->Instance;
mbed_official 610:813dcc80987e 349 if(Channel == DAC_CHANNEL_1)
mbed_official 610:813dcc80987e 350 {
mbed_official 610:813dcc80987e 351 tmp += DAC_DHR12R1_ALIGNMENT(DAC_ALIGN_12B_R);
mbed_official 610:813dcc80987e 352 }
mbed_official 610:813dcc80987e 353 else
mbed_official 610:813dcc80987e 354 {
mbed_official 610:813dcc80987e 355 tmp += DAC_DHR12R2_ALIGNMENT(DAC_ALIGN_12B_R);
mbed_official 610:813dcc80987e 356 }
mbed_official 610:813dcc80987e 357 *(__IO uint32_t *) tmp = 0x0800;
mbed_official 610:813dcc80987e 358
mbed_official 610:813dcc80987e 359 /* Enable the selected DAC channel calibration */
mbed_official 610:813dcc80987e 360 /* i.e. set DAC_CR_CENx bit */
mbed_official 610:813dcc80987e 361 SET_BIT ((hdac->Instance->CR), (DAC_CR_CEN1 << Channel));
mbed_official 610:813dcc80987e 362
mbed_official 610:813dcc80987e 363 /* Init trimming counter */
mbed_official 610:813dcc80987e 364 /* Medium value */
mbed_official 610:813dcc80987e 365 trimmingvalue = 16;
mbed_official 610:813dcc80987e 366 delta = 8;
mbed_official 610:813dcc80987e 367 while (delta != 0)
mbed_official 610:813dcc80987e 368 {
mbed_official 610:813dcc80987e 369 /* Set candidate trimming */
mbed_official 610:813dcc80987e 370 MODIFY_REG(hdac->Instance->CCR, (DAC_CCR_OTRIM1<<Channel), (trimmingvalue<<Channel));
mbed_official 610:813dcc80987e 371
mbed_official 610:813dcc80987e 372 /* tOFFTRIMmax delay x ms as per datasheet (electrical characteristics */
mbed_official 610:813dcc80987e 373 /* i.e. minimum time needed between two calibration steps */
mbed_official 610:813dcc80987e 374 HAL_Delay(1);
mbed_official 610:813dcc80987e 375
mbed_official 610:813dcc80987e 376 if ((hdac->Instance->SR & (DAC_SR_CAL_FLAG1<<Channel)) == RESET)
mbed_official 610:813dcc80987e 377 {
mbed_official 610:813dcc80987e 378 /* DAC_SR_CAL_FLAGx is HIGH try higher trimming */
mbed_official 610:813dcc80987e 379 trimmingvalue += delta;
mbed_official 610:813dcc80987e 380 }
mbed_official 610:813dcc80987e 381 else
mbed_official 610:813dcc80987e 382 {
mbed_official 610:813dcc80987e 383 /* DAC_SR_CAL_FLAGx is LOW try lower trimming */
mbed_official 610:813dcc80987e 384 trimmingvalue -= delta;
mbed_official 610:813dcc80987e 385 }
mbed_official 610:813dcc80987e 386 delta >>= 1;
mbed_official 610:813dcc80987e 387 }
mbed_official 610:813dcc80987e 388
mbed_official 610:813dcc80987e 389 /* Still need to check if right calibration is current value or one step below */
mbed_official 610:813dcc80987e 390 /* Indeed the first value that causes the DAC_SR_CAL_FLAGx bit to change from 0 to 1 */
mbed_official 610:813dcc80987e 391 /* Set candidate trimming */
mbed_official 610:813dcc80987e 392 MODIFY_REG(hdac->Instance->CCR, (DAC_CCR_OTRIM1<<Channel), (trimmingvalue<<Channel));
mbed_official 610:813dcc80987e 393
mbed_official 610:813dcc80987e 394 /* tOFFTRIMmax delay x ms as per datasheet (electrical characteristics */
mbed_official 610:813dcc80987e 395 /* i.e. minimum time needed between two calibration steps */
mbed_official 610:813dcc80987e 396 HAL_Delay(1);
mbed_official 610:813dcc80987e 397
mbed_official 610:813dcc80987e 398 if ((hdac->Instance->SR & (DAC_SR_CAL_FLAG1<<Channel)) == RESET)
mbed_official 610:813dcc80987e 399 {
mbed_official 610:813dcc80987e 400 /* OPAMP_CSR_OUTCAL is actually one value more */
mbed_official 610:813dcc80987e 401 trimmingvalue++;
mbed_official 610:813dcc80987e 402 /* Set right trimming */
mbed_official 610:813dcc80987e 403 MODIFY_REG(hdac->Instance->CCR, (DAC_CCR_OTRIM1<<Channel), (trimmingvalue<<Channel));
mbed_official 610:813dcc80987e 404 }
mbed_official 610:813dcc80987e 405
mbed_official 610:813dcc80987e 406 /* Disable the selected DAC channel calibration */
mbed_official 610:813dcc80987e 407 /* i.e. clear DAC_CR_CENx bit */
mbed_official 610:813dcc80987e 408 CLEAR_BIT ((hdac->Instance->CR), (DAC_CR_CEN1 << Channel));
mbed_official 610:813dcc80987e 409
mbed_official 610:813dcc80987e 410 sConfig->DAC_TrimmingValue = trimmingvalue;
mbed_official 610:813dcc80987e 411 sConfig->DAC_UserTrimming = DAC_TRIMMING_USER;
mbed_official 610:813dcc80987e 412
mbed_official 610:813dcc80987e 413 /* Restore configuration */
mbed_official 610:813dcc80987e 414 MODIFY_REG(hdac->Instance->MCR, (DAC_MCR_MODE1 << Channel), oldmodeconfiguration);
mbed_official 610:813dcc80987e 415
mbed_official 610:813dcc80987e 416 /* Process unlocked */
mbed_official 610:813dcc80987e 417 __HAL_UNLOCK(hdac);
mbed_official 610:813dcc80987e 418
mbed_official 610:813dcc80987e 419 return status;
mbed_official 610:813dcc80987e 420 }
mbed_official 610:813dcc80987e 421
mbed_official 610:813dcc80987e 422 /**
mbed_official 610:813dcc80987e 423 * @brief Set the trimming mode and trimming value (user trimming mode applied).
mbed_official 610:813dcc80987e 424 * @param hdac: pointer to a DAC_HandleTypeDef structure that contains
mbed_official 610:813dcc80987e 425 * the configuration information for the specified DAC.
mbed_official 610:813dcc80987e 426 * @param sConfig: DAC configuration structure updated with new DAC trimming value.
mbed_official 610:813dcc80987e 427 * @param Channel: The selected DAC channel.
mbed_official 610:813dcc80987e 428 * This parameter can be one of the following values:
mbed_official 610:813dcc80987e 429 * @arg DAC_CHANNEL_1: DAC Channel1 selected
mbed_official 610:813dcc80987e 430 * @arg DAC_CHANNEL_2: DAC Channel2 selected
mbed_official 610:813dcc80987e 431 * @param NewTrimmingValue: DAC new trimming value
mbed_official 610:813dcc80987e 432 * @retval HAL status
mbed_official 610:813dcc80987e 433 */
mbed_official 610:813dcc80987e 434
mbed_official 610:813dcc80987e 435 HAL_StatusTypeDef HAL_DACEx_SetUserTrimming (DAC_HandleTypeDef* hdac, DAC_ChannelConfTypeDef* sConfig, uint32_t Channel, uint32_t NewTrimmingValue)
mbed_official 610:813dcc80987e 436 {
mbed_official 610:813dcc80987e 437 HAL_StatusTypeDef status = HAL_OK;
mbed_official 610:813dcc80987e 438
mbed_official 610:813dcc80987e 439 /* Check the parameters */
mbed_official 610:813dcc80987e 440 assert_param(IS_DAC_CHANNEL(Channel));
mbed_official 610:813dcc80987e 441 assert_param(IS_DAC_NEWTRIMMINGVALUE(NewTrimmingValue));
mbed_official 610:813dcc80987e 442
mbed_official 610:813dcc80987e 443 /* Check the DAC handle allocation */
mbed_official 610:813dcc80987e 444 if(hdac == NULL)
mbed_official 610:813dcc80987e 445 {
mbed_official 610:813dcc80987e 446 status = HAL_ERROR;
mbed_official 610:813dcc80987e 447 }
mbed_official 610:813dcc80987e 448
mbed_official 610:813dcc80987e 449 /* Process locked */
mbed_official 610:813dcc80987e 450 __HAL_LOCK(hdac);
mbed_official 610:813dcc80987e 451
mbed_official 610:813dcc80987e 452 /* Set new trimming */
mbed_official 610:813dcc80987e 453 MODIFY_REG(hdac->Instance->CCR, (DAC_CCR_OTRIM1<<Channel), (NewTrimmingValue<<Channel));
mbed_official 610:813dcc80987e 454
mbed_official 610:813dcc80987e 455 /* Update trimming mode */
mbed_official 610:813dcc80987e 456 sConfig->DAC_UserTrimming = DAC_TRIMMING_USER;
mbed_official 610:813dcc80987e 457 sConfig->DAC_TrimmingValue = NewTrimmingValue;
mbed_official 610:813dcc80987e 458
mbed_official 610:813dcc80987e 459 /* Process unlocked */
mbed_official 610:813dcc80987e 460 __HAL_UNLOCK(hdac);
mbed_official 610:813dcc80987e 461
mbed_official 610:813dcc80987e 462 return status;
mbed_official 610:813dcc80987e 463 }
mbed_official 610:813dcc80987e 464
mbed_official 610:813dcc80987e 465 /**
mbed_official 610:813dcc80987e 466 * @brief Return the DAC trimming value.
mbed_official 610:813dcc80987e 467 * @param hdac : DAC handle
mbed_official 610:813dcc80987e 468 * @param Channel: The selected DAC channel.
mbed_official 610:813dcc80987e 469 * This parameter can be one of the following values:
mbed_official 610:813dcc80987e 470 * @arg DAC_CHANNEL_1: DAC Channel1 selected
mbed_official 610:813dcc80987e 471 * @arg DAC_CHANNEL_2: DAC Channel2 selected
mbed_official 610:813dcc80987e 472 * @retval Trimming value : range: 0->31
mbed_official 610:813dcc80987e 473 *
mbed_official 610:813dcc80987e 474 */
mbed_official 610:813dcc80987e 475
mbed_official 610:813dcc80987e 476 uint32_t HAL_DACEx_GetTrimOffset (DAC_HandleTypeDef *hdac, uint32_t Channel)
mbed_official 610:813dcc80987e 477 {
mbed_official 610:813dcc80987e 478 uint32_t trimmingvalue = 0;
mbed_official 610:813dcc80987e 479
mbed_official 610:813dcc80987e 480 /* Check the DAC handle allocation */
mbed_official 610:813dcc80987e 481 /* And not in Reset state */
mbed_official 610:813dcc80987e 482 if((hdac == NULL) || (hdac->State == HAL_DAC_STATE_RESET))
mbed_official 610:813dcc80987e 483 {
mbed_official 610:813dcc80987e 484 return HAL_ERROR;
mbed_official 610:813dcc80987e 485 }
mbed_official 610:813dcc80987e 486 else
mbed_official 610:813dcc80987e 487 {
mbed_official 610:813dcc80987e 488 /* Check the parameter */
mbed_official 610:813dcc80987e 489 assert_param(IS_DAC_CHANNEL(Channel));
mbed_official 610:813dcc80987e 490
mbed_official 610:813dcc80987e 491 /* Retrieve trimming */
mbed_official 610:813dcc80987e 492 trimmingvalue = ((hdac->Instance->CCR & (DAC_CCR_OTRIM1 << Channel)) >> Channel);
mbed_official 610:813dcc80987e 493 }
mbed_official 610:813dcc80987e 494 return trimmingvalue;
mbed_official 610:813dcc80987e 495 }
mbed_official 610:813dcc80987e 496
mbed_official 610:813dcc80987e 497 /**
mbed_official 610:813dcc80987e 498 * @}
mbed_official 610:813dcc80987e 499 */
mbed_official 610:813dcc80987e 500
mbed_official 610:813dcc80987e 501 /** @defgroup DACEx_Exported_Functions_Group3 Peripheral Control functions
mbed_official 610:813dcc80987e 502 * @brief Extended Peripheral Control functions
mbed_official 610:813dcc80987e 503 *
mbed_official 610:813dcc80987e 504 @verbatim
mbed_official 610:813dcc80987e 505 ==============================================================================
mbed_official 610:813dcc80987e 506 ##### Peripheral Control functions #####
mbed_official 610:813dcc80987e 507 ==============================================================================
mbed_official 610:813dcc80987e 508 [..] This section provides functions allowing to:
mbed_official 610:813dcc80987e 509 (+) Configure channels.
mbed_official 610:813dcc80987e 510 (+) Set the specified data holding register value for DAC channel.
mbed_official 610:813dcc80987e 511
mbed_official 610:813dcc80987e 512 @endverbatim
mbed_official 610:813dcc80987e 513 * @{
mbed_official 610:813dcc80987e 514 */
mbed_official 610:813dcc80987e 515
mbed_official 610:813dcc80987e 516 /**
mbed_official 610:813dcc80987e 517 * @brief Return the last data output value of the selected DAC channel.
mbed_official 610:813dcc80987e 518 * @param hdac: pointer to a DAC_HandleTypeDef structure that contains
mbed_official 610:813dcc80987e 519 * the configuration information for the specified DAC.
mbed_official 610:813dcc80987e 520 * @retval The selected DAC channel data output value.
mbed_official 610:813dcc80987e 521 */
mbed_official 610:813dcc80987e 522 uint32_t HAL_DACEx_DualGetValue(DAC_HandleTypeDef* hdac)
mbed_official 610:813dcc80987e 523 {
mbed_official 610:813dcc80987e 524 uint32_t tmp = 0;
mbed_official 610:813dcc80987e 525
mbed_official 610:813dcc80987e 526 tmp |= hdac->Instance->DOR1;
mbed_official 610:813dcc80987e 527
mbed_official 610:813dcc80987e 528 tmp |= hdac->Instance->DOR2 << 16;
mbed_official 610:813dcc80987e 529
mbed_official 610:813dcc80987e 530 /* Returns the DAC channel data output register value */
mbed_official 610:813dcc80987e 531 return tmp;
mbed_official 610:813dcc80987e 532 }
mbed_official 610:813dcc80987e 533
mbed_official 610:813dcc80987e 534 /**
mbed_official 610:813dcc80987e 535 * @}
mbed_official 610:813dcc80987e 536 */
mbed_official 610:813dcc80987e 537
mbed_official 610:813dcc80987e 538 /**
mbed_official 610:813dcc80987e 539 * @}
mbed_official 610:813dcc80987e 540 */
mbed_official 610:813dcc80987e 541
mbed_official 610:813dcc80987e 542 /* Private functions ---------------------------------------------------------*/
mbed_official 610:813dcc80987e 543 /** @defgroup DACEx_Private_Functions DACEx private functions
mbed_official 610:813dcc80987e 544 * @brief Extended private functions
mbed_official 610:813dcc80987e 545 * @{
mbed_official 610:813dcc80987e 546 */
mbed_official 610:813dcc80987e 547
mbed_official 610:813dcc80987e 548 /**
mbed_official 610:813dcc80987e 549 * @brief DMA conversion complete callback.
mbed_official 610:813dcc80987e 550 * @param hdma: pointer to a DMA_HandleTypeDef structure that contains
mbed_official 610:813dcc80987e 551 * the configuration information for the specified DMA module.
mbed_official 610:813dcc80987e 552 * @retval None
mbed_official 610:813dcc80987e 553 */
mbed_official 610:813dcc80987e 554 void DAC_DMAConvCpltCh2(DMA_HandleTypeDef *hdma)
mbed_official 610:813dcc80987e 555 {
mbed_official 610:813dcc80987e 556 DAC_HandleTypeDef* hdac = ( DAC_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent;
mbed_official 610:813dcc80987e 557
mbed_official 610:813dcc80987e 558 HAL_DACEx_ConvCpltCallbackCh2(hdac);
mbed_official 610:813dcc80987e 559
mbed_official 610:813dcc80987e 560 hdac->State= HAL_DAC_STATE_READY;
mbed_official 610:813dcc80987e 561 }
mbed_official 610:813dcc80987e 562
mbed_official 610:813dcc80987e 563 /**
mbed_official 610:813dcc80987e 564 * @brief DMA half transfer complete callback.
mbed_official 610:813dcc80987e 565 * @param hdma: pointer to a DMA_HandleTypeDef structure that contains
mbed_official 610:813dcc80987e 566 * the configuration information for the specified DMA module.
mbed_official 610:813dcc80987e 567 * @retval None
mbed_official 610:813dcc80987e 568 */
mbed_official 610:813dcc80987e 569 void DAC_DMAHalfConvCpltCh2(DMA_HandleTypeDef *hdma)
mbed_official 610:813dcc80987e 570 {
mbed_official 610:813dcc80987e 571 DAC_HandleTypeDef* hdac = ( DAC_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent;
mbed_official 610:813dcc80987e 572 /* Conversion complete callback */
mbed_official 610:813dcc80987e 573 HAL_DACEx_ConvHalfCpltCallbackCh2(hdac);
mbed_official 610:813dcc80987e 574 }
mbed_official 610:813dcc80987e 575
mbed_official 610:813dcc80987e 576 /**
mbed_official 610:813dcc80987e 577 * @brief DMA error callback.
mbed_official 610:813dcc80987e 578 * @param hdma: pointer to a DMA_HandleTypeDef structure that contains
mbed_official 610:813dcc80987e 579 * the configuration information for the specified DMA module.
mbed_official 610:813dcc80987e 580 * @retval None
mbed_official 610:813dcc80987e 581 */
mbed_official 610:813dcc80987e 582 void DAC_DMAErrorCh2(DMA_HandleTypeDef *hdma)
mbed_official 610:813dcc80987e 583 {
mbed_official 610:813dcc80987e 584 DAC_HandleTypeDef* hdac = ( DAC_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent;
mbed_official 610:813dcc80987e 585
mbed_official 610:813dcc80987e 586 /* Set DAC error code to DMA error */
mbed_official 610:813dcc80987e 587 hdac->ErrorCode |= HAL_DAC_ERROR_DMA;
mbed_official 610:813dcc80987e 588
mbed_official 610:813dcc80987e 589 HAL_DACEx_ErrorCallbackCh2(hdac);
mbed_official 610:813dcc80987e 590
mbed_official 610:813dcc80987e 591 hdac->State= HAL_DAC_STATE_READY;
mbed_official 610:813dcc80987e 592 }
mbed_official 610:813dcc80987e 593
mbed_official 610:813dcc80987e 594 /**
mbed_official 610:813dcc80987e 595 * @}
mbed_official 610:813dcc80987e 596 */
mbed_official 610:813dcc80987e 597
mbed_official 610:813dcc80987e 598 #endif /* HAL_DAC_MODULE_ENABLED */
mbed_official 610:813dcc80987e 599
mbed_official 610:813dcc80987e 600 /**
mbed_official 610:813dcc80987e 601 * @}
mbed_official 610:813dcc80987e 602 */
mbed_official 610:813dcc80987e 603
mbed_official 610:813dcc80987e 604 /**
mbed_official 610:813dcc80987e 605 * @}
mbed_official 610:813dcc80987e 606 */
mbed_official 610:813dcc80987e 607
mbed_official 610:813dcc80987e 608 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/