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:
Thu Jul 02 16:30:08 2015 +0100
Revision:
581:39197bcd20f2
Parent:
532:fe11edbda85c
Child:
613:bc40b8d2aec4
Synchronized with git revision ae2d3cdffe70184eb8736d94f76c45c93f4b7724

Full URL: https://github.com/mbedmicro/mbed/commit/ae2d3cdffe70184eb8736d94f76c45c93f4b7724/

Make it possible to build the core mbed library with yotta

Who changed what in which revision?

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