mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
AnnaBridge
Date:
Thu Apr 19 17:12:19 2018 +0100
Revision:
184:08ed48f1de7f
Parent:
149:156823d33999
mbed-dev library. Release version 161

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 149:156823d33999 1 /**
<> 149:156823d33999 2 ******************************************************************************
<> 149:156823d33999 3 * @file stm32l1xx_hal_dac_ex.c
<> 149:156823d33999 4 * @author MCD Application Team
<> 149:156823d33999 5 * @brief DAC HAL module driver.
<> 149:156823d33999 6 * This file provides firmware functions to manage the following
<> 149:156823d33999 7 * functionalities of DAC extension peripheral:
<> 149:156823d33999 8 * + Extended features functions
<> 149:156823d33999 9 *
<> 149:156823d33999 10 *
<> 149:156823d33999 11 @verbatim
<> 149:156823d33999 12 ==============================================================================
<> 149:156823d33999 13 ##### How to use this driver #####
<> 149:156823d33999 14 ==============================================================================
<> 149:156823d33999 15 [..]
<> 149:156823d33999 16 (+) When Dual mode is enabled (i.e DAC Channel1 and Channel2 are used simultaneously) :
<> 149:156823d33999 17 Use HAL_DACEx_DualGetValue() to get digital data to be converted and use
<> 149:156823d33999 18 HAL_DACEx_DualSetValue() to set digital value to converted simultaneously in Channel 1 and Channel 2.
<> 149:156823d33999 19 (+) Use HAL_DACEx_TriangleWaveGenerate() to generate Triangle signal.
<> 149:156823d33999 20 (+) Use HAL_DACEx_NoiseWaveGenerate() to generate Noise signal.
<> 149:156823d33999 21
<> 149:156823d33999 22 @endverbatim
<> 149:156823d33999 23 ******************************************************************************
<> 149:156823d33999 24 * @attention
<> 149:156823d33999 25 *
AnnaBridge 184:08ed48f1de7f 26 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
<> 149:156823d33999 27 *
<> 149:156823d33999 28 * Redistribution and use in source and binary forms, with or without modification,
<> 149:156823d33999 29 * are permitted provided that the following conditions are met:
<> 149:156823d33999 30 * 1. Redistributions of source code must retain the above copyright notice,
<> 149:156823d33999 31 * this list of conditions and the following disclaimer.
<> 149:156823d33999 32 * 2. Redistributions in binary form must reproduce the above copyright notice,
<> 149:156823d33999 33 * this list of conditions and the following disclaimer in the documentation
<> 149:156823d33999 34 * and/or other materials provided with the distribution.
<> 149:156823d33999 35 * 3. Neither the name of STMicroelectronics nor the names of its contributors
<> 149:156823d33999 36 * may be used to endorse or promote products derived from this software
<> 149:156823d33999 37 * without specific prior written permission.
<> 149:156823d33999 38 *
<> 149:156823d33999 39 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
<> 149:156823d33999 40 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
<> 149:156823d33999 41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
<> 149:156823d33999 42 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
<> 149:156823d33999 43 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
<> 149:156823d33999 44 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
<> 149:156823d33999 45 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
<> 149:156823d33999 46 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
<> 149:156823d33999 47 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
<> 149:156823d33999 48 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<> 149:156823d33999 49 *
<> 149:156823d33999 50 ******************************************************************************
<> 149:156823d33999 51 */
<> 149:156823d33999 52
<> 149:156823d33999 53
<> 149:156823d33999 54 /* Includes ------------------------------------------------------------------*/
<> 149:156823d33999 55 #include "stm32l1xx_hal.h"
<> 149:156823d33999 56
<> 149:156823d33999 57 /** @addtogroup STM32L1xx_HAL_Driver
<> 149:156823d33999 58 * @{
<> 149:156823d33999 59 */
<> 149:156823d33999 60
<> 149:156823d33999 61 /** @defgroup DACEx DACEx
<> 149:156823d33999 62 * @brief DAC driver modules
<> 149:156823d33999 63 * @{
<> 149:156823d33999 64 */
<> 149:156823d33999 65
<> 149:156823d33999 66 #ifdef HAL_DAC_MODULE_ENABLED
<> 149:156823d33999 67
<> 149:156823d33999 68 /* Private typedef -----------------------------------------------------------*/
<> 149:156823d33999 69 /* Private define ------------------------------------------------------------*/
<> 149:156823d33999 70 /* Private macro -------------------------------------------------------------*/
<> 149:156823d33999 71 /* Private variables ---------------------------------------------------------*/
<> 149:156823d33999 72 /* Private function prototypes -----------------------------------------------*/
<> 149:156823d33999 73 /* Private functions ---------------------------------------------------------*/
<> 149:156823d33999 74
<> 149:156823d33999 75 /** @defgroup DACEx_Exported_Functions DACEx Exported Functions
<> 149:156823d33999 76 * @{
<> 149:156823d33999 77 */
<> 149:156823d33999 78
<> 149:156823d33999 79 /** @defgroup DACEx_Exported_Functions_Group1 Extended features functions
<> 149:156823d33999 80 * @brief Extended features functions
<> 149:156823d33999 81 *
<> 149:156823d33999 82 @verbatim
<> 149:156823d33999 83 ==============================================================================
<> 149:156823d33999 84 ##### Extended features functions #####
<> 149:156823d33999 85 ==============================================================================
<> 149:156823d33999 86 [..] This section provides functions allowing to:
<> 149:156823d33999 87 (+) Start conversion.
<> 149:156823d33999 88 (+) Stop conversion.
<> 149:156823d33999 89 (+) Start conversion and enable DMA transfer.
<> 149:156823d33999 90 (+) Stop conversion and disable DMA transfer.
<> 149:156823d33999 91 (+) Get result of conversion.
<> 149:156823d33999 92 (+) Get result of dual mode conversion.
<> 149:156823d33999 93
<> 149:156823d33999 94 @endverbatim
<> 149:156823d33999 95 * @{
<> 149:156823d33999 96 */
<> 149:156823d33999 97
<> 149:156823d33999 98 /**
<> 149:156823d33999 99 * @brief Returns the last data output value of the selected DAC channel.
<> 149:156823d33999 100 * @param hdac: pointer to a DAC_HandleTypeDef structure that contains
<> 149:156823d33999 101 * the configuration information for the specified DAC.
<> 149:156823d33999 102 * @retval The selected DAC channel data output value.
<> 149:156823d33999 103 */
<> 149:156823d33999 104 uint32_t HAL_DACEx_DualGetValue(DAC_HandleTypeDef* hdac)
<> 149:156823d33999 105 {
<> 149:156823d33999 106 uint32_t tmp = 0;
<> 149:156823d33999 107
<> 149:156823d33999 108 tmp |= hdac->Instance->DOR1;
<> 149:156823d33999 109
<> 149:156823d33999 110 tmp |= hdac->Instance->DOR2 << 16;
<> 149:156823d33999 111
<> 149:156823d33999 112 /* Returns the DAC channel data output register value */
<> 149:156823d33999 113 return tmp;
<> 149:156823d33999 114 }
<> 149:156823d33999 115
<> 149:156823d33999 116 /**
<> 149:156823d33999 117 * @brief Enables or disables the selected DAC channel wave generation.
<> 149:156823d33999 118 * @param hdac: pointer to a DAC_HandleTypeDef structure that contains
<> 149:156823d33999 119 * the configuration information for the specified DAC.
<> 149:156823d33999 120 * @param Channel: The selected DAC channel.
<> 149:156823d33999 121 * This parameter can be one of the following values:
<> 149:156823d33999 122 * DAC_CHANNEL_1 / DAC_CHANNEL_2
<> 149:156823d33999 123 * @param Amplitude: Select max triangle amplitude.
<> 149:156823d33999 124 * This parameter can be one of the following values:
<> 149:156823d33999 125 * @arg DAC_TRIANGLEAMPLITUDE_1: Select max triangle amplitude of 1
<> 149:156823d33999 126 * @arg DAC_TRIANGLEAMPLITUDE_3: Select max triangle amplitude of 3
<> 149:156823d33999 127 * @arg DAC_TRIANGLEAMPLITUDE_7: Select max triangle amplitude of 7
<> 149:156823d33999 128 * @arg DAC_TRIANGLEAMPLITUDE_15: Select max triangle amplitude of 15
<> 149:156823d33999 129 * @arg DAC_TRIANGLEAMPLITUDE_31: Select max triangle amplitude of 31
<> 149:156823d33999 130 * @arg DAC_TRIANGLEAMPLITUDE_63: Select max triangle amplitude of 63
<> 149:156823d33999 131 * @arg DAC_TRIANGLEAMPLITUDE_127: Select max triangle amplitude of 127
<> 149:156823d33999 132 * @arg DAC_TRIANGLEAMPLITUDE_255: Select max triangle amplitude of 255
<> 149:156823d33999 133 * @arg DAC_TRIANGLEAMPLITUDE_511: Select max triangle amplitude of 511
<> 149:156823d33999 134 * @arg DAC_TRIANGLEAMPLITUDE_1023: Select max triangle amplitude of 1023
<> 149:156823d33999 135 * @arg DAC_TRIANGLEAMPLITUDE_2047: Select max triangle amplitude of 2047
<> 149:156823d33999 136 * @arg DAC_TRIANGLEAMPLITUDE_4095: Select max triangle amplitude of 4095
<> 149:156823d33999 137 * @retval HAL status
<> 149:156823d33999 138 */
<> 149:156823d33999 139 HAL_StatusTypeDef HAL_DACEx_TriangleWaveGenerate(DAC_HandleTypeDef* hdac, uint32_t Channel, uint32_t Amplitude)
<> 149:156823d33999 140 {
<> 149:156823d33999 141 /* Check the parameters */
<> 149:156823d33999 142 assert_param(IS_DAC_CHANNEL(Channel));
<> 149:156823d33999 143 assert_param(IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(Amplitude));
<> 149:156823d33999 144
<> 149:156823d33999 145 /* Process locked */
<> 149:156823d33999 146 __HAL_LOCK(hdac);
<> 149:156823d33999 147
<> 149:156823d33999 148 /* Change DAC state */
<> 149:156823d33999 149 hdac->State = HAL_DAC_STATE_BUSY;
<> 149:156823d33999 150
<> 149:156823d33999 151 /* Enable the selected wave generation for the selected DAC channel */
<> 149:156823d33999 152 MODIFY_REG(hdac->Instance->CR, ((DAC_CR_WAVE1)|(DAC_CR_MAMP1))<<Channel, (DAC_CR_WAVE1_1 | Amplitude) << Channel);
<> 149:156823d33999 153
<> 149:156823d33999 154 /* Change DAC state */
<> 149:156823d33999 155 hdac->State = HAL_DAC_STATE_READY;
<> 149:156823d33999 156
<> 149:156823d33999 157 /* Process unlocked */
<> 149:156823d33999 158 __HAL_UNLOCK(hdac);
<> 149:156823d33999 159
<> 149:156823d33999 160 /* Return function status */
<> 149:156823d33999 161 return HAL_OK;
<> 149:156823d33999 162 }
<> 149:156823d33999 163
<> 149:156823d33999 164 /**
<> 149:156823d33999 165 * @brief Enables or disables the selected DAC channel wave generation.
<> 149:156823d33999 166 * @param hdac: pointer to a DAC_HandleTypeDef structure that contains
<> 149:156823d33999 167 * the configuration information for the specified DAC.
<> 149:156823d33999 168 * @param Channel: The selected DAC channel.
<> 149:156823d33999 169 * This parameter can be one of the following values:
<> 149:156823d33999 170 * DAC_CHANNEL_1 / DAC_CHANNEL_2
<> 149:156823d33999 171 * @param Amplitude: Unmask DAC channel LFSR for noise wave generation.
<> 149:156823d33999 172 * This parameter can be one of the following values:
<> 149:156823d33999 173 * @arg DAC_LFSRUNMASK_BIT0: Unmask DAC channel LFSR bit0 for noise wave generation
<> 149:156823d33999 174 * @arg DAC_LFSRUNMASK_BITS1_0: Unmask DAC channel LFSR bit[1:0] for noise wave generation
<> 149:156823d33999 175 * @arg DAC_LFSRUNMASK_BITS2_0: Unmask DAC channel LFSR bit[2:0] for noise wave generation
<> 149:156823d33999 176 * @arg DAC_LFSRUNMASK_BITS3_0: Unmask DAC channel LFSR bit[3:0] for noise wave generation
<> 149:156823d33999 177 * @arg DAC_LFSRUNMASK_BITS4_0: Unmask DAC channel LFSR bit[4:0] for noise wave generation
<> 149:156823d33999 178 * @arg DAC_LFSRUNMASK_BITS5_0: Unmask DAC channel LFSR bit[5:0] for noise wave generation
<> 149:156823d33999 179 * @arg DAC_LFSRUNMASK_BITS6_0: Unmask DAC channel LFSR bit[6:0] for noise wave generation
<> 149:156823d33999 180 * @arg DAC_LFSRUNMASK_BITS7_0: Unmask DAC channel LFSR bit[7:0] for noise wave generation
<> 149:156823d33999 181 * @arg DAC_LFSRUNMASK_BITS8_0: Unmask DAC channel LFSR bit[8:0] for noise wave generation
<> 149:156823d33999 182 * @arg DAC_LFSRUNMASK_BITS9_0: Unmask DAC channel LFSR bit[9:0] for noise wave generation
<> 149:156823d33999 183 * @arg DAC_LFSRUNMASK_BITS10_0: Unmask DAC channel LFSR bit[10:0] for noise wave generation
<> 149:156823d33999 184 * @arg DAC_LFSRUNMASK_BITS11_0: Unmask DAC channel LFSR bit[11:0] for noise wave generation
<> 149:156823d33999 185 * @retval HAL status
<> 149:156823d33999 186 */
<> 149:156823d33999 187 HAL_StatusTypeDef HAL_DACEx_NoiseWaveGenerate(DAC_HandleTypeDef* hdac, uint32_t Channel, uint32_t Amplitude)
<> 149:156823d33999 188 {
<> 149:156823d33999 189 /* Check the parameters */
<> 149:156823d33999 190 assert_param(IS_DAC_CHANNEL(Channel));
<> 149:156823d33999 191 assert_param(IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(Amplitude));
<> 149:156823d33999 192
<> 149:156823d33999 193 /* Process locked */
<> 149:156823d33999 194 __HAL_LOCK(hdac);
<> 149:156823d33999 195
<> 149:156823d33999 196 /* Change DAC state */
<> 149:156823d33999 197 hdac->State = HAL_DAC_STATE_BUSY;
<> 149:156823d33999 198
<> 149:156823d33999 199 /* Enable the selected wave generation for the selected DAC channel */
<> 149:156823d33999 200 MODIFY_REG(hdac->Instance->CR, ((DAC_CR_WAVE1)|(DAC_CR_MAMP1))<<Channel, (DAC_CR_WAVE1_0 | Amplitude) << Channel);
<> 149:156823d33999 201
<> 149:156823d33999 202 /* Change DAC state */
<> 149:156823d33999 203 hdac->State = HAL_DAC_STATE_READY;
<> 149:156823d33999 204
<> 149:156823d33999 205 /* Process unlocked */
<> 149:156823d33999 206 __HAL_UNLOCK(hdac);
<> 149:156823d33999 207
<> 149:156823d33999 208 /* Return function status */
<> 149:156823d33999 209 return HAL_OK;
<> 149:156823d33999 210 }
<> 149:156823d33999 211
<> 149:156823d33999 212 /**
<> 149:156823d33999 213 * @brief Set the specified data holding register value for dual DAC channel.
<> 149:156823d33999 214 * @param hdac: pointer to a DAC_HandleTypeDef structure that contains
<> 149:156823d33999 215 * the configuration information for the specified DAC.
<> 149:156823d33999 216 * @param Alignment: Specifies the data alignment for dual channel DAC.
<> 149:156823d33999 217 * This parameter can be one of the following values:
<> 149:156823d33999 218 * DAC_ALIGN_8B_R: 8bit right data alignment selected
<> 149:156823d33999 219 * DAC_ALIGN_12B_L: 12bit left data alignment selected
<> 149:156823d33999 220 * DAC_ALIGN_12B_R: 12bit right data alignment selected
<> 149:156823d33999 221 * @param Data1: Data for DAC Channel2 to be loaded in the selected data holding register.
<> 149:156823d33999 222 * @param Data2: Data for DAC Channel1 to be loaded in the selected data holding register.
<> 149:156823d33999 223 * @note In dual mode, a unique register access is required to write in both
<> 149:156823d33999 224 * DAC channels at the same time.
<> 149:156823d33999 225 * @retval HAL status
<> 149:156823d33999 226 */
<> 149:156823d33999 227 HAL_StatusTypeDef HAL_DACEx_DualSetValue(DAC_HandleTypeDef* hdac, uint32_t Alignment, uint32_t Data1, uint32_t Data2)
<> 149:156823d33999 228 {
<> 149:156823d33999 229 uint32_t data = 0, tmp = 0;
<> 149:156823d33999 230
<> 149:156823d33999 231 /* Check the parameters */
<> 149:156823d33999 232 assert_param(IS_DAC_ALIGN(Alignment));
<> 149:156823d33999 233 assert_param(IS_DAC_DATA(Data1));
<> 149:156823d33999 234 assert_param(IS_DAC_DATA(Data2));
<> 149:156823d33999 235
<> 149:156823d33999 236 /* Calculate and set dual DAC data holding register value */
<> 149:156823d33999 237 if (Alignment == DAC_ALIGN_8B_R)
<> 149:156823d33999 238 {
<> 149:156823d33999 239 data = ((uint32_t)Data2 << 8) | Data1;
<> 149:156823d33999 240 }
<> 149:156823d33999 241 else
<> 149:156823d33999 242 {
<> 149:156823d33999 243 data = ((uint32_t)Data2 << 16) | Data1;
<> 149:156823d33999 244 }
<> 149:156823d33999 245
<> 149:156823d33999 246 tmp = (uint32_t)hdac->Instance;
<> 149:156823d33999 247 tmp += DAC_DHR12RD_ALIGNMENT(Alignment);
<> 149:156823d33999 248
<> 149:156823d33999 249 /* Set the dual DAC selected data holding register */
<> 149:156823d33999 250 *(__IO uint32_t *)tmp = data;
<> 149:156823d33999 251
<> 149:156823d33999 252 /* Return function status */
<> 149:156823d33999 253 return HAL_OK;
<> 149:156823d33999 254 }
<> 149:156823d33999 255
<> 149:156823d33999 256
<> 149:156823d33999 257 /**
<> 149:156823d33999 258 * @brief Conversion complete callback in non blocking mode for Channel2
<> 149:156823d33999 259 * @param hdac: pointer to a DAC_HandleTypeDef structure that contains
<> 149:156823d33999 260 * the configuration information for the specified DAC.
<> 149:156823d33999 261 * @retval None
<> 149:156823d33999 262 */
<> 149:156823d33999 263 __weak void HAL_DACEx_ConvCpltCallbackCh2(DAC_HandleTypeDef* hdac)
<> 149:156823d33999 264 {
<> 149:156823d33999 265 /* Prevent unused argument(s) compilation warning */
<> 149:156823d33999 266 UNUSED(hdac);
<> 149:156823d33999 267
<> 149:156823d33999 268 /* NOTE : This function Should not be modified, when the callback is needed,
<> 149:156823d33999 269 the HAL_DACEx_ConvCpltCallbackCh2 could be implemented in the user file
<> 149:156823d33999 270 */
<> 149:156823d33999 271 }
<> 149:156823d33999 272
<> 149:156823d33999 273 /**
<> 149:156823d33999 274 * @brief Conversion half DMA transfer callback in non blocking mode for Channel2
<> 149:156823d33999 275 * @param hdac: pointer to a DAC_HandleTypeDef structure that contains
<> 149:156823d33999 276 * the configuration information for the specified DAC.
<> 149:156823d33999 277 * @retval None
<> 149:156823d33999 278 */
<> 149:156823d33999 279 __weak void HAL_DACEx_ConvHalfCpltCallbackCh2(DAC_HandleTypeDef* hdac)
<> 149:156823d33999 280 {
<> 149:156823d33999 281 /* Prevent unused argument(s) compilation warning */
<> 149:156823d33999 282 UNUSED(hdac);
<> 149:156823d33999 283
<> 149:156823d33999 284 /* NOTE : This function Should not be modified, when the callback is needed,
<> 149:156823d33999 285 the HAL_DACEx_ConvHalfCpltCallbackCh2 could be implemented in the user file
<> 149:156823d33999 286 */
<> 149:156823d33999 287 }
<> 149:156823d33999 288
<> 149:156823d33999 289 /**
<> 149:156823d33999 290 * @brief Error DAC callback for Channel2.
<> 149:156823d33999 291 * @param hdac: pointer to a DAC_HandleTypeDef structure that contains
<> 149:156823d33999 292 * the configuration information for the specified DAC.
<> 149:156823d33999 293 * @retval None
<> 149:156823d33999 294 */
<> 149:156823d33999 295 __weak void HAL_DACEx_ErrorCallbackCh2(DAC_HandleTypeDef *hdac)
<> 149:156823d33999 296 {
<> 149:156823d33999 297 /* Prevent unused argument(s) compilation warning */
<> 149:156823d33999 298 UNUSED(hdac);
<> 149:156823d33999 299
<> 149:156823d33999 300 /* NOTE : This function Should not be modified, when the callback is needed,
<> 149:156823d33999 301 the HAL_DACEx_ErrorCallbackCh2 could be implemented in the user file
<> 149:156823d33999 302 */
<> 149:156823d33999 303 }
<> 149:156823d33999 304
<> 149:156823d33999 305 /**
<> 149:156823d33999 306 * @brief DMA underrun DAC callback for channel2.
<> 149:156823d33999 307 * @param hdac: pointer to a DAC_HandleTypeDef structure that contains
<> 149:156823d33999 308 * the configuration information for the specified DAC.
<> 149:156823d33999 309 * @retval None
<> 149:156823d33999 310 */
<> 149:156823d33999 311 __weak void HAL_DACEx_DMAUnderrunCallbackCh2(DAC_HandleTypeDef *hdac)
<> 149:156823d33999 312 {
<> 149:156823d33999 313 /* Prevent unused argument(s) compilation warning */
<> 149:156823d33999 314 UNUSED(hdac);
<> 149:156823d33999 315
<> 149:156823d33999 316 /* NOTE : This function Should not be modified, when the callback is needed,
<> 149:156823d33999 317 the HAL_DAC_DMAUnderrunCallbackCh2 could be implemented in the user file
<> 149:156823d33999 318 */
<> 149:156823d33999 319 }
<> 149:156823d33999 320
<> 149:156823d33999 321 /**
<> 149:156823d33999 322 * @}
<> 149:156823d33999 323 */
<> 149:156823d33999 324
<> 149:156823d33999 325 /**
<> 149:156823d33999 326 * @}
<> 149:156823d33999 327 */
<> 149:156823d33999 328
<> 149:156823d33999 329 /** @defgroup DACEx_Private_Functions DACEx Private Functions
<> 149:156823d33999 330 * @{
<> 149:156823d33999 331 */
<> 149:156823d33999 332 /**
<> 149:156823d33999 333 * @brief DMA conversion complete callback.
<> 149:156823d33999 334 * @param hdma: pointer to a DMA_HandleTypeDef structure that contains
<> 149:156823d33999 335 * the configuration information for the specified DMA module.
<> 149:156823d33999 336 * @retval None
<> 149:156823d33999 337 */
<> 149:156823d33999 338 void DAC_DMAConvCpltCh2(DMA_HandleTypeDef *hdma)
<> 149:156823d33999 339 {
<> 149:156823d33999 340 DAC_HandleTypeDef* hdac = ( DAC_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent;
<> 149:156823d33999 341
<> 149:156823d33999 342 HAL_DACEx_ConvCpltCallbackCh2(hdac);
<> 149:156823d33999 343
<> 149:156823d33999 344 hdac->State= HAL_DAC_STATE_READY;
<> 149:156823d33999 345 }
<> 149:156823d33999 346
<> 149:156823d33999 347 /**
<> 149:156823d33999 348 * @brief DMA half transfer complete callback.
<> 149:156823d33999 349 * @param hdma: pointer to a DMA_HandleTypeDef structure that contains
<> 149:156823d33999 350 * the configuration information for the specified DMA module.
<> 149:156823d33999 351 * @retval None
<> 149:156823d33999 352 */
<> 149:156823d33999 353 void DAC_DMAHalfConvCpltCh2(DMA_HandleTypeDef *hdma)
<> 149:156823d33999 354 {
<> 149:156823d33999 355 DAC_HandleTypeDef* hdac = ( DAC_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent;
<> 149:156823d33999 356 /* Conversion complete callback */
<> 149:156823d33999 357 HAL_DACEx_ConvHalfCpltCallbackCh2(hdac);
<> 149:156823d33999 358 }
<> 149:156823d33999 359
<> 149:156823d33999 360 /**
<> 149:156823d33999 361 * @brief DMA error callback
<> 149:156823d33999 362 * @param hdma: pointer to a DMA_HandleTypeDef structure that contains
<> 149:156823d33999 363 * the configuration information for the specified DMA module.
<> 149:156823d33999 364 * @retval None
<> 149:156823d33999 365 */
<> 149:156823d33999 366 void DAC_DMAErrorCh2(DMA_HandleTypeDef *hdma)
<> 149:156823d33999 367 {
<> 149:156823d33999 368 DAC_HandleTypeDef* hdac = ( DAC_HandleTypeDef* )((DMA_HandleTypeDef* )hdma)->Parent;
<> 149:156823d33999 369
<> 149:156823d33999 370 /* Set DAC error code to DMA error */
<> 149:156823d33999 371 hdac->ErrorCode |= HAL_DAC_ERROR_DMA;
<> 149:156823d33999 372
<> 149:156823d33999 373 HAL_DACEx_ErrorCallbackCh2(hdac);
<> 149:156823d33999 374
<> 149:156823d33999 375 hdac->State= HAL_DAC_STATE_READY;
<> 149:156823d33999 376 }
<> 149:156823d33999 377
<> 149:156823d33999 378 /**
<> 149:156823d33999 379 * @}
<> 149:156823d33999 380 */
<> 149:156823d33999 381
<> 149:156823d33999 382 #endif /* HAL_DAC_MODULE_ENABLED */
<> 149:156823d33999 383
<> 149:156823d33999 384 /**
<> 149:156823d33999 385 * @}
<> 149:156823d33999 386 */
<> 149:156823d33999 387
<> 149:156823d33999 388 /**
<> 149:156823d33999 389 * @}
<> 149:156823d33999 390 */
<> 149:156823d33999 391
<> 149:156823d33999 392 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/