Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
Kojto
Date:
Tue Mar 15 14:34:00 2016 +0000
Revision:
116:c0f6e94411f5
Parent:
115:87f2f5183dfb
Release 116 of the mbed library

Changes:
- new targets - NUCLEO_L073RZ
- fixes to IOTSS BEID platform
- LPC824, LPC1549 and LPC11U68 - fix PWMOut SCT bugs
- STM32F7 - Cube driver
- STM32F4 - add RTC LSI macro, defined as 0
- STM32F3 - fix multiple ADC clock initialization
- retarget - binary mode fix for GCC

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 115:87f2f5183dfb 1 /**
Kojto 115:87f2f5183dfb 2 ******************************************************************************
Kojto 115:87f2f5183dfb 3 * @file stm32f7xx_hal_dac.h
Kojto 115:87f2f5183dfb 4 * @author MCD Application Team
Kojto 116:c0f6e94411f5 5 * @version V1.0.4
Kojto 116:c0f6e94411f5 6 * @date 09-December-2015
Kojto 115:87f2f5183dfb 7 * @brief Header file of DAC HAL module.
Kojto 115:87f2f5183dfb 8 ******************************************************************************
Kojto 115:87f2f5183dfb 9 * @attention
Kojto 115:87f2f5183dfb 10 *
Kojto 115:87f2f5183dfb 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
Kojto 115:87f2f5183dfb 12 *
Kojto 115:87f2f5183dfb 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 115:87f2f5183dfb 14 * are permitted provided that the following conditions are met:
Kojto 115:87f2f5183dfb 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 115:87f2f5183dfb 16 * this list of conditions and the following disclaimer.
Kojto 115:87f2f5183dfb 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 115:87f2f5183dfb 18 * this list of conditions and the following disclaimer in the documentation
Kojto 115:87f2f5183dfb 19 * and/or other materials provided with the distribution.
Kojto 115:87f2f5183dfb 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 115:87f2f5183dfb 21 * may be used to endorse or promote products derived from this software
Kojto 115:87f2f5183dfb 22 * without specific prior written permission.
Kojto 115:87f2f5183dfb 23 *
Kojto 115:87f2f5183dfb 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 115:87f2f5183dfb 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 115:87f2f5183dfb 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 115:87f2f5183dfb 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 115:87f2f5183dfb 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 115:87f2f5183dfb 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 115:87f2f5183dfb 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 115:87f2f5183dfb 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 115:87f2f5183dfb 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 115:87f2f5183dfb 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 115:87f2f5183dfb 34 *
Kojto 115:87f2f5183dfb 35 ******************************************************************************
Kojto 115:87f2f5183dfb 36 */
Kojto 115:87f2f5183dfb 37
Kojto 115:87f2f5183dfb 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 115:87f2f5183dfb 39 #ifndef __STM32F7xx_HAL_DAC_H
Kojto 115:87f2f5183dfb 40 #define __STM32F7xx_HAL_DAC_H
Kojto 115:87f2f5183dfb 41
Kojto 115:87f2f5183dfb 42 #ifdef __cplusplus
Kojto 115:87f2f5183dfb 43 extern "C" {
Kojto 115:87f2f5183dfb 44 #endif
Kojto 115:87f2f5183dfb 45
Kojto 115:87f2f5183dfb 46 /* Includes ------------------------------------------------------------------*/
Kojto 115:87f2f5183dfb 47 #include "stm32f7xx_hal_def.h"
Kojto 115:87f2f5183dfb 48
Kojto 115:87f2f5183dfb 49 /** @addtogroup STM32F7xx_HAL_Driver
Kojto 115:87f2f5183dfb 50 * @{
Kojto 115:87f2f5183dfb 51 */
Kojto 115:87f2f5183dfb 52
Kojto 115:87f2f5183dfb 53 /** @addtogroup DAC
Kojto 115:87f2f5183dfb 54 * @{
Kojto 115:87f2f5183dfb 55 */
Kojto 115:87f2f5183dfb 56
Kojto 115:87f2f5183dfb 57 /* Exported types ------------------------------------------------------------*/
Kojto 115:87f2f5183dfb 58 /** @defgroup DAC_Exported_Types DAC Exported Types
Kojto 115:87f2f5183dfb 59 * @{
Kojto 115:87f2f5183dfb 60 */
Kojto 115:87f2f5183dfb 61
Kojto 115:87f2f5183dfb 62 /**
Kojto 115:87f2f5183dfb 63 * @brief HAL State structures definition
Kojto 115:87f2f5183dfb 64 */
Kojto 115:87f2f5183dfb 65 typedef enum
Kojto 115:87f2f5183dfb 66 {
Kojto 115:87f2f5183dfb 67 HAL_DAC_STATE_RESET = 0x00, /*!< DAC not yet initialized or disabled */
Kojto 115:87f2f5183dfb 68 HAL_DAC_STATE_READY = 0x01, /*!< DAC initialized and ready for use */
Kojto 115:87f2f5183dfb 69 HAL_DAC_STATE_BUSY = 0x02, /*!< DAC internal processing is ongoing */
Kojto 115:87f2f5183dfb 70 HAL_DAC_STATE_TIMEOUT = 0x03, /*!< DAC timeout state */
Kojto 115:87f2f5183dfb 71 HAL_DAC_STATE_ERROR = 0x04 /*!< DAC error state */
Kojto 115:87f2f5183dfb 72 }HAL_DAC_StateTypeDef;
Kojto 115:87f2f5183dfb 73
Kojto 115:87f2f5183dfb 74 /**
Kojto 115:87f2f5183dfb 75 * @brief DAC handle Structure definition
Kojto 115:87f2f5183dfb 76 */
Kojto 115:87f2f5183dfb 77 typedef struct
Kojto 115:87f2f5183dfb 78 {
Kojto 115:87f2f5183dfb 79 DAC_TypeDef *Instance; /*!< Register base address */
Kojto 115:87f2f5183dfb 80
Kojto 115:87f2f5183dfb 81 __IO HAL_DAC_StateTypeDef State; /*!< DAC communication state */
Kojto 115:87f2f5183dfb 82
Kojto 115:87f2f5183dfb 83 HAL_LockTypeDef Lock; /*!< DAC locking object */
Kojto 115:87f2f5183dfb 84
Kojto 115:87f2f5183dfb 85 DMA_HandleTypeDef *DMA_Handle1; /*!< Pointer DMA handler for channel 1 */
Kojto 115:87f2f5183dfb 86
Kojto 115:87f2f5183dfb 87 DMA_HandleTypeDef *DMA_Handle2; /*!< Pointer DMA handler for channel 2 */
Kojto 115:87f2f5183dfb 88
Kojto 115:87f2f5183dfb 89 __IO uint32_t ErrorCode; /*!< DAC Error code */
Kojto 115:87f2f5183dfb 90
Kojto 115:87f2f5183dfb 91 }DAC_HandleTypeDef;
Kojto 115:87f2f5183dfb 92
Kojto 115:87f2f5183dfb 93 /**
Kojto 115:87f2f5183dfb 94 * @brief DAC Configuration regular Channel structure definition
Kojto 115:87f2f5183dfb 95 */
Kojto 115:87f2f5183dfb 96 typedef struct
Kojto 115:87f2f5183dfb 97 {
Kojto 115:87f2f5183dfb 98 uint32_t DAC_Trigger; /*!< Specifies the external trigger for the selected DAC channel.
Kojto 115:87f2f5183dfb 99 This parameter can be a value of @ref DAC_trigger_selection */
Kojto 115:87f2f5183dfb 100
Kojto 115:87f2f5183dfb 101 uint32_t DAC_OutputBuffer; /*!< Specifies whether the DAC channel output buffer is enabled or disabled.
Kojto 115:87f2f5183dfb 102 This parameter can be a value of @ref DAC_output_buffer */
Kojto 115:87f2f5183dfb 103 }DAC_ChannelConfTypeDef;
Kojto 115:87f2f5183dfb 104 /**
Kojto 115:87f2f5183dfb 105 * @}
Kojto 115:87f2f5183dfb 106 */
Kojto 115:87f2f5183dfb 107
Kojto 115:87f2f5183dfb 108 /* Exported constants --------------------------------------------------------*/
Kojto 115:87f2f5183dfb 109 /** @defgroup DAC_Exported_Constants DAC Exported Constants
Kojto 115:87f2f5183dfb 110 * @{
Kojto 115:87f2f5183dfb 111 */
Kojto 115:87f2f5183dfb 112
Kojto 115:87f2f5183dfb 113 /** @defgroup DAC_Error_Code DAC Error Code
Kojto 115:87f2f5183dfb 114 * @{
Kojto 115:87f2f5183dfb 115 */
Kojto 115:87f2f5183dfb 116 #define HAL_DAC_ERROR_NONE 0x00 /*!< No error */
Kojto 115:87f2f5183dfb 117 #define HAL_DAC_ERROR_DMAUNDERRUNCH1 0x01 /*!< DAC channel1 DAM underrun error */
Kojto 115:87f2f5183dfb 118 #define HAL_DAC_ERROR_DMAUNDERRUNCH2 0x02 /*!< DAC channel2 DAM underrun error */
Kojto 115:87f2f5183dfb 119 #define HAL_DAC_ERROR_DMA 0x04 /*!< DMA error */
Kojto 115:87f2f5183dfb 120 /**
Kojto 115:87f2f5183dfb 121 * @}
Kojto 115:87f2f5183dfb 122 */
Kojto 115:87f2f5183dfb 123
Kojto 115:87f2f5183dfb 124 /** @defgroup DAC_trigger_selection DAC Trigger Selection
Kojto 115:87f2f5183dfb 125 * @{
Kojto 115:87f2f5183dfb 126 */
Kojto 115:87f2f5183dfb 127
Kojto 115:87f2f5183dfb 128 #define DAC_TRIGGER_NONE ((uint32_t)0x00000000) /*!< Conversion is automatic once the DAC1_DHRxxxx register
Kojto 115:87f2f5183dfb 129 has been loaded, and not by external trigger */
Kojto 115:87f2f5183dfb 130 #define DAC_TRIGGER_T2_TRGO ((uint32_t)(DAC_CR_TSEL1_2 | DAC_CR_TEN1)) /*!< TIM2 TRGO selected as external conversion trigger for DAC channel */
Kojto 115:87f2f5183dfb 131 #define DAC_TRIGGER_T4_TRGO ((uint32_t)(DAC_CR_TSEL1_2 | DAC_CR_TSEL1_0 | DAC_CR_TEN1)) /*!< TIM4 TRGO selected as external conversion trigger for DAC channel */
Kojto 115:87f2f5183dfb 132 #define DAC_TRIGGER_T5_TRGO ((uint32_t)(DAC_CR_TSEL1_1 | DAC_CR_TSEL1_0 | DAC_CR_TEN1)) /*!< TIM5 TRGO selected as external conversion trigger for DAC channel */
Kojto 115:87f2f5183dfb 133 #define DAC_TRIGGER_T6_TRGO ((uint32_t)DAC_CR_TEN1) /*!< TIM6 TRGO selected as external conversion trigger for DAC channel */
Kojto 115:87f2f5183dfb 134 #define DAC_TRIGGER_T7_TRGO ((uint32_t)(DAC_CR_TSEL1_1 | DAC_CR_TEN1)) /*!< TIM7 TRGO selected as external conversion trigger for DAC channel */
Kojto 115:87f2f5183dfb 135 #define DAC_TRIGGER_T8_TRGO ((uint32_t)(DAC_CR_TSEL1_0 | DAC_CR_TEN1)) /*!< TIM8 TRGO selected as external conversion trigger for DAC channel */
Kojto 115:87f2f5183dfb 136
Kojto 115:87f2f5183dfb 137 #define DAC_TRIGGER_EXT_IT9 ((uint32_t)(DAC_CR_TSEL1_2 | DAC_CR_TSEL1_1 | DAC_CR_TEN1)) /*!< EXTI Line9 event selected as external conversion trigger for DAC channel */
Kojto 115:87f2f5183dfb 138 #define DAC_TRIGGER_SOFTWARE ((uint32_t)(DAC_CR_TSEL1 | DAC_CR_TEN1)) /*!< Conversion started by software trigger for DAC channel */
Kojto 115:87f2f5183dfb 139 /**
Kojto 115:87f2f5183dfb 140 * @}
Kojto 115:87f2f5183dfb 141 */
Kojto 115:87f2f5183dfb 142
Kojto 115:87f2f5183dfb 143 /** @defgroup DAC_output_buffer DAC Output Buffer
Kojto 115:87f2f5183dfb 144 * @{
Kojto 115:87f2f5183dfb 145 */
Kojto 115:87f2f5183dfb 146 #define DAC_OUTPUTBUFFER_ENABLE ((uint32_t)0x00000000)
Kojto 115:87f2f5183dfb 147 #define DAC_OUTPUTBUFFER_DISABLE ((uint32_t)DAC_CR_BOFF1)
Kojto 115:87f2f5183dfb 148 /**
Kojto 115:87f2f5183dfb 149 * @}
Kojto 115:87f2f5183dfb 150 */
Kojto 115:87f2f5183dfb 151
Kojto 115:87f2f5183dfb 152 /** @defgroup DAC_Channel_selection DAC Channel Selection
Kojto 115:87f2f5183dfb 153 * @{
Kojto 115:87f2f5183dfb 154 */
Kojto 115:87f2f5183dfb 155 #define DAC_CHANNEL_1 ((uint32_t)0x00000000)
Kojto 115:87f2f5183dfb 156 #define DAC_CHANNEL_2 ((uint32_t)0x00000010)
Kojto 115:87f2f5183dfb 157 /**
Kojto 115:87f2f5183dfb 158 * @}
Kojto 115:87f2f5183dfb 159 */
Kojto 115:87f2f5183dfb 160
Kojto 115:87f2f5183dfb 161 /** @defgroup DAC_data_alignment DAC Data Alignment
Kojto 115:87f2f5183dfb 162 * @{
Kojto 115:87f2f5183dfb 163 */
Kojto 115:87f2f5183dfb 164 #define DAC_ALIGN_12B_R ((uint32_t)0x00000000)
Kojto 115:87f2f5183dfb 165 #define DAC_ALIGN_12B_L ((uint32_t)0x00000004)
Kojto 115:87f2f5183dfb 166 #define DAC_ALIGN_8B_R ((uint32_t)0x00000008)
Kojto 115:87f2f5183dfb 167 /**
Kojto 115:87f2f5183dfb 168 * @}
Kojto 115:87f2f5183dfb 169 */
Kojto 115:87f2f5183dfb 170
Kojto 115:87f2f5183dfb 171 /** @defgroup DAC_flags_definition DAC Flags Definition
Kojto 115:87f2f5183dfb 172 * @{
Kojto 115:87f2f5183dfb 173 */
Kojto 115:87f2f5183dfb 174 #define DAC_FLAG_DMAUDR1 ((uint32_t)DAC_SR_DMAUDR1)
Kojto 115:87f2f5183dfb 175 #define DAC_FLAG_DMAUDR2 ((uint32_t)DAC_SR_DMAUDR2)
Kojto 115:87f2f5183dfb 176 /**
Kojto 115:87f2f5183dfb 177 * @}
Kojto 115:87f2f5183dfb 178 */
Kojto 115:87f2f5183dfb 179
Kojto 115:87f2f5183dfb 180 /** @defgroup DAC_IT_definition DAC IT Definition
Kojto 115:87f2f5183dfb 181 * @{
Kojto 115:87f2f5183dfb 182 */
Kojto 115:87f2f5183dfb 183 #define DAC_IT_DMAUDR1 ((uint32_t)DAC_SR_DMAUDR1)
Kojto 115:87f2f5183dfb 184 #define DAC_IT_DMAUDR2 ((uint32_t)DAC_SR_DMAUDR2)
Kojto 115:87f2f5183dfb 185 /**
Kojto 115:87f2f5183dfb 186 * @}
Kojto 115:87f2f5183dfb 187 */
Kojto 115:87f2f5183dfb 188
Kojto 115:87f2f5183dfb 189 /**
Kojto 115:87f2f5183dfb 190 * @}
Kojto 115:87f2f5183dfb 191 */
Kojto 115:87f2f5183dfb 192
Kojto 115:87f2f5183dfb 193 /* Exported macro ------------------------------------------------------------*/
Kojto 115:87f2f5183dfb 194 /** @defgroup DAC_Exported_Macros DAC Exported Macros
Kojto 115:87f2f5183dfb 195 * @{
Kojto 115:87f2f5183dfb 196 */
Kojto 115:87f2f5183dfb 197
Kojto 115:87f2f5183dfb 198 /** @brief Reset DAC handle state
Kojto 115:87f2f5183dfb 199 * @param __HANDLE__: specifies the DAC handle.
Kojto 115:87f2f5183dfb 200 * @retval None
Kojto 115:87f2f5183dfb 201 */
Kojto 115:87f2f5183dfb 202 #define __HAL_DAC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DAC_STATE_RESET)
Kojto 115:87f2f5183dfb 203
Kojto 115:87f2f5183dfb 204 /** @brief Enable the DAC channel
Kojto 115:87f2f5183dfb 205 * @param __HANDLE__: specifies the DAC handle.
Kojto 115:87f2f5183dfb 206 * @param __DAC_CHANNEL__: specifies the DAC channel
Kojto 115:87f2f5183dfb 207 * @retval None
Kojto 115:87f2f5183dfb 208 */
Kojto 115:87f2f5183dfb 209 #define __HAL_DAC_ENABLE(__HANDLE__, __DAC_CHANNEL__) \
Kojto 115:87f2f5183dfb 210 ((__HANDLE__)->Instance->CR |= (DAC_CR_EN1 << (__DAC_CHANNEL__)))
Kojto 115:87f2f5183dfb 211
Kojto 115:87f2f5183dfb 212 /** @brief Disable the DAC channel
Kojto 115:87f2f5183dfb 213 * @param __HANDLE__: specifies the DAC handle
Kojto 115:87f2f5183dfb 214 * @param __DAC_CHANNEL__: specifies the DAC channel.
Kojto 115:87f2f5183dfb 215 * @retval None
Kojto 115:87f2f5183dfb 216 */
Kojto 115:87f2f5183dfb 217 #define __HAL_DAC_DISABLE(__HANDLE__, __DAC_CHANNEL__) \
Kojto 115:87f2f5183dfb 218 ((__HANDLE__)->Instance->CR &= ~(DAC_CR_EN1 << (__DAC_CHANNEL__)))
Kojto 115:87f2f5183dfb 219
Kojto 115:87f2f5183dfb 220
Kojto 115:87f2f5183dfb 221 /** @brief Enable the DAC interrupt
Kojto 115:87f2f5183dfb 222 * @param __HANDLE__: specifies the DAC handle
Kojto 115:87f2f5183dfb 223 * @param __INTERRUPT__: specifies the DAC interrupt.
Kojto 115:87f2f5183dfb 224 * @retval None
Kojto 115:87f2f5183dfb 225 */
Kojto 115:87f2f5183dfb 226 #define __HAL_DAC_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR) |= (__INTERRUPT__))
Kojto 115:87f2f5183dfb 227
Kojto 115:87f2f5183dfb 228 /** @brief Disable the DAC interrupt
Kojto 115:87f2f5183dfb 229 * @param __HANDLE__: specifies the DAC handle
Kojto 115:87f2f5183dfb 230 * @param __INTERRUPT__: specifies the DAC interrupt.
Kojto 115:87f2f5183dfb 231 * @retval None
Kojto 115:87f2f5183dfb 232 */
Kojto 115:87f2f5183dfb 233 #define __HAL_DAC_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR) &= ~(__INTERRUPT__))
Kojto 115:87f2f5183dfb 234
Kojto 115:87f2f5183dfb 235 /** @brief Checks if the specified DAC interrupt source is enabled or disabled.
Kojto 115:87f2f5183dfb 236 * @param __HANDLE__: DAC handle
Kojto 115:87f2f5183dfb 237 * @param __INTERRUPT__: DAC interrupt source to check
Kojto 115:87f2f5183dfb 238 * This parameter can be any combination of the following values:
Kojto 115:87f2f5183dfb 239 * @arg DAC_IT_DMAUDR1: DAC channel 1 DMA underrun interrupt
Kojto 115:87f2f5183dfb 240 * @arg DAC_IT_DMAUDR2: DAC channel 2 DMA underrun interrupt
Kojto 115:87f2f5183dfb 241 * @retval State of interruption (SET or RESET)
Kojto 115:87f2f5183dfb 242 */
Kojto 115:87f2f5183dfb 243 #define __HAL_DAC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR & (__INTERRUPT__)) == (__INTERRUPT__))
Kojto 115:87f2f5183dfb 244
Kojto 115:87f2f5183dfb 245 /** @brief Get the selected DAC's flag status.
Kojto 115:87f2f5183dfb 246 * @param __HANDLE__: specifies the DAC handle.
Kojto 115:87f2f5183dfb 247 * @param __FLAG__: specifies the flag to clear.
Kojto 115:87f2f5183dfb 248 * This parameter can be any combination of the following values:
Kojto 115:87f2f5183dfb 249 * @arg DAC_FLAG_DMAUDR1: DMA underrun 1 flag
Kojto 115:87f2f5183dfb 250 * @arg DAC_FLAG_DMAUDR2: DMA underrun 2 flag
Kojto 115:87f2f5183dfb 251 * @retval None
Kojto 115:87f2f5183dfb 252 */
Kojto 115:87f2f5183dfb 253 #define __HAL_DAC_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__))
Kojto 115:87f2f5183dfb 254
Kojto 115:87f2f5183dfb 255 /** @brief Clear the DAC's flag.
Kojto 115:87f2f5183dfb 256 * @param __HANDLE__: specifies the DAC handle.
Kojto 115:87f2f5183dfb 257 * @param __FLAG__: specifies the flag to clear.
Kojto 115:87f2f5183dfb 258 * This parameter can be any combination of the following values:
Kojto 115:87f2f5183dfb 259 * @arg DAC_FLAG_DMAUDR1: DMA underrun 1 flag
Kojto 115:87f2f5183dfb 260 * @arg DAC_FLAG_DMAUDR2: DMA underrun 2 flag
Kojto 115:87f2f5183dfb 261 * @retval None
Kojto 115:87f2f5183dfb 262 */
Kojto 115:87f2f5183dfb 263 #define __HAL_DAC_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR) = (__FLAG__))
Kojto 115:87f2f5183dfb 264 /**
Kojto 115:87f2f5183dfb 265 * @}
Kojto 115:87f2f5183dfb 266 */
Kojto 115:87f2f5183dfb 267
Kojto 115:87f2f5183dfb 268 /* Include DAC HAL Extension module */
Kojto 115:87f2f5183dfb 269 #include "stm32f7xx_hal_dac_ex.h"
Kojto 115:87f2f5183dfb 270
Kojto 115:87f2f5183dfb 271 /* Exported functions --------------------------------------------------------*/
Kojto 115:87f2f5183dfb 272 /** @addtogroup DAC_Exported_Functions
Kojto 115:87f2f5183dfb 273 * @{
Kojto 115:87f2f5183dfb 274 */
Kojto 115:87f2f5183dfb 275
Kojto 115:87f2f5183dfb 276 /** @addtogroup DAC_Exported_Functions_Group1
Kojto 115:87f2f5183dfb 277 * @{
Kojto 115:87f2f5183dfb 278 */
Kojto 115:87f2f5183dfb 279 /* Initialization/de-initialization functions *********************************/
Kojto 115:87f2f5183dfb 280 HAL_StatusTypeDef HAL_DAC_Init(DAC_HandleTypeDef* hdac);
Kojto 115:87f2f5183dfb 281 HAL_StatusTypeDef HAL_DAC_DeInit(DAC_HandleTypeDef* hdac);
Kojto 115:87f2f5183dfb 282 void HAL_DAC_MspInit(DAC_HandleTypeDef* hdac);
Kojto 115:87f2f5183dfb 283 void HAL_DAC_MspDeInit(DAC_HandleTypeDef* hdac);
Kojto 115:87f2f5183dfb 284 /**
Kojto 115:87f2f5183dfb 285 * @}
Kojto 115:87f2f5183dfb 286 */
Kojto 115:87f2f5183dfb 287
Kojto 115:87f2f5183dfb 288 /** @addtogroup DAC_Exported_Functions_Group2
Kojto 115:87f2f5183dfb 289 * @{
Kojto 115:87f2f5183dfb 290 */
Kojto 115:87f2f5183dfb 291 /* I/O operation functions ****************************************************/
Kojto 115:87f2f5183dfb 292 HAL_StatusTypeDef HAL_DAC_Start(DAC_HandleTypeDef* hdac, uint32_t Channel);
Kojto 115:87f2f5183dfb 293 HAL_StatusTypeDef HAL_DAC_Stop(DAC_HandleTypeDef* hdac, uint32_t Channel);
Kojto 115:87f2f5183dfb 294 HAL_StatusTypeDef HAL_DAC_Start_DMA(DAC_HandleTypeDef* hdac, uint32_t Channel, uint32_t* pData, uint32_t Length, uint32_t Alignment);
Kojto 115:87f2f5183dfb 295 HAL_StatusTypeDef HAL_DAC_Stop_DMA(DAC_HandleTypeDef* hdac, uint32_t Channel);
Kojto 115:87f2f5183dfb 296 uint32_t HAL_DAC_GetValue(DAC_HandleTypeDef* hdac, uint32_t Channel);
Kojto 115:87f2f5183dfb 297 /**
Kojto 115:87f2f5183dfb 298 * @}
Kojto 115:87f2f5183dfb 299 */
Kojto 115:87f2f5183dfb 300
Kojto 115:87f2f5183dfb 301 /** @addtogroup DAC_Exported_Functions_Group3
Kojto 115:87f2f5183dfb 302 * @{
Kojto 115:87f2f5183dfb 303 */
Kojto 115:87f2f5183dfb 304 /* Peripheral Control functions ***********************************************/
Kojto 115:87f2f5183dfb 305 HAL_StatusTypeDef HAL_DAC_ConfigChannel(DAC_HandleTypeDef* hdac, DAC_ChannelConfTypeDef* sConfig, uint32_t Channel);
Kojto 115:87f2f5183dfb 306 HAL_StatusTypeDef HAL_DAC_SetValue(DAC_HandleTypeDef* hdac, uint32_t Channel, uint32_t Alignment, uint32_t Data);
Kojto 115:87f2f5183dfb 307 /**
Kojto 115:87f2f5183dfb 308 * @}
Kojto 115:87f2f5183dfb 309 */
Kojto 115:87f2f5183dfb 310
Kojto 115:87f2f5183dfb 311 /** @addtogroup DAC_Exported_Functions_Group4
Kojto 115:87f2f5183dfb 312 * @{
Kojto 115:87f2f5183dfb 313 */
Kojto 115:87f2f5183dfb 314 /* Peripheral State functions *************************************************/
Kojto 115:87f2f5183dfb 315 HAL_DAC_StateTypeDef HAL_DAC_GetState(DAC_HandleTypeDef* hdac);
Kojto 115:87f2f5183dfb 316 void HAL_DAC_IRQHandler(DAC_HandleTypeDef* hdac);
Kojto 115:87f2f5183dfb 317 uint32_t HAL_DAC_GetError(DAC_HandleTypeDef *hdac);
Kojto 115:87f2f5183dfb 318
Kojto 115:87f2f5183dfb 319 void HAL_DAC_ConvCpltCallbackCh1(DAC_HandleTypeDef* hdac);
Kojto 115:87f2f5183dfb 320 void HAL_DAC_ConvHalfCpltCallbackCh1(DAC_HandleTypeDef* hdac);
Kojto 115:87f2f5183dfb 321 void HAL_DAC_ErrorCallbackCh1(DAC_HandleTypeDef *hdac);
Kojto 115:87f2f5183dfb 322 void HAL_DAC_DMAUnderrunCallbackCh1(DAC_HandleTypeDef *hdac);
Kojto 115:87f2f5183dfb 323 /**
Kojto 115:87f2f5183dfb 324 * @}
Kojto 115:87f2f5183dfb 325 */
Kojto 115:87f2f5183dfb 326
Kojto 115:87f2f5183dfb 327 /**
Kojto 115:87f2f5183dfb 328 * @}
Kojto 115:87f2f5183dfb 329 */
Kojto 115:87f2f5183dfb 330 /* Private types -------------------------------------------------------------*/
Kojto 115:87f2f5183dfb 331 /* Private variables ---------------------------------------------------------*/
Kojto 115:87f2f5183dfb 332 /* Private constants ---------------------------------------------------------*/
Kojto 115:87f2f5183dfb 333 /** @defgroup DAC_Private_Constants DAC Private Constants
Kojto 115:87f2f5183dfb 334 * @{
Kojto 115:87f2f5183dfb 335 */
Kojto 115:87f2f5183dfb 336
Kojto 115:87f2f5183dfb 337 /**
Kojto 115:87f2f5183dfb 338 * @}
Kojto 115:87f2f5183dfb 339 */
Kojto 115:87f2f5183dfb 340
Kojto 115:87f2f5183dfb 341 /* Private macros ------------------------------------------------------------*/
Kojto 115:87f2f5183dfb 342 /** @defgroup DAC_Private_Macros DAC Private Macros
Kojto 115:87f2f5183dfb 343 * @{
Kojto 115:87f2f5183dfb 344 */
Kojto 115:87f2f5183dfb 345 #define IS_DAC_DATA(DATA) ((DATA) <= 0xFFF0)
Kojto 115:87f2f5183dfb 346 #define IS_DAC_ALIGN(ALIGN) (((ALIGN) == DAC_ALIGN_12B_R) || \
Kojto 115:87f2f5183dfb 347 ((ALIGN) == DAC_ALIGN_12B_L) || \
Kojto 115:87f2f5183dfb 348 ((ALIGN) == DAC_ALIGN_8B_R))
Kojto 115:87f2f5183dfb 349 #define IS_DAC_CHANNEL(CHANNEL) (((CHANNEL) == DAC_CHANNEL_1) || \
Kojto 115:87f2f5183dfb 350 ((CHANNEL) == DAC_CHANNEL_2))
Kojto 115:87f2f5183dfb 351 #define IS_DAC_OUTPUT_BUFFER_STATE(STATE) (((STATE) == DAC_OUTPUTBUFFER_ENABLE) || \
Kojto 115:87f2f5183dfb 352 ((STATE) == DAC_OUTPUTBUFFER_DISABLE))
Kojto 115:87f2f5183dfb 353
Kojto 115:87f2f5183dfb 354 #define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_TRIGGER_NONE) || \
Kojto 115:87f2f5183dfb 355 ((TRIGGER) == DAC_TRIGGER_T2_TRGO) || \
Kojto 115:87f2f5183dfb 356 ((TRIGGER) == DAC_TRIGGER_T8_TRGO) || \
Kojto 115:87f2f5183dfb 357 ((TRIGGER) == DAC_TRIGGER_T7_TRGO) || \
Kojto 115:87f2f5183dfb 358 ((TRIGGER) == DAC_TRIGGER_T5_TRGO) || \
Kojto 115:87f2f5183dfb 359 ((TRIGGER) == DAC_TRIGGER_T6_TRGO) || \
Kojto 115:87f2f5183dfb 360 ((TRIGGER) == DAC_TRIGGER_T4_TRGO) || \
Kojto 115:87f2f5183dfb 361 ((TRIGGER) == DAC_TRIGGER_EXT_IT9) || \
Kojto 115:87f2f5183dfb 362 ((TRIGGER) == DAC_TRIGGER_SOFTWARE))
Kojto 115:87f2f5183dfb 363
Kojto 115:87f2f5183dfb 364 /** @brief Set DHR12R1 alignment
Kojto 115:87f2f5183dfb 365 * @param __ALIGNMENT__: specifies the DAC alignment
Kojto 115:87f2f5183dfb 366 * @retval None
Kojto 115:87f2f5183dfb 367 */
Kojto 115:87f2f5183dfb 368 #define DAC_DHR12R1_ALIGNMENT(__ALIGNMENT__) (((uint32_t)0x00000008) + (__ALIGNMENT__))
Kojto 115:87f2f5183dfb 369
Kojto 115:87f2f5183dfb 370 /** @brief Set DHR12R2 alignment
Kojto 115:87f2f5183dfb 371 * @param __ALIGNMENT__: specifies the DAC alignment
Kojto 115:87f2f5183dfb 372 * @retval None
Kojto 115:87f2f5183dfb 373 */
Kojto 115:87f2f5183dfb 374 #define DAC_DHR12R2_ALIGNMENT(__ALIGNMENT__) (((uint32_t)0x00000014) + (__ALIGNMENT__))
Kojto 115:87f2f5183dfb 375
Kojto 115:87f2f5183dfb 376 /** @brief Set DHR12RD alignment
Kojto 115:87f2f5183dfb 377 * @param __ALIGNMENT__: specifies the DAC alignment
Kojto 115:87f2f5183dfb 378 * @retval None
Kojto 115:87f2f5183dfb 379 */
Kojto 115:87f2f5183dfb 380 #define DAC_DHR12RD_ALIGNMENT(__ALIGNMENT__) (((uint32_t)0x00000020) + (__ALIGNMENT__))
Kojto 115:87f2f5183dfb 381
Kojto 115:87f2f5183dfb 382 /**
Kojto 115:87f2f5183dfb 383 * @}
Kojto 115:87f2f5183dfb 384 */
Kojto 115:87f2f5183dfb 385
Kojto 115:87f2f5183dfb 386 /* Private functions ---------------------------------------------------------*/
Kojto 115:87f2f5183dfb 387 /** @defgroup DAC_Private_Functions DAC Private Functions
Kojto 115:87f2f5183dfb 388 * @{
Kojto 115:87f2f5183dfb 389 */
Kojto 115:87f2f5183dfb 390 /**
Kojto 115:87f2f5183dfb 391 * @}
Kojto 115:87f2f5183dfb 392 */
Kojto 115:87f2f5183dfb 393
Kojto 115:87f2f5183dfb 394 /**
Kojto 115:87f2f5183dfb 395 * @}
Kojto 115:87f2f5183dfb 396 */
Kojto 115:87f2f5183dfb 397
Kojto 115:87f2f5183dfb 398 /**
Kojto 115:87f2f5183dfb 399 * @}
Kojto 115:87f2f5183dfb 400 */
Kojto 115:87f2f5183dfb 401
Kojto 115:87f2f5183dfb 402 #ifdef __cplusplus
Kojto 115:87f2f5183dfb 403 }
Kojto 115:87f2f5183dfb 404 #endif
Kojto 115:87f2f5183dfb 405
Kojto 115:87f2f5183dfb 406 #endif /*__STM32F7xx_HAL_DAC_H */
Kojto 115:87f2f5183dfb 407
Kojto 115:87f2f5183dfb 408 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/