my fork

Dependents:   Nucleo_blueNRG

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Wed Jul 02 13:22:23 2014 +0100
Revision:
86:04dd9b1680ae
Child:
92:4fc01daae5a5
Release 86 of the mbed library

Main changes:


- bug fixes in various backends
- mbed "error" replaced by assert logic (mbed_assert)
- new ST Nucleo targets

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 86:04dd9b1680ae 1 /**
bogdanm 86:04dd9b1680ae 2 ******************************************************************************
bogdanm 86:04dd9b1680ae 3 * @file stm32f3xx_hal_dac_ex.h
bogdanm 86:04dd9b1680ae 4 * @author MCD Application Team
bogdanm 86:04dd9b1680ae 5 * @version V1.0.1
bogdanm 86:04dd9b1680ae 6 * @date 18-June-2014
bogdanm 86:04dd9b1680ae 7 * @brief Header file of DAC HAL Extension module.
bogdanm 86:04dd9b1680ae 8 ******************************************************************************
bogdanm 86:04dd9b1680ae 9 * @attention
bogdanm 86:04dd9b1680ae 10 *
bogdanm 86:04dd9b1680ae 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
bogdanm 86:04dd9b1680ae 12 *
bogdanm 86:04dd9b1680ae 13 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 86:04dd9b1680ae 14 * are permitted provided that the following conditions are met:
bogdanm 86:04dd9b1680ae 15 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 86:04dd9b1680ae 16 * this list of conditions and the following disclaimer.
bogdanm 86:04dd9b1680ae 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 86:04dd9b1680ae 18 * this list of conditions and the following disclaimer in the documentation
bogdanm 86:04dd9b1680ae 19 * and/or other materials provided with the distribution.
bogdanm 86:04dd9b1680ae 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 86:04dd9b1680ae 21 * may be used to endorse or promote products derived from this software
bogdanm 86:04dd9b1680ae 22 * without specific prior written permission.
bogdanm 86:04dd9b1680ae 23 *
bogdanm 86:04dd9b1680ae 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 86:04dd9b1680ae 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 86:04dd9b1680ae 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 86:04dd9b1680ae 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 86:04dd9b1680ae 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 86:04dd9b1680ae 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 86:04dd9b1680ae 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 86:04dd9b1680ae 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 86:04dd9b1680ae 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 86:04dd9b1680ae 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 86:04dd9b1680ae 34 *
bogdanm 86:04dd9b1680ae 35 ******************************************************************************
bogdanm 86:04dd9b1680ae 36 */
bogdanm 86:04dd9b1680ae 37
bogdanm 86:04dd9b1680ae 38 /* Define to prevent recursive inclusion -------------------------------------*/
bogdanm 86:04dd9b1680ae 39 #ifndef __STM32F3xx_HAL_DAC_EX_H
bogdanm 86:04dd9b1680ae 40 #define __STM32F3xx_HAL_DAC_EX_H
bogdanm 86:04dd9b1680ae 41
bogdanm 86:04dd9b1680ae 42 #ifdef __cplusplus
bogdanm 86:04dd9b1680ae 43 extern "C" {
bogdanm 86:04dd9b1680ae 44 #endif
bogdanm 86:04dd9b1680ae 45
bogdanm 86:04dd9b1680ae 46 /* Includes ------------------------------------------------------------------*/
bogdanm 86:04dd9b1680ae 47 #include "stm32f3xx_hal_def.h"
bogdanm 86:04dd9b1680ae 48
bogdanm 86:04dd9b1680ae 49 /** @addtogroup STM32F3xx_HAL_Driver
bogdanm 86:04dd9b1680ae 50 * @{
bogdanm 86:04dd9b1680ae 51 */
bogdanm 86:04dd9b1680ae 52
bogdanm 86:04dd9b1680ae 53 /** @addtogroup DACEx
bogdanm 86:04dd9b1680ae 54 * @{
bogdanm 86:04dd9b1680ae 55 */
bogdanm 86:04dd9b1680ae 56
bogdanm 86:04dd9b1680ae 57 /* Exported types ------------------------------------------------------------*/
bogdanm 86:04dd9b1680ae 58 /* Exported constants --------------------------------------------------------*/
bogdanm 86:04dd9b1680ae 59 /** @defgroup DACEx_trigger_selection
bogdanm 86:04dd9b1680ae 60 * @{
bogdanm 86:04dd9b1680ae 61 */
bogdanm 86:04dd9b1680ae 62
bogdanm 86:04dd9b1680ae 63 #if defined(STM32F301x8) || defined(STM32F318xx)
bogdanm 86:04dd9b1680ae 64 #define DAC_TRIGGER_NONE ((uint32_t)0x00000000) /*!< Conversion is automatic once the DAC1_DHRxxxx register
bogdanm 86:04dd9b1680ae 65 has been loaded, and not by external trigger */
bogdanm 86:04dd9b1680ae 66 #define DAC_TRIGGER_T6_TRGO ((uint32_t)DAC_CR_TEN1) /*!< TIM6 TRGO selected as external conversion trigger for DAC channel */
bogdanm 86:04dd9b1680ae 67 #define DAC_TRIGGER_T2_TRGO ((uint32_t)(DAC_CR_TSEL1_2 | DAC_CR_TEN1)) /*!< TIM2 TRGO selected as external conversion trigger for DAC channel */
bogdanm 86:04dd9b1680ae 68 #define DAC_TRIGGER_T15_TRGO ((uint32_t)(DAC_CR_TSEL1_1 | DAC_CR_TSEL1_0 | DAC_CR_TEN1)) /*!< TIM5 TRGO selected as external conversion trigger for DAC channel */
bogdanm 86:04dd9b1680ae 69 #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 */
bogdanm 86:04dd9b1680ae 70 #define DAC_TRIGGER_SOFTWARE ((uint32_t)(DAC_CR_TSEL1 | DAC_CR_TEN1)) /*!< Conversion started by software trigger for DAC channel */
bogdanm 86:04dd9b1680ae 71
bogdanm 86:04dd9b1680ae 72 #define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_TRIGGER_NONE) || \
bogdanm 86:04dd9b1680ae 73 ((TRIGGER) == DAC_TRIGGER_T2_TRGO) || \
bogdanm 86:04dd9b1680ae 74 ((TRIGGER) == DAC_TRIGGER_T6_TRGO) || \
bogdanm 86:04dd9b1680ae 75 ((TRIGGER) == DAC_TRIGGER_T15_TRGO) || \
bogdanm 86:04dd9b1680ae 76 ((TRIGGER) == DAC_TRIGGER_EXT_IT9) || \
bogdanm 86:04dd9b1680ae 77 ((TRIGGER) == DAC_TRIGGER_SOFTWARE))
bogdanm 86:04dd9b1680ae 78 #endif /* STM32F301x8 STM32F318xx */
bogdanm 86:04dd9b1680ae 79
bogdanm 86:04dd9b1680ae 80 #if defined(STM32F302x8)
bogdanm 86:04dd9b1680ae 81
bogdanm 86:04dd9b1680ae 82 #define DAC_TRIGGER_NONE ((uint32_t)0x00000000) /*!< Conversion is automatic once the DAC1_DHRxxxx register
bogdanm 86:04dd9b1680ae 83 has been loaded, and not by external trigger */
bogdanm 86:04dd9b1680ae 84 #define DAC_TRIGGER_T6_TRGO ((uint32_t)DAC_CR_TEN1) /*!< TIM6 TRGO selected as external conversion trigger for DAC channel */
bogdanm 86:04dd9b1680ae 85 #define DAC_TRIGGER_T3_TRGO ((uint32_t)(DAC_CR_TSEL1_0 | DAC_CR_TEN1)) /*!< TIM3 TRGO selected as external conversion trigger for DAC channel */
bogdanm 86:04dd9b1680ae 86 #define DAC_TRIGGER_T15_TRGO ((uint32_t)(DAC_CR_TSEL1_1 | DAC_CR_TSEL1_0 | DAC_CR_TEN1)) /*!< TIM5 TRGO selected as external conversion trigger for DAC channel */
bogdanm 86:04dd9b1680ae 87 #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 */
bogdanm 86:04dd9b1680ae 88 #define DAC_TRIGGER_SOFTWARE ((uint32_t)(DAC_CR_TSEL1 | DAC_CR_TEN1)) /*!< Conversion started by software trigger for DAC channel */
bogdanm 86:04dd9b1680ae 89
bogdanm 86:04dd9b1680ae 90 #define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_TRIGGER_NONE) || \
bogdanm 86:04dd9b1680ae 91 ((TRIGGER) == DAC_TRIGGER_T3_TRGO) || \
bogdanm 86:04dd9b1680ae 92 ((TRIGGER) == DAC_TRIGGER_T15_TRGO) || \
bogdanm 86:04dd9b1680ae 93 ((TRIGGER) == DAC_TRIGGER_T6_TRGO) || \
bogdanm 86:04dd9b1680ae 94 ((TRIGGER) == DAC_TRIGGER_EXT_IT9) || \
bogdanm 86:04dd9b1680ae 95 ((TRIGGER) == DAC_TRIGGER_SOFTWARE))
bogdanm 86:04dd9b1680ae 96
bogdanm 86:04dd9b1680ae 97 #endif /* STM32F302x8 */
bogdanm 86:04dd9b1680ae 98
bogdanm 86:04dd9b1680ae 99 #if defined(STM32F302xC)
bogdanm 86:04dd9b1680ae 100
bogdanm 86:04dd9b1680ae 101 #define DAC_TRIGGER_NONE ((uint32_t)0x00000000) /*!< Conversion is automatic once the DAC1_DHRxxxx register
bogdanm 86:04dd9b1680ae 102 has been loaded, and not by external trigger */
bogdanm 86:04dd9b1680ae 103 #define DAC_TRIGGER_T6_TRGO ((uint32_t)DAC_CR_TEN1) /*!< TIM6 TRGO selected as external conversion trigger for DAC channel */
bogdanm 86:04dd9b1680ae 104 #define DAC_TRIGGER_T3_TRGO ((uint32_t)(DAC_CR_TSEL1_0 | DAC_CR_TEN1)) /*!< TIM3 TRGO selected as external conversion trigger for DAC channel */
bogdanm 86:04dd9b1680ae 105 #define DAC_TRIGGER_T15_TRGO ((uint32_t)(DAC_CR_TSEL1_1 | DAC_CR_TSEL1_0 | DAC_CR_TEN1)) /*!< TIM5 TRGO selected as external conversion trigger for DAC channel */
bogdanm 86:04dd9b1680ae 106 #define DAC_TRIGGER_T2_TRGO ((uint32_t)(DAC_CR_TSEL1_2 | DAC_CR_TEN1)) /*!< TIM2 TRGO selected as external conversion trigger for DAC channel */
bogdanm 86:04dd9b1680ae 107 #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 */
bogdanm 86:04dd9b1680ae 108 #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 */
bogdanm 86:04dd9b1680ae 109 #define DAC_TRIGGER_SOFTWARE ((uint32_t)(DAC_CR_TSEL1 | DAC_CR_TEN1)) /*!< Conversion started by software trigger for DAC channel */
bogdanm 86:04dd9b1680ae 110
bogdanm 86:04dd9b1680ae 111 #define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_TRIGGER_NONE) || \
bogdanm 86:04dd9b1680ae 112 ((TRIGGER) == DAC_TRIGGER_T2_TRGO) || \
bogdanm 86:04dd9b1680ae 113 ((TRIGGER) == DAC_TRIGGER_T3_TRGO) || \
bogdanm 86:04dd9b1680ae 114 ((TRIGGER) == DAC_TRIGGER_T4_TRGO) || \
bogdanm 86:04dd9b1680ae 115 ((TRIGGER) == DAC_TRIGGER_T15_TRGO) || \
bogdanm 86:04dd9b1680ae 116 ((TRIGGER) == DAC_TRIGGER_T6_TRGO) || \
bogdanm 86:04dd9b1680ae 117 ((TRIGGER) == DAC_TRIGGER_EXT_IT9) || \
bogdanm 86:04dd9b1680ae 118 ((TRIGGER) == DAC_TRIGGER_SOFTWARE))
bogdanm 86:04dd9b1680ae 119
bogdanm 86:04dd9b1680ae 120 #endif /* STM32F302xC */
bogdanm 86:04dd9b1680ae 121
bogdanm 86:04dd9b1680ae 122
bogdanm 86:04dd9b1680ae 123 #if defined (STM32F303xC) || defined (STM32F358xx)
bogdanm 86:04dd9b1680ae 124
bogdanm 86:04dd9b1680ae 125 #define DAC_TRIGGER_NONE ((uint32_t)0x00000000) /*!< Conversion is automatic once the DAC1_DHRxxxx register
bogdanm 86:04dd9b1680ae 126 has been loaded, and not by external trigger */
bogdanm 86:04dd9b1680ae 127 #define DAC_TRIGGER_T2_TRGO ((uint32_t)(DAC_CR_TSEL1_2 | DAC_CR_TEN1)) /*!< TIM2 TRGO selected as external conversion trigger for DAC channel */
bogdanm 86:04dd9b1680ae 128 #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 */
bogdanm 86:04dd9b1680ae 129 #define DAC_TRIGGER_T15_TRGO ((uint32_t)(DAC_CR_TSEL1_1 | DAC_CR_TSEL1_0 | DAC_CR_TEN1)) /*!< TIM5 TRGO selected as external conversion trigger for DAC channel */
bogdanm 86:04dd9b1680ae 130 #define DAC_TRIGGER_T6_TRGO ((uint32_t)DAC_CR_TEN1) /*!< TIM6 TRGO selected as external conversion trigger for DAC channel */
bogdanm 86:04dd9b1680ae 131 #define DAC_TRIGGER_T7_TRGO ((uint32_t)(DAC_CR_TSEL1_1 | DAC_CR_TEN1)) /*!< TIM7 TRGO selected as external conversion trigger for DAC channel */
bogdanm 86:04dd9b1680ae 132 #define DAC_TRIGGER_T3_TRGO ((uint32_t)(DAC_CR_TSEL1_0 | DAC_CR_TEN1)) /*!< TIM3 TRGO selected as external conversion trigger for DAC channel
bogdanm 86:04dd9b1680ae 133 Use __HAL_REMAPTRIGGER_ENABLE(HAL_REMAPTRIGGER_DAC1_TRIG) for TIM3 selection */
bogdanm 86:04dd9b1680ae 134 #define DAC_TRIGGER_T8_TRGO DAC_TRIGGER_T3_TRGO /*!< TIM8 TRGO selected as external conversion trigger for DAC channel
bogdanm 86:04dd9b1680ae 135 Use __HAL_REMAPTRIGGER_DISABLE(HAL_REMAPTRIGGER_DAC1_TRIG) for TIM8 selection */
bogdanm 86:04dd9b1680ae 136
bogdanm 86:04dd9b1680ae 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 */
bogdanm 86:04dd9b1680ae 138 #define DAC_TRIGGER_SOFTWARE ((uint32_t)(DAC_CR_TSEL1 | DAC_CR_TEN1)) /*!< Conversion started by software trigger for DAC channel */
bogdanm 86:04dd9b1680ae 139
bogdanm 86:04dd9b1680ae 140 #define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_TRIGGER_NONE) || \
bogdanm 86:04dd9b1680ae 141 ((TRIGGER) == DAC_TRIGGER_T2_TRGO) || \
bogdanm 86:04dd9b1680ae 142 ((TRIGGER) == DAC_TRIGGER_T3_TRGO) || \
bogdanm 86:04dd9b1680ae 143 ((TRIGGER) == DAC_TRIGGER_T4_TRGO) || \
bogdanm 86:04dd9b1680ae 144 ((TRIGGER) == DAC_TRIGGER_T15_TRGO) || \
bogdanm 86:04dd9b1680ae 145 ((TRIGGER) == DAC_TRIGGER_T6_TRGO) || \
bogdanm 86:04dd9b1680ae 146 ((TRIGGER) == DAC_TRIGGER_T7_TRGO) || \
bogdanm 86:04dd9b1680ae 147 ((TRIGGER) == DAC_TRIGGER_EXT_IT9) || \
bogdanm 86:04dd9b1680ae 148 ((TRIGGER) == DAC_TRIGGER_SOFTWARE))
bogdanm 86:04dd9b1680ae 149 #endif /* STM32F303xC || STM32F358xx */
bogdanm 86:04dd9b1680ae 150
bogdanm 86:04dd9b1680ae 151
bogdanm 86:04dd9b1680ae 152 #if defined (STM32F303x8) || defined (STM32F328xx)
bogdanm 86:04dd9b1680ae 153
bogdanm 86:04dd9b1680ae 154 #define DAC_TRIGGER_NONE ((uint32_t)0x00000000) /*!< Conversion is automatic once the DAC1_DHRxxxx register
bogdanm 86:04dd9b1680ae 155 has been loaded, and not by external trigger */
bogdanm 86:04dd9b1680ae 156 #define DAC_TRIGGER_T2_TRGO ((uint32_t)(DAC_CR_TSEL1_2 | DAC_CR_TEN1)) /*!< TIM2 TRGO selected as external conversion trigger for DAC channel */
bogdanm 86:04dd9b1680ae 157 #define DAC_TRIGGER_T15_TRGO ((uint32_t)(DAC_CR_TSEL1_1 | DAC_CR_TSEL1_0 | DAC_CR_TEN1)) /*!< TIM5 TRGO selected as external conversion trigger for DAC channel */
bogdanm 86:04dd9b1680ae 158 #define DAC_TRIGGER_T6_TRGO ((uint32_t)DAC_CR_TEN1) /*!< TIM6 TRGO selected as external conversion trigger for DAC channel */
bogdanm 86:04dd9b1680ae 159 #define DAC_TRIGGER_T7_TRGO ((uint32_t)(DAC_CR_TSEL1_1 | DAC_CR_TEN1)) /*!< TIM7 TRGO selected as external conversion trigger for DAC channel */
bogdanm 86:04dd9b1680ae 160 #define DAC_TRIGGER_T3_TRGO ((uint32_t)(DAC_CR_TSEL1_0 | DAC_CR_TEN1)) /*!< TIM3 TRGO selected as external conversion trigger for DAC channel */
bogdanm 86:04dd9b1680ae 161
bogdanm 86:04dd9b1680ae 162 #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 */
bogdanm 86:04dd9b1680ae 163 #define DAC_TRIGGER_SOFTWARE ((uint32_t)(DAC_CR_TSEL1 | DAC_CR_TEN1)) /*!< Conversion started by software trigger for DAC channel */
bogdanm 86:04dd9b1680ae 164
bogdanm 86:04dd9b1680ae 165 #define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_TRIGGER_NONE) || \
bogdanm 86:04dd9b1680ae 166 ((TRIGGER) == DAC_TRIGGER_T2_TRGO) || \
bogdanm 86:04dd9b1680ae 167 ((TRIGGER) == DAC_TRIGGER_T3_TRGO) || \
bogdanm 86:04dd9b1680ae 168 ((TRIGGER) == DAC_TRIGGER_T15_TRGO) || \
bogdanm 86:04dd9b1680ae 169 ((TRIGGER) == DAC_TRIGGER_T6_TRGO) || \
bogdanm 86:04dd9b1680ae 170 ((TRIGGER) == DAC_TRIGGER_T7_TRGO) || \
bogdanm 86:04dd9b1680ae 171 ((TRIGGER) == DAC_TRIGGER_EXT_IT9) || \
bogdanm 86:04dd9b1680ae 172 ((TRIGGER) == DAC_TRIGGER_SOFTWARE))
bogdanm 86:04dd9b1680ae 173
bogdanm 86:04dd9b1680ae 174 #endif /* STM32F303x8 || STM32F328xx */
bogdanm 86:04dd9b1680ae 175
bogdanm 86:04dd9b1680ae 176
bogdanm 86:04dd9b1680ae 177 #if defined (STM32F373xC) || defined (STM32F378xx)
bogdanm 86:04dd9b1680ae 178
bogdanm 86:04dd9b1680ae 179 #define DAC_TRIGGER_NONE ((uint32_t)0x00000000) /*!< Conversion is automatic once the DAC1_DHRxxxx register
bogdanm 86:04dd9b1680ae 180 has been loaded, and not by external trigger */
bogdanm 86:04dd9b1680ae 181
bogdanm 86:04dd9b1680ae 182 #define DAC_TRIGGER_T2_TRGO ((uint32_t)(DAC_CR_TSEL1_2 | DAC_CR_TEN1)) /*!< TIM2 TRGO selected as external conversion trigger for DAC channel */
bogdanm 86:04dd9b1680ae 183 #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 */
bogdanm 86:04dd9b1680ae 184 #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 (DAC1) */
bogdanm 86:04dd9b1680ae 185 #define DAC_TRIGGER_T18_TRGO DAC_TRIGGER_T5_TRGO /*!< TIM18 TRGO selected as external conversion trigger for DAC channel (DAC2) */
bogdanm 86:04dd9b1680ae 186 #define DAC_TRIGGER_T6_TRGO ((uint32_t)DAC_CR_TEN1) /*!< TIM6 TRGO selected as external conversion trigger for DAC channel */
bogdanm 86:04dd9b1680ae 187 #define DAC_TRIGGER_T7_TRGO ((uint32_t)(DAC_CR_TSEL1_1 | DAC_CR_TEN1)) /*!< TIM7 TRGO selected as external conversion trigger for DAC channel */
bogdanm 86:04dd9b1680ae 188 #define DAC_TRIGGER_T3_TRGO ((uint32_t)(DAC_CR_TSEL1_0 | DAC_CR_TEN1)) /*!< TIM3 TRGO selected as external conversion trigger for DAC channel */
bogdanm 86:04dd9b1680ae 189
bogdanm 86:04dd9b1680ae 190 #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 */
bogdanm 86:04dd9b1680ae 191 #define DAC_TRIGGER_SOFTWARE ((uint32_t)(DAC_CR_TSEL1 | DAC_CR_TEN1)) /*!< Conversion started by software trigger for DAC channel */
bogdanm 86:04dd9b1680ae 192
bogdanm 86:04dd9b1680ae 193
bogdanm 86:04dd9b1680ae 194 #define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_TRIGGER_NONE) || \
bogdanm 86:04dd9b1680ae 195 ((TRIGGER) == DAC_TRIGGER_T2_TRGO) || \
bogdanm 86:04dd9b1680ae 196 ((TRIGGER) == DAC_TRIGGER_T3_TRGO) || \
bogdanm 86:04dd9b1680ae 197 ((TRIGGER) == DAC_TRIGGER_T4_TRGO) || \
bogdanm 86:04dd9b1680ae 198 ((TRIGGER) == DAC_TRIGGER_T5_TRGO) || \
bogdanm 86:04dd9b1680ae 199 ((TRIGGER) == DAC_TRIGGER_T6_TRGO) || \
bogdanm 86:04dd9b1680ae 200 ((TRIGGER) == DAC_TRIGGER_T7_TRGO) || \
bogdanm 86:04dd9b1680ae 201 ((TRIGGER) == DAC_TRIGGER_EXT_IT9) || \
bogdanm 86:04dd9b1680ae 202 ((TRIGGER) == DAC_TRIGGER_SOFTWARE))
bogdanm 86:04dd9b1680ae 203 #endif /* STM32F373xC || STM32F378xx */
bogdanm 86:04dd9b1680ae 204
bogdanm 86:04dd9b1680ae 205 #if defined(STM32F334x8)
bogdanm 86:04dd9b1680ae 206
bogdanm 86:04dd9b1680ae 207 #define DAC_TRIGGER_NONE ((uint32_t)0x00000000) /*!< Conversion is automatic once the DAC1_DHRxxxx register
bogdanm 86:04dd9b1680ae 208 has been loaded, and not by external trigger */
bogdanm 86:04dd9b1680ae 209 #define DAC_TRIGGER_T6_TRGO ((uint32_t)DAC_CR_TEN1) /*!< TIM6 TRGO selected as external conversion trigger for DAC channel */
bogdanm 86:04dd9b1680ae 210 #define DAC_TRIGGER_T3_TRGO ((uint32_t)(DAC_CR_TSEL1_0 | DAC_CR_TEN1)) /*!< TIM3 TRGO selected as external conversion trigger for DAC channel
bogdanm 86:04dd9b1680ae 211 Use __HAL_REMAPTRIGGER_ENABLE(HAL_REMAPTRIGGER_DAC1_TRIG) for TIM3 remap */
bogdanm 86:04dd9b1680ae 212
bogdanm 86:04dd9b1680ae 213 #define DAC_TRIGGER_T7_TRGO ((uint32_t)(DAC_CR_TSEL1_1 | DAC_CR_TEN1)) /*!< TIM7 TRGO selected as external conversion trigger for DAC channel */
bogdanm 86:04dd9b1680ae 214 #define DAC_TRIGGER_T2_TRGO ((uint32_t)(DAC_CR_TSEL1_2 | DAC_CR_TEN1)) /*!< TIM2 TRGO selected as external conversion trigger for DAC channel */
bogdanm 86:04dd9b1680ae 215 #define DAC_TRIGGER_T15_TRGO ((uint32_t)(DAC_CR_TSEL1_1 | DAC_CR_TSEL1_0 | DAC_CR_TEN1)) /*!< TIM15 TRGO selected as external conversion trigger for DAC channel
bogdanm 86:04dd9b1680ae 216 Use __HAL_REMAPTRIGGER_DISABLE(HAL_REMAPTRIGGER_DAC1_TRIG3) for TIM15 selection */
bogdanm 86:04dd9b1680ae 217 #define DAC_TRIGGER_HRTIM1_DACTRG1 DAC_TRIGGER_T15_TRGO /*!< HRTIM1 DACTRG1 selected as external conversion trigger for DAC
bogdanm 86:04dd9b1680ae 218 Use __HAL_REMAPTRIGGER_ENABLE(HAL_REMAPTRIGGER_DAC1_TRIG3) for HRTIM1 DACTRG1 selection */
bogdanm 86:04dd9b1680ae 219
bogdanm 86:04dd9b1680ae 220 #define DAC_TRIGGER_HRTIM1_DACTRG2 ((uint32_t)(DAC_CR_TSEL1_2 | DAC_CR_TSEL1_0 | DAC_CR_TEN1)) /*!< HRTIM1 DACTRG2 selected as external conversion trigger for DAC channel (DAC1)
bogdanm 86:04dd9b1680ae 221 Use __HAL_REMAPTRIGGER_ENABLE(HAL_REMAPTRIGGER_DAC1_TRIG5) for HRTIM1 DACTRG2 remap */
bogdanm 86:04dd9b1680ae 222 #define DAC_TRIGGER_HRTIM1_DACTRG3 DAC_TRIGGER_HRTIM1_DACTRG2 /*!< HRTIM1 DACTRG3 selected as external conversion trigger for DAC channel (DAC2)*/
bogdanm 86:04dd9b1680ae 223
bogdanm 86:04dd9b1680ae 224 #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 */
bogdanm 86:04dd9b1680ae 225 #define DAC_TRIGGER_SOFTWARE ((uint32_t)(DAC_CR_TSEL1 | DAC_CR_TEN1)) /*!< Conversion started by software trigger for DAC channel */
bogdanm 86:04dd9b1680ae 226
bogdanm 86:04dd9b1680ae 227 #define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_TRIGGER_NONE) || \
bogdanm 86:04dd9b1680ae 228 ((TRIGGER) == DAC_TRIGGER_T6_TRGO) || \
bogdanm 86:04dd9b1680ae 229 ((TRIGGER) == DAC_TRIGGER_T3_TRGO) || \
bogdanm 86:04dd9b1680ae 230 ((TRIGGER) == DAC_TRIGGER_T7_TRGO) || \
bogdanm 86:04dd9b1680ae 231 ((TRIGGER) == DAC_TRIGGER_T15_TRGO) || \
bogdanm 86:04dd9b1680ae 232 ((TRIGGER) == DAC_TRIGGER_T2_TRGO) || \
bogdanm 86:04dd9b1680ae 233 ((TRIGGER) == DAC_TRIGGER_HRTIM1_DACTRG2) || \
bogdanm 86:04dd9b1680ae 234 ((TRIGGER) == DAC_TRIGGER_EXT_IT9) || \
bogdanm 86:04dd9b1680ae 235 ((TRIGGER) == DAC_TRIGGER_SOFTWARE))
bogdanm 86:04dd9b1680ae 236
bogdanm 86:04dd9b1680ae 237 #endif /* STM32F334x8 */
bogdanm 86:04dd9b1680ae 238
bogdanm 86:04dd9b1680ae 239 /**
bogdanm 86:04dd9b1680ae 240 * @}
bogdanm 86:04dd9b1680ae 241 */
bogdanm 86:04dd9b1680ae 242
bogdanm 86:04dd9b1680ae 243 /** @defgroup DACEx_Channel_selection
bogdanm 86:04dd9b1680ae 244 * @{
bogdanm 86:04dd9b1680ae 245 */
bogdanm 86:04dd9b1680ae 246
bogdanm 86:04dd9b1680ae 247 #if defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx)
bogdanm 86:04dd9b1680ae 248 #define DAC_CHANNEL_1 ((uint32_t)0x00000000) /*!< DAC Channel 1 */
bogdanm 86:04dd9b1680ae 249 /* Aliases for compatibility */
bogdanm 86:04dd9b1680ae 250 #define DAC1_CHANNEL_1 DAC_CHANNEL_1 /*!< DAC1 Channel 1 */
bogdanm 86:04dd9b1680ae 251
bogdanm 86:04dd9b1680ae 252 #define IS_DAC_CHANNEL(CHANNEL) ((CHANNEL) == DAC_CHANNEL_1)
bogdanm 86:04dd9b1680ae 253 #endif /* STM32F301x8 || STM32F302x8 || STM32F318xx */
bogdanm 86:04dd9b1680ae 254
bogdanm 86:04dd9b1680ae 255
bogdanm 86:04dd9b1680ae 256 #if defined (STM32F303xC) || defined (STM32F358xx) || defined(STM32F302xC)
bogdanm 86:04dd9b1680ae 257 #define DAC_CHANNEL_1 ((uint32_t)0x00000000) /*!< DAC Channel 1 */
bogdanm 86:04dd9b1680ae 258 #define DAC_CHANNEL_2 ((uint32_t)0x00000010) /*!< DAC Channel 2 */
bogdanm 86:04dd9b1680ae 259 /* Aliases for compatibility */
bogdanm 86:04dd9b1680ae 260 #define DAC1_CHANNEL_1 DAC_CHANNEL_1 /*!< DAC1 Channel 1 */
bogdanm 86:04dd9b1680ae 261 #define DAC1_CHANNEL_2 DAC_CHANNEL_2 /*!< DAC1 Channel 2 */
bogdanm 86:04dd9b1680ae 262
bogdanm 86:04dd9b1680ae 263 #define IS_DAC_CHANNEL(CHANNEL) (((CHANNEL) == DAC_CHANNEL_1) || \
bogdanm 86:04dd9b1680ae 264 ((CHANNEL) == DAC_CHANNEL_2))
bogdanm 86:04dd9b1680ae 265 #endif /* STM32F303xC STM32F358xx STM32F302xC */
bogdanm 86:04dd9b1680ae 266
bogdanm 86:04dd9b1680ae 267 #if defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F373xC)|| defined (STM32F378xx) || defined (STM32F328xx)
bogdanm 86:04dd9b1680ae 268
bogdanm 86:04dd9b1680ae 269 #define DAC_CHANNEL_1 ((uint32_t)0x00000000) /*!< DAC Channel 1 */
bogdanm 86:04dd9b1680ae 270 #define DAC_CHANNEL_2 ((uint32_t)0x00000010) /*!< DAC Channel 2 */
bogdanm 86:04dd9b1680ae 271
bogdanm 86:04dd9b1680ae 272 /* Aliases for compatibility */
bogdanm 86:04dd9b1680ae 273 #define DAC1_CHANNEL_1 DAC_CHANNEL_1 /*!< DAC1 Channel 1 */
bogdanm 86:04dd9b1680ae 274 #define DAC1_CHANNEL_2 DAC_CHANNEL_2 /*!< DAC1 Channel 2 */
bogdanm 86:04dd9b1680ae 275 #define DAC2_CHANNEL_1 DAC_CHANNEL_1 /*!< DAC2 Channel 1 */
bogdanm 86:04dd9b1680ae 276
bogdanm 86:04dd9b1680ae 277 #define IS_DAC_CHANNEL(CHANNEL) (((CHANNEL) == DAC_CHANNEL_1) || \
bogdanm 86:04dd9b1680ae 278 ((CHANNEL) == DAC_CHANNEL_2))
bogdanm 86:04dd9b1680ae 279 #endif
bogdanm 86:04dd9b1680ae 280
bogdanm 86:04dd9b1680ae 281 /**
bogdanm 86:04dd9b1680ae 282 * @}
bogdanm 86:04dd9b1680ae 283 */
bogdanm 86:04dd9b1680ae 284
bogdanm 86:04dd9b1680ae 285
bogdanm 86:04dd9b1680ae 286 /* Exported macro ------------------------------------------------------------*/
bogdanm 86:04dd9b1680ae 287
bogdanm 86:04dd9b1680ae 288 /* Extension features functions ***********************************************/
bogdanm 86:04dd9b1680ae 289 uint32_t HAL_DACEx_DualGetValue(DAC_HandleTypeDef* hdac);
bogdanm 86:04dd9b1680ae 290 HAL_StatusTypeDef HAL_DACEx_DualSetValue(DAC_HandleTypeDef* hdac, uint32_t alignment, uint32_t data1, uint32_t data2);
bogdanm 86:04dd9b1680ae 291 HAL_StatusTypeDef HAL_DACEx_TriangleWaveGenerate(DAC_HandleTypeDef* hdac, uint32_t channel, uint32_t Amplitude);
bogdanm 86:04dd9b1680ae 292 HAL_StatusTypeDef HAL_DACEx_NoiseWaveGenerate(DAC_HandleTypeDef* hdac, uint32_t channel, uint32_t Amplitude);
bogdanm 86:04dd9b1680ae 293
bogdanm 86:04dd9b1680ae 294 void HAL_DACEx_ConvCpltCallbackCh2(DAC_HandleTypeDef* hdac);
bogdanm 86:04dd9b1680ae 295 void HAL_DACEx_ConvHalfCpltCallbackCh2(DAC_HandleTypeDef* hdac);
bogdanm 86:04dd9b1680ae 296 void HAL_DACEx_ErrorCallbackCh2(DAC_HandleTypeDef *hdac);
bogdanm 86:04dd9b1680ae 297 void HAL_DACEx_DMAUnderrunCallbackCh2(DAC_HandleTypeDef *hdac);
bogdanm 86:04dd9b1680ae 298
bogdanm 86:04dd9b1680ae 299 /**
bogdanm 86:04dd9b1680ae 300 * @}
bogdanm 86:04dd9b1680ae 301 */
bogdanm 86:04dd9b1680ae 302
bogdanm 86:04dd9b1680ae 303 /**
bogdanm 86:04dd9b1680ae 304 * @}
bogdanm 86:04dd9b1680ae 305 */
bogdanm 86:04dd9b1680ae 306
bogdanm 86:04dd9b1680ae 307 #ifdef __cplusplus
bogdanm 86:04dd9b1680ae 308 }
bogdanm 86:04dd9b1680ae 309 #endif
bogdanm 86:04dd9b1680ae 310
bogdanm 86:04dd9b1680ae 311 #endif /* __STM32F3xx_HAL_HAL_EX_H */
bogdanm 86:04dd9b1680ae 312
bogdanm 86:04dd9b1680ae 313 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/