The official mbed C/C SDK provides the software platform and libraries to build your applications.
Fork of mbed by
TARGET_NUCLEO_F334R8/stm32f3xx_hal_dac_ex.h@92:4fc01daae5a5, 2014-11-27 (annotated)
- Committer:
- bogdanm
- Date:
- Thu Nov 27 13:33:22 2014 +0000
- Revision:
- 92:4fc01daae5a5
- Parent:
- 86:04dd9b1680ae
Release 92 of the mbed libray
Main changes:
- nRF51822: fixed pin assignment issues
- ST targets moving to the STM32Cube driver
- LPC1439: fixed serial interrupt issue
- first Cortex-A platform supported in mbed (RZ_A1H)
Who changed what in which revision?
User | Revision | Line number | New 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 | 92:4fc01daae5a5 | 5 | * @version V1.1.0 |
bogdanm | 92:4fc01daae5a5 | 6 | * @date 12-Sept-2014 |
bogdanm | 92:4fc01daae5a5 | 7 | * @brief Header file of DAC HAL Extended module. |
bogdanm | 86:04dd9b1680ae | 8 | ****************************************************************************** |
bogdanm | 86:04dd9b1680ae | 9 | * @attention |
bogdanm | 86:04dd9b1680ae | 10 | * |
bogdanm | 86:04dd9b1680ae | 11 | * <h2><center>© 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 | 92:4fc01daae5a5 | 53 | /** @addtogroup DACEx DAC Extended HAL module driver |
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 | 92:4fc01daae5a5 | 59 | /** @defgroup DACEx_Exported_Constants DAC Extended Exported Constants |
bogdanm | 92:4fc01daae5a5 | 60 | * @{ |
bogdanm | 92:4fc01daae5a5 | 61 | */ |
bogdanm | 92:4fc01daae5a5 | 62 | |
bogdanm | 92:4fc01daae5a5 | 63 | /** @defgroup DACEx_trigger_selection DAC Extended trigger selection |
bogdanm | 86:04dd9b1680ae | 64 | * @{ |
bogdanm | 86:04dd9b1680ae | 65 | */ |
bogdanm | 86:04dd9b1680ae | 66 | |
bogdanm | 86:04dd9b1680ae | 67 | #if defined(STM32F301x8) || defined(STM32F318xx) |
bogdanm | 86:04dd9b1680ae | 68 | #define DAC_TRIGGER_NONE ((uint32_t)0x00000000) /*!< Conversion is automatic once the DAC1_DHRxxxx register |
bogdanm | 86:04dd9b1680ae | 69 | has been loaded, and not by external trigger */ |
bogdanm | 86:04dd9b1680ae | 70 | #define DAC_TRIGGER_T6_TRGO ((uint32_t)DAC_CR_TEN1) /*!< TIM6 TRGO selected as external conversion trigger for DAC channel */ |
bogdanm | 86:04dd9b1680ae | 71 | #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 | 72 | #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 | 73 | #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 | 74 | #define DAC_TRIGGER_SOFTWARE ((uint32_t)(DAC_CR_TSEL1 | DAC_CR_TEN1)) /*!< Conversion started by software trigger for DAC channel */ |
bogdanm | 86:04dd9b1680ae | 75 | |
bogdanm | 86:04dd9b1680ae | 76 | #define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_TRIGGER_NONE) || \ |
bogdanm | 86:04dd9b1680ae | 77 | ((TRIGGER) == DAC_TRIGGER_T2_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 78 | ((TRIGGER) == DAC_TRIGGER_T6_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 79 | ((TRIGGER) == DAC_TRIGGER_T15_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 80 | ((TRIGGER) == DAC_TRIGGER_EXT_IT9) || \ |
bogdanm | 86:04dd9b1680ae | 81 | ((TRIGGER) == DAC_TRIGGER_SOFTWARE)) |
bogdanm | 92:4fc01daae5a5 | 82 | #endif /* STM32F301x8 || STM32F318xx */ |
bogdanm | 86:04dd9b1680ae | 83 | |
bogdanm | 92:4fc01daae5a5 | 84 | #if defined(STM32F302xE) || \ |
bogdanm | 92:4fc01daae5a5 | 85 | defined(STM32F302xC) || \ |
bogdanm | 92:4fc01daae5a5 | 86 | defined(STM32F302x8) |
bogdanm | 86:04dd9b1680ae | 87 | |
bogdanm | 86:04dd9b1680ae | 88 | #define DAC_TRIGGER_NONE ((uint32_t)0x00000000) /*!< Conversion is automatic once the DAC1_DHRxxxx register |
bogdanm | 86:04dd9b1680ae | 89 | has been loaded, and not by external trigger */ |
bogdanm | 86:04dd9b1680ae | 90 | #define DAC_TRIGGER_T6_TRGO ((uint32_t)DAC_CR_TEN1) /*!< TIM6 TRGO selected as external conversion trigger for DAC channel */ |
bogdanm | 86:04dd9b1680ae | 91 | #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 | 92 | #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 | 93 | #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 | 94 | #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 | 95 | #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 | 96 | #define DAC_TRIGGER_SOFTWARE ((uint32_t)(DAC_CR_TSEL1 | DAC_CR_TEN1)) /*!< Conversion started by software trigger for DAC channel */ |
bogdanm | 86:04dd9b1680ae | 97 | |
bogdanm | 86:04dd9b1680ae | 98 | #define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_TRIGGER_NONE) || \ |
bogdanm | 86:04dd9b1680ae | 99 | ((TRIGGER) == DAC_TRIGGER_T2_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 100 | ((TRIGGER) == DAC_TRIGGER_T3_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 101 | ((TRIGGER) == DAC_TRIGGER_T4_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 102 | ((TRIGGER) == DAC_TRIGGER_T15_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 103 | ((TRIGGER) == DAC_TRIGGER_T6_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 104 | ((TRIGGER) == DAC_TRIGGER_EXT_IT9) || \ |
bogdanm | 86:04dd9b1680ae | 105 | ((TRIGGER) == DAC_TRIGGER_SOFTWARE)) |
bogdanm | 86:04dd9b1680ae | 106 | |
bogdanm | 92:4fc01daae5a5 | 107 | #endif /* STM32F302xE || */ |
bogdanm | 92:4fc01daae5a5 | 108 | /* STM32F302xC || */ |
bogdanm | 92:4fc01daae5a5 | 109 | /* STM32F302x8 */ |
bogdanm | 86:04dd9b1680ae | 110 | |
bogdanm | 92:4fc01daae5a5 | 111 | #if defined(STM32F303xE) || defined(STM32F398xx) || \ |
bogdanm | 92:4fc01daae5a5 | 112 | defined(STM32F303xC) || defined(STM32F358xx) |
bogdanm | 86:04dd9b1680ae | 113 | |
bogdanm | 86:04dd9b1680ae | 114 | #define DAC_TRIGGER_NONE ((uint32_t)0x00000000) /*!< Conversion is automatic once the DAC1_DHRxxxx register |
bogdanm | 86:04dd9b1680ae | 115 | has been loaded, and not by external trigger */ |
bogdanm | 86:04dd9b1680ae | 116 | #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 | 117 | #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 | 118 | #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 | 119 | #define DAC_TRIGGER_T6_TRGO ((uint32_t)DAC_CR_TEN1) /*!< TIM6 TRGO selected as external conversion trigger for DAC channel */ |
bogdanm | 86:04dd9b1680ae | 120 | #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 | 121 | #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 | 122 | Use __HAL_REMAPTRIGGER_ENABLE(HAL_REMAPTRIGGER_DAC1_TRIG) for TIM3 selection */ |
bogdanm | 86:04dd9b1680ae | 123 | #define DAC_TRIGGER_T8_TRGO DAC_TRIGGER_T3_TRGO /*!< TIM8 TRGO selected as external conversion trigger for DAC channel |
bogdanm | 86:04dd9b1680ae | 124 | Use __HAL_REMAPTRIGGER_DISABLE(HAL_REMAPTRIGGER_DAC1_TRIG) for TIM8 selection */ |
bogdanm | 86:04dd9b1680ae | 125 | |
bogdanm | 86:04dd9b1680ae | 126 | #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 | 127 | #define DAC_TRIGGER_SOFTWARE ((uint32_t)(DAC_CR_TSEL1 | DAC_CR_TEN1)) /*!< Conversion started by software trigger for DAC channel */ |
bogdanm | 86:04dd9b1680ae | 128 | |
bogdanm | 86:04dd9b1680ae | 129 | #define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_TRIGGER_NONE) || \ |
bogdanm | 86:04dd9b1680ae | 130 | ((TRIGGER) == DAC_TRIGGER_T2_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 131 | ((TRIGGER) == DAC_TRIGGER_T3_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 132 | ((TRIGGER) == DAC_TRIGGER_T4_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 133 | ((TRIGGER) == DAC_TRIGGER_T15_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 134 | ((TRIGGER) == DAC_TRIGGER_T6_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 135 | ((TRIGGER) == DAC_TRIGGER_T7_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 136 | ((TRIGGER) == DAC_TRIGGER_EXT_IT9) || \ |
bogdanm | 86:04dd9b1680ae | 137 | ((TRIGGER) == DAC_TRIGGER_SOFTWARE)) |
bogdanm | 92:4fc01daae5a5 | 138 | #endif /* STM32F303xE || STM32F398xx || */ |
bogdanm | 92:4fc01daae5a5 | 139 | /* STM32F303xC || STM32F358xx */ |
bogdanm | 86:04dd9b1680ae | 140 | |
bogdanm | 86:04dd9b1680ae | 141 | |
bogdanm | 92:4fc01daae5a5 | 142 | #if defined(STM32F303x8) || defined(STM32F328xx) |
bogdanm | 86:04dd9b1680ae | 143 | |
bogdanm | 86:04dd9b1680ae | 144 | #define DAC_TRIGGER_NONE ((uint32_t)0x00000000) /*!< Conversion is automatic once the DAC1_DHRxxxx register |
bogdanm | 86:04dd9b1680ae | 145 | has been loaded, and not by external trigger */ |
bogdanm | 86:04dd9b1680ae | 146 | #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 | 147 | #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 | 148 | #define DAC_TRIGGER_T6_TRGO ((uint32_t)DAC_CR_TEN1) /*!< TIM6 TRGO selected as external conversion trigger for DAC channel */ |
bogdanm | 86:04dd9b1680ae | 149 | #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 | 150 | #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 | 151 | |
bogdanm | 86:04dd9b1680ae | 152 | #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 | 153 | #define DAC_TRIGGER_SOFTWARE ((uint32_t)(DAC_CR_TSEL1 | DAC_CR_TEN1)) /*!< Conversion started by software trigger for DAC channel */ |
bogdanm | 86:04dd9b1680ae | 154 | |
bogdanm | 86:04dd9b1680ae | 155 | #define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_TRIGGER_NONE) || \ |
bogdanm | 86:04dd9b1680ae | 156 | ((TRIGGER) == DAC_TRIGGER_T2_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 157 | ((TRIGGER) == DAC_TRIGGER_T3_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 158 | ((TRIGGER) == DAC_TRIGGER_T15_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 159 | ((TRIGGER) == DAC_TRIGGER_T6_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 160 | ((TRIGGER) == DAC_TRIGGER_T7_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 161 | ((TRIGGER) == DAC_TRIGGER_EXT_IT9) || \ |
bogdanm | 86:04dd9b1680ae | 162 | ((TRIGGER) == DAC_TRIGGER_SOFTWARE)) |
bogdanm | 86:04dd9b1680ae | 163 | |
bogdanm | 86:04dd9b1680ae | 164 | #endif /* STM32F303x8 || STM32F328xx */ |
bogdanm | 86:04dd9b1680ae | 165 | |
bogdanm | 86:04dd9b1680ae | 166 | |
bogdanm | 92:4fc01daae5a5 | 167 | #if defined(STM32F373xC) || defined(STM32F378xx) |
bogdanm | 86:04dd9b1680ae | 168 | |
bogdanm | 86:04dd9b1680ae | 169 | #define DAC_TRIGGER_NONE ((uint32_t)0x00000000) /*!< Conversion is automatic once the DAC1_DHRxxxx register |
bogdanm | 86:04dd9b1680ae | 170 | has been loaded, and not by external trigger */ |
bogdanm | 86:04dd9b1680ae | 171 | |
bogdanm | 86:04dd9b1680ae | 172 | #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 | 173 | #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 | 174 | #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 | 175 | #define DAC_TRIGGER_T18_TRGO DAC_TRIGGER_T5_TRGO /*!< TIM18 TRGO selected as external conversion trigger for DAC channel (DAC2) */ |
bogdanm | 86:04dd9b1680ae | 176 | #define DAC_TRIGGER_T6_TRGO ((uint32_t)DAC_CR_TEN1) /*!< TIM6 TRGO selected as external conversion trigger for DAC channel */ |
bogdanm | 86:04dd9b1680ae | 177 | #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 | 178 | #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 | 179 | |
bogdanm | 86:04dd9b1680ae | 180 | #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 | 181 | #define DAC_TRIGGER_SOFTWARE ((uint32_t)(DAC_CR_TSEL1 | DAC_CR_TEN1)) /*!< Conversion started by software trigger for DAC channel */ |
bogdanm | 86:04dd9b1680ae | 182 | |
bogdanm | 86:04dd9b1680ae | 183 | |
bogdanm | 86:04dd9b1680ae | 184 | #define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_TRIGGER_NONE) || \ |
bogdanm | 86:04dd9b1680ae | 185 | ((TRIGGER) == DAC_TRIGGER_T2_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 186 | ((TRIGGER) == DAC_TRIGGER_T3_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 187 | ((TRIGGER) == DAC_TRIGGER_T4_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 188 | ((TRIGGER) == DAC_TRIGGER_T5_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 189 | ((TRIGGER) == DAC_TRIGGER_T6_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 190 | ((TRIGGER) == DAC_TRIGGER_T7_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 191 | ((TRIGGER) == DAC_TRIGGER_EXT_IT9) || \ |
bogdanm | 86:04dd9b1680ae | 192 | ((TRIGGER) == DAC_TRIGGER_SOFTWARE)) |
bogdanm | 86:04dd9b1680ae | 193 | #endif /* STM32F373xC || STM32F378xx */ |
bogdanm | 86:04dd9b1680ae | 194 | |
bogdanm | 86:04dd9b1680ae | 195 | #if defined(STM32F334x8) |
bogdanm | 86:04dd9b1680ae | 196 | |
bogdanm | 86:04dd9b1680ae | 197 | #define DAC_TRIGGER_NONE ((uint32_t)0x00000000) /*!< Conversion is automatic once the DAC1_DHRxxxx register |
bogdanm | 86:04dd9b1680ae | 198 | has been loaded, and not by external trigger */ |
bogdanm | 86:04dd9b1680ae | 199 | #define DAC_TRIGGER_T6_TRGO ((uint32_t)DAC_CR_TEN1) /*!< TIM6 TRGO selected as external conversion trigger for DAC channel */ |
bogdanm | 86:04dd9b1680ae | 200 | #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 | 201 | Use __HAL_REMAPTRIGGER_ENABLE(HAL_REMAPTRIGGER_DAC1_TRIG) for TIM3 remap */ |
bogdanm | 86:04dd9b1680ae | 202 | |
bogdanm | 86:04dd9b1680ae | 203 | #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 | 204 | #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 | 205 | #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 | 206 | Use __HAL_REMAPTRIGGER_DISABLE(HAL_REMAPTRIGGER_DAC1_TRIG3) for TIM15 selection */ |
bogdanm | 86:04dd9b1680ae | 207 | #define DAC_TRIGGER_HRTIM1_DACTRG1 DAC_TRIGGER_T15_TRGO /*!< HRTIM1 DACTRG1 selected as external conversion trigger for DAC |
bogdanm | 86:04dd9b1680ae | 208 | Use __HAL_REMAPTRIGGER_ENABLE(HAL_REMAPTRIGGER_DAC1_TRIG3) for HRTIM1 DACTRG1 selection */ |
bogdanm | 86:04dd9b1680ae | 209 | |
bogdanm | 86:04dd9b1680ae | 210 | #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 | 211 | Use __HAL_REMAPTRIGGER_ENABLE(HAL_REMAPTRIGGER_DAC1_TRIG5) for HRTIM1 DACTRG2 remap */ |
bogdanm | 86:04dd9b1680ae | 212 | #define DAC_TRIGGER_HRTIM1_DACTRG3 DAC_TRIGGER_HRTIM1_DACTRG2 /*!< HRTIM1 DACTRG3 selected as external conversion trigger for DAC channel (DAC2)*/ |
bogdanm | 86:04dd9b1680ae | 213 | |
bogdanm | 86:04dd9b1680ae | 214 | #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 | 215 | #define DAC_TRIGGER_SOFTWARE ((uint32_t)(DAC_CR_TSEL1 | DAC_CR_TEN1)) /*!< Conversion started by software trigger for DAC channel */ |
bogdanm | 86:04dd9b1680ae | 216 | |
bogdanm | 86:04dd9b1680ae | 217 | #define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_TRIGGER_NONE) || \ |
bogdanm | 86:04dd9b1680ae | 218 | ((TRIGGER) == DAC_TRIGGER_T6_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 219 | ((TRIGGER) == DAC_TRIGGER_T3_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 220 | ((TRIGGER) == DAC_TRIGGER_T7_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 221 | ((TRIGGER) == DAC_TRIGGER_T15_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 222 | ((TRIGGER) == DAC_TRIGGER_T2_TRGO) || \ |
bogdanm | 86:04dd9b1680ae | 223 | ((TRIGGER) == DAC_TRIGGER_HRTIM1_DACTRG2) || \ |
bogdanm | 86:04dd9b1680ae | 224 | ((TRIGGER) == DAC_TRIGGER_EXT_IT9) || \ |
bogdanm | 86:04dd9b1680ae | 225 | ((TRIGGER) == DAC_TRIGGER_SOFTWARE)) |
bogdanm | 86:04dd9b1680ae | 226 | |
bogdanm | 92:4fc01daae5a5 | 227 | #endif /* STM32F334x8 */ |
bogdanm | 86:04dd9b1680ae | 228 | |
bogdanm | 86:04dd9b1680ae | 229 | /** |
bogdanm | 86:04dd9b1680ae | 230 | * @} |
bogdanm | 86:04dd9b1680ae | 231 | */ |
bogdanm | 86:04dd9b1680ae | 232 | |
bogdanm | 92:4fc01daae5a5 | 233 | /** @defgroup DACEx_Channel_selection DAC Extended Channel selection |
bogdanm | 86:04dd9b1680ae | 234 | * @{ |
bogdanm | 86:04dd9b1680ae | 235 | */ |
bogdanm | 86:04dd9b1680ae | 236 | |
bogdanm | 92:4fc01daae5a5 | 237 | #if defined(STM32F302xE) || \ |
bogdanm | 92:4fc01daae5a5 | 238 | defined(STM32F302xC) || \ |
bogdanm | 92:4fc01daae5a5 | 239 | defined(STM32F301x8) || defined(STM32F302x8) || defined(STM32F318xx) |
bogdanm | 86:04dd9b1680ae | 240 | #define DAC_CHANNEL_1 ((uint32_t)0x00000000) /*!< DAC Channel 1 */ |
bogdanm | 86:04dd9b1680ae | 241 | /* Aliases for compatibility */ |
bogdanm | 86:04dd9b1680ae | 242 | #define DAC1_CHANNEL_1 DAC_CHANNEL_1 /*!< DAC1 Channel 1 */ |
bogdanm | 86:04dd9b1680ae | 243 | |
bogdanm | 86:04dd9b1680ae | 244 | #define IS_DAC_CHANNEL(CHANNEL) ((CHANNEL) == DAC_CHANNEL_1) |
bogdanm | 92:4fc01daae5a5 | 245 | #endif /* STM32F302xE || */ |
bogdanm | 92:4fc01daae5a5 | 246 | /* STM32F302xC || */ |
bogdanm | 92:4fc01daae5a5 | 247 | /* STM32F301x8 || STM32F302x8 || STM32F318xx */ |
bogdanm | 86:04dd9b1680ae | 248 | |
bogdanm | 86:04dd9b1680ae | 249 | |
bogdanm | 92:4fc01daae5a5 | 250 | #if defined(STM32F303xE) || defined(STM32F398xx) || \ |
bogdanm | 92:4fc01daae5a5 | 251 | defined(STM32F303xC) || defined(STM32F358xx) |
bogdanm | 86:04dd9b1680ae | 252 | #define DAC_CHANNEL_1 ((uint32_t)0x00000000) /*!< DAC Channel 1 */ |
bogdanm | 86:04dd9b1680ae | 253 | #define DAC_CHANNEL_2 ((uint32_t)0x00000010) /*!< DAC Channel 2 */ |
bogdanm | 86:04dd9b1680ae | 254 | /* Aliases for compatibility */ |
bogdanm | 86:04dd9b1680ae | 255 | #define DAC1_CHANNEL_1 DAC_CHANNEL_1 /*!< DAC1 Channel 1 */ |
bogdanm | 86:04dd9b1680ae | 256 | #define DAC1_CHANNEL_2 DAC_CHANNEL_2 /*!< DAC1 Channel 2 */ |
bogdanm | 86:04dd9b1680ae | 257 | |
bogdanm | 86:04dd9b1680ae | 258 | #define IS_DAC_CHANNEL(CHANNEL) (((CHANNEL) == DAC_CHANNEL_1) || \ |
bogdanm | 86:04dd9b1680ae | 259 | ((CHANNEL) == DAC_CHANNEL_2)) |
bogdanm | 92:4fc01daae5a5 | 260 | #endif /* STM32F303xE || STM32F398xx || */ |
bogdanm | 92:4fc01daae5a5 | 261 | /* STM32F303xC || STM32F358xx */ |
bogdanm | 86:04dd9b1680ae | 262 | |
bogdanm | 92:4fc01daae5a5 | 263 | #if defined(STM32F303x8) || defined(STM32F334x8) || defined(STM32F328xx) || \ |
bogdanm | 92:4fc01daae5a5 | 264 | defined(STM32F373xC) || defined(STM32F378xx) |
bogdanm | 86:04dd9b1680ae | 265 | |
bogdanm | 86:04dd9b1680ae | 266 | #define DAC_CHANNEL_1 ((uint32_t)0x00000000) /*!< DAC Channel 1 */ |
bogdanm | 86:04dd9b1680ae | 267 | #define DAC_CHANNEL_2 ((uint32_t)0x00000010) /*!< DAC Channel 2 */ |
bogdanm | 86:04dd9b1680ae | 268 | |
bogdanm | 86:04dd9b1680ae | 269 | /* Aliases for compatibility */ |
bogdanm | 86:04dd9b1680ae | 270 | #define DAC1_CHANNEL_1 DAC_CHANNEL_1 /*!< DAC1 Channel 1 */ |
bogdanm | 86:04dd9b1680ae | 271 | #define DAC1_CHANNEL_2 DAC_CHANNEL_2 /*!< DAC1 Channel 2 */ |
bogdanm | 86:04dd9b1680ae | 272 | #define DAC2_CHANNEL_1 DAC_CHANNEL_1 /*!< DAC2 Channel 1 */ |
bogdanm | 86:04dd9b1680ae | 273 | |
bogdanm | 86:04dd9b1680ae | 274 | #define IS_DAC_CHANNEL(CHANNEL) (((CHANNEL) == DAC_CHANNEL_1) || \ |
bogdanm | 86:04dd9b1680ae | 275 | ((CHANNEL) == DAC_CHANNEL_2)) |
bogdanm | 92:4fc01daae5a5 | 276 | #endif /* STM32F303x8 || STM32F334x8 || STM32F328xx || */ |
bogdanm | 92:4fc01daae5a5 | 277 | /* STM32F373xC || STM32F378xx */ |
bogdanm | 86:04dd9b1680ae | 278 | |
bogdanm | 86:04dd9b1680ae | 279 | /** |
bogdanm | 86:04dd9b1680ae | 280 | * @} |
bogdanm | 86:04dd9b1680ae | 281 | */ |
bogdanm | 86:04dd9b1680ae | 282 | |
bogdanm | 92:4fc01daae5a5 | 283 | /** |
bogdanm | 92:4fc01daae5a5 | 284 | * @} |
bogdanm | 92:4fc01daae5a5 | 285 | */ |
bogdanm | 86:04dd9b1680ae | 286 | |
bogdanm | 92:4fc01daae5a5 | 287 | /* Exported macro ------------------------------------------------------------*/ |
bogdanm | 92:4fc01daae5a5 | 288 | /** @addtogroup DACEx_Exported_Functions DAC Extended Exported Functions |
bogdanm | 92:4fc01daae5a5 | 289 | * @{ |
bogdanm | 92:4fc01daae5a5 | 290 | */ |
bogdanm | 92:4fc01daae5a5 | 291 | /* Extended features functions ***********************************************/ |
bogdanm | 86:04dd9b1680ae | 292 | uint32_t HAL_DACEx_DualGetValue(DAC_HandleTypeDef* hdac); |
bogdanm | 86:04dd9b1680ae | 293 | HAL_StatusTypeDef HAL_DACEx_DualSetValue(DAC_HandleTypeDef* hdac, uint32_t alignment, uint32_t data1, uint32_t data2); |
bogdanm | 86:04dd9b1680ae | 294 | HAL_StatusTypeDef HAL_DACEx_TriangleWaveGenerate(DAC_HandleTypeDef* hdac, uint32_t channel, uint32_t Amplitude); |
bogdanm | 86:04dd9b1680ae | 295 | HAL_StatusTypeDef HAL_DACEx_NoiseWaveGenerate(DAC_HandleTypeDef* hdac, uint32_t channel, uint32_t Amplitude); |
bogdanm | 86:04dd9b1680ae | 296 | |
bogdanm | 86:04dd9b1680ae | 297 | void HAL_DACEx_ConvCpltCallbackCh2(DAC_HandleTypeDef* hdac); |
bogdanm | 86:04dd9b1680ae | 298 | void HAL_DACEx_ConvHalfCpltCallbackCh2(DAC_HandleTypeDef* hdac); |
bogdanm | 86:04dd9b1680ae | 299 | void HAL_DACEx_ErrorCallbackCh2(DAC_HandleTypeDef *hdac); |
bogdanm | 86:04dd9b1680ae | 300 | void HAL_DACEx_DMAUnderrunCallbackCh2(DAC_HandleTypeDef *hdac); |
bogdanm | 86:04dd9b1680ae | 301 | |
bogdanm | 86:04dd9b1680ae | 302 | /** |
bogdanm | 92:4fc01daae5a5 | 303 | * @} |
bogdanm | 92:4fc01daae5a5 | 304 | */ |
bogdanm | 92:4fc01daae5a5 | 305 | |
bogdanm | 92:4fc01daae5a5 | 306 | /** |
bogdanm | 86:04dd9b1680ae | 307 | * @} |
bogdanm | 86:04dd9b1680ae | 308 | */ |
bogdanm | 86:04dd9b1680ae | 309 | |
bogdanm | 86:04dd9b1680ae | 310 | /** |
bogdanm | 86:04dd9b1680ae | 311 | * @} |
bogdanm | 86:04dd9b1680ae | 312 | */ |
bogdanm | 86:04dd9b1680ae | 313 | |
bogdanm | 86:04dd9b1680ae | 314 | #ifdef __cplusplus |
bogdanm | 86:04dd9b1680ae | 315 | } |
bogdanm | 86:04dd9b1680ae | 316 | #endif |
bogdanm | 86:04dd9b1680ae | 317 | |
bogdanm | 86:04dd9b1680ae | 318 | #endif /* __STM32F3xx_HAL_HAL_EX_H */ |
bogdanm | 86:04dd9b1680ae | 319 | |
bogdanm | 86:04dd9b1680ae | 320 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |