mbed library sources modified for open wear
Dependents: openwear-lifelogger-example
Fork of mbed-src by
targets/cmsis/TARGET_STM/TARGET_NUCLEO_F072RB/stm32f0xx_hal_dac_ex.h@218:44081b78fdc2, 2014-05-30 (annotated)
- Committer:
- mbed_official
- Date:
- Fri May 30 15:30:09 2014 +0100
- Revision:
- 218:44081b78fdc2
- Parent:
- 205:c41fc65bcfb4
Synchronized with git revision d854859072d318241476ccc5f335965444d4c1d8
Full URL: https://github.com/mbedmicro/mbed/commit/d854859072d318241476ccc5f335965444d4c1d8/
[NUCLEO_F072RB] Update CubeF0 HAL driver
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 205:c41fc65bcfb4 | 1 | /** |
mbed_official | 205:c41fc65bcfb4 | 2 | ****************************************************************************** |
mbed_official | 205:c41fc65bcfb4 | 3 | * @file stm32f0xx_hal_dac.h |
mbed_official | 205:c41fc65bcfb4 | 4 | * @author MCD Application Team |
mbed_official | 205:c41fc65bcfb4 | 5 | * @version V1.0.0 |
mbed_official | 218:44081b78fdc2 | 6 | * @date 28-May-2014 |
mbed_official | 205:c41fc65bcfb4 | 7 | * @brief Header file of DAC HAL Extension module. |
mbed_official | 205:c41fc65bcfb4 | 8 | ****************************************************************************** |
mbed_official | 205:c41fc65bcfb4 | 9 | * @attention |
mbed_official | 205:c41fc65bcfb4 | 10 | * |
mbed_official | 205:c41fc65bcfb4 | 11 | * <h2><center>© COPYRIGHT(c) 2014 STMicroelectronics</center></h2> |
mbed_official | 205:c41fc65bcfb4 | 12 | * |
mbed_official | 205:c41fc65bcfb4 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 205:c41fc65bcfb4 | 14 | * are permitted provided that the following conditions are met: |
mbed_official | 205:c41fc65bcfb4 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 205:c41fc65bcfb4 | 16 | * this list of conditions and the following disclaimer. |
mbed_official | 205:c41fc65bcfb4 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 205:c41fc65bcfb4 | 18 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 205:c41fc65bcfb4 | 19 | * and/or other materials provided with the distribution. |
mbed_official | 205:c41fc65bcfb4 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 205:c41fc65bcfb4 | 21 | * may be used to endorse or promote products derived from this software |
mbed_official | 205:c41fc65bcfb4 | 22 | * without specific prior written permission. |
mbed_official | 205:c41fc65bcfb4 | 23 | * |
mbed_official | 205:c41fc65bcfb4 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 205:c41fc65bcfb4 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 205:c41fc65bcfb4 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 205:c41fc65bcfb4 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 205:c41fc65bcfb4 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 205:c41fc65bcfb4 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 205:c41fc65bcfb4 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 205:c41fc65bcfb4 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 205:c41fc65bcfb4 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 205:c41fc65bcfb4 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 205:c41fc65bcfb4 | 34 | * |
mbed_official | 205:c41fc65bcfb4 | 35 | ****************************************************************************** |
mbed_official | 205:c41fc65bcfb4 | 36 | */ |
mbed_official | 205:c41fc65bcfb4 | 37 | |
mbed_official | 205:c41fc65bcfb4 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
mbed_official | 205:c41fc65bcfb4 | 39 | #ifndef __STM32F0xx_HAL_DAC_EX_H |
mbed_official | 205:c41fc65bcfb4 | 40 | #define __STM32F0xx_HAL_DAC_EX_H |
mbed_official | 205:c41fc65bcfb4 | 41 | |
mbed_official | 205:c41fc65bcfb4 | 42 | #ifdef __cplusplus |
mbed_official | 205:c41fc65bcfb4 | 43 | extern "C" { |
mbed_official | 205:c41fc65bcfb4 | 44 | #endif |
mbed_official | 205:c41fc65bcfb4 | 45 | |
mbed_official | 205:c41fc65bcfb4 | 46 | #if defined(STM32F051x8) || defined(STM32F058xx) || \ |
mbed_official | 205:c41fc65bcfb4 | 47 | defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) |
mbed_official | 205:c41fc65bcfb4 | 48 | |
mbed_official | 205:c41fc65bcfb4 | 49 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 205:c41fc65bcfb4 | 50 | #include "stm32f0xx_hal_def.h" |
mbed_official | 205:c41fc65bcfb4 | 51 | |
mbed_official | 205:c41fc65bcfb4 | 52 | /** @addtogroup STM32F0xx_HAL_Driver |
mbed_official | 205:c41fc65bcfb4 | 53 | * @{ |
mbed_official | 205:c41fc65bcfb4 | 54 | */ |
mbed_official | 205:c41fc65bcfb4 | 55 | |
mbed_official | 205:c41fc65bcfb4 | 56 | /** @addtogroup DACEx |
mbed_official | 205:c41fc65bcfb4 | 57 | * @{ |
mbed_official | 205:c41fc65bcfb4 | 58 | */ |
mbed_official | 205:c41fc65bcfb4 | 59 | |
mbed_official | 205:c41fc65bcfb4 | 60 | /* Exported types ------------------------------------------------------------*/ |
mbed_official | 205:c41fc65bcfb4 | 61 | |
mbed_official | 205:c41fc65bcfb4 | 62 | /** |
mbed_official | 205:c41fc65bcfb4 | 63 | * @brief HAL State structures definition |
mbed_official | 205:c41fc65bcfb4 | 64 | */ |
mbed_official | 205:c41fc65bcfb4 | 65 | |
mbed_official | 205:c41fc65bcfb4 | 66 | /* Exported constants --------------------------------------------------------*/ |
mbed_official | 205:c41fc65bcfb4 | 67 | |
mbed_official | 205:c41fc65bcfb4 | 68 | /** @defgroup DACEx_wave_generation |
mbed_official | 205:c41fc65bcfb4 | 69 | * @{ |
mbed_official | 205:c41fc65bcfb4 | 70 | */ |
mbed_official | 205:c41fc65bcfb4 | 71 | #define DAC_WAVEGENERATION_NONE ((uint32_t)0x00000000) |
mbed_official | 205:c41fc65bcfb4 | 72 | #define DAC_WAVEGENERATION_NOISE ((uint32_t)DAC_CR_WAVE1_0) |
mbed_official | 205:c41fc65bcfb4 | 73 | #define DAC_WAVEGENERATION_TRIANGLE ((uint32_t)DAC_CR_WAVE1_1) |
mbed_official | 205:c41fc65bcfb4 | 74 | |
mbed_official | 205:c41fc65bcfb4 | 75 | #define IS_DAC_GENERATE_WAVE(WAVE) (((WAVE) == DAC_WAVEGENERATION_NONE) || \ |
mbed_official | 205:c41fc65bcfb4 | 76 | ((WAVE) == DAC_WAVEGENERATION_NOISE) || \ |
mbed_official | 205:c41fc65bcfb4 | 77 | ((WAVE) == DAC_WAVEGENERATION_TRIANGLE)) |
mbed_official | 205:c41fc65bcfb4 | 78 | /** |
mbed_official | 205:c41fc65bcfb4 | 79 | * @} |
mbed_official | 205:c41fc65bcfb4 | 80 | */ |
mbed_official | 205:c41fc65bcfb4 | 81 | |
mbed_official | 205:c41fc65bcfb4 | 82 | /** @defgroup DACEx_lfsrunmask_triangleamplitude |
mbed_official | 205:c41fc65bcfb4 | 83 | * @{ |
mbed_official | 205:c41fc65bcfb4 | 84 | */ |
mbed_official | 205:c41fc65bcfb4 | 85 | #define DAC_LFSRUNMASK_BIT0 ((uint32_t)0x00000000) /*!< Unmask DAC channel LFSR bit0 for noise wave generation */ |
mbed_official | 205:c41fc65bcfb4 | 86 | #define DAC_LFSRUNMASK_BITS1_0 ((uint32_t)DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[1:0] for noise wave generation */ |
mbed_official | 205:c41fc65bcfb4 | 87 | #define DAC_LFSRUNMASK_BITS2_0 ((uint32_t)DAC_CR_MAMP1_1) /*!< Unmask DAC channel LFSR bit[2:0] for noise wave generation */ |
mbed_official | 205:c41fc65bcfb4 | 88 | #define DAC_LFSRUNMASK_BITS3_0 ((uint32_t)DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0)/*!< Unmask DAC channel LFSR bit[3:0] for noise wave generation */ |
mbed_official | 205:c41fc65bcfb4 | 89 | #define DAC_LFSRUNMASK_BITS4_0 ((uint32_t)DAC_CR_MAMP1_2) /*!< Unmask DAC channel LFSR bit[4:0] for noise wave generation */ |
mbed_official | 205:c41fc65bcfb4 | 90 | #define DAC_LFSRUNMASK_BITS5_0 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[5:0] for noise wave generation */ |
mbed_official | 205:c41fc65bcfb4 | 91 | #define DAC_LFSRUNMASK_BITS6_0 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1) /*!< Unmask DAC channel LFSR bit[6:0] for noise wave generation */ |
mbed_official | 205:c41fc65bcfb4 | 92 | #define DAC_LFSRUNMASK_BITS7_0 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[7:0] for noise wave generation */ |
mbed_official | 205:c41fc65bcfb4 | 93 | #define DAC_LFSRUNMASK_BITS8_0 ((uint32_t)DAC_CR_MAMP1_3) /*!< Unmask DAC channel LFSR bit[8:0] for noise wave generation */ |
mbed_official | 205:c41fc65bcfb4 | 94 | #define DAC_LFSRUNMASK_BITS9_0 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[9:0] for noise wave generation */ |
mbed_official | 205:c41fc65bcfb4 | 95 | #define DAC_LFSRUNMASK_BITS10_0 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1) /*!< Unmask DAC channel LFSR bit[10:0] for noise wave generation */ |
mbed_official | 205:c41fc65bcfb4 | 96 | #define DAC_LFSRUNMASK_BITS11_0 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[11:0] for noise wave generation */ |
mbed_official | 205:c41fc65bcfb4 | 97 | #define DAC_TRIANGLEAMPLITUDE_1 ((uint32_t)0x00000000) /*!< Select max triangle amplitude of 1 */ |
mbed_official | 205:c41fc65bcfb4 | 98 | #define DAC_TRIANGLEAMPLITUDE_3 ((uint32_t)DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 3 */ |
mbed_official | 205:c41fc65bcfb4 | 99 | #define DAC_TRIANGLEAMPLITUDE_7 ((uint32_t)DAC_CR_MAMP1_1) /*!< Select max triangle amplitude of 7 */ |
mbed_official | 205:c41fc65bcfb4 | 100 | #define DAC_TRIANGLEAMPLITUDE_15 ((uint32_t)DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 15 */ |
mbed_official | 205:c41fc65bcfb4 | 101 | #define DAC_TRIANGLEAMPLITUDE_31 ((uint32_t)DAC_CR_MAMP1_2) /*!< Select max triangle amplitude of 31 */ |
mbed_official | 205:c41fc65bcfb4 | 102 | #define DAC_TRIANGLEAMPLITUDE_63 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 63 */ |
mbed_official | 205:c41fc65bcfb4 | 103 | #define DAC_TRIANGLEAMPLITUDE_127 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1) /*!< Select max triangle amplitude of 127 */ |
mbed_official | 205:c41fc65bcfb4 | 104 | #define DAC_TRIANGLEAMPLITUDE_255 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 255 */ |
mbed_official | 205:c41fc65bcfb4 | 105 | #define DAC_TRIANGLEAMPLITUDE_511 ((uint32_t)DAC_CR_MAMP1_3) /*!< Select max triangle amplitude of 511 */ |
mbed_official | 205:c41fc65bcfb4 | 106 | #define DAC_TRIANGLEAMPLITUDE_1023 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 1023 */ |
mbed_official | 205:c41fc65bcfb4 | 107 | #define DAC_TRIANGLEAMPLITUDE_2047 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1) /*!< Select max triangle amplitude of 2047 */ |
mbed_official | 205:c41fc65bcfb4 | 108 | #define DAC_TRIANGLEAMPLITUDE_4095 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 4095 */ |
mbed_official | 205:c41fc65bcfb4 | 109 | |
mbed_official | 205:c41fc65bcfb4 | 110 | #define IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(VALUE) (((VALUE) == DAC_LFSRUNMASK_BIT0) || \ |
mbed_official | 205:c41fc65bcfb4 | 111 | ((VALUE) == DAC_LFSRUNMASK_BITS1_0) || \ |
mbed_official | 205:c41fc65bcfb4 | 112 | ((VALUE) == DAC_LFSRUNMASK_BITS2_0) || \ |
mbed_official | 205:c41fc65bcfb4 | 113 | ((VALUE) == DAC_LFSRUNMASK_BITS3_0) || \ |
mbed_official | 205:c41fc65bcfb4 | 114 | ((VALUE) == DAC_LFSRUNMASK_BITS4_0) || \ |
mbed_official | 205:c41fc65bcfb4 | 115 | ((VALUE) == DAC_LFSRUNMASK_BITS5_0) || \ |
mbed_official | 205:c41fc65bcfb4 | 116 | ((VALUE) == DAC_LFSRUNMASK_BITS6_0) || \ |
mbed_official | 205:c41fc65bcfb4 | 117 | ((VALUE) == DAC_LFSRUNMASK_BITS7_0) || \ |
mbed_official | 205:c41fc65bcfb4 | 118 | ((VALUE) == DAC_LFSRUNMASK_BITS8_0) || \ |
mbed_official | 205:c41fc65bcfb4 | 119 | ((VALUE) == DAC_LFSRUNMASK_BITS9_0) || \ |
mbed_official | 205:c41fc65bcfb4 | 120 | ((VALUE) == DAC_LFSRUNMASK_BITS10_0) || \ |
mbed_official | 205:c41fc65bcfb4 | 121 | ((VALUE) == DAC_LFSRUNMASK_BITS11_0) || \ |
mbed_official | 205:c41fc65bcfb4 | 122 | ((VALUE) == DAC_TRIANGLEAMPLITUDE_1) || \ |
mbed_official | 205:c41fc65bcfb4 | 123 | ((VALUE) == DAC_TRIANGLEAMPLITUDE_3) || \ |
mbed_official | 205:c41fc65bcfb4 | 124 | ((VALUE) == DAC_TRIANGLEAMPLITUDE_7) || \ |
mbed_official | 205:c41fc65bcfb4 | 125 | ((VALUE) == DAC_TRIANGLEAMPLITUDE_15) || \ |
mbed_official | 205:c41fc65bcfb4 | 126 | ((VALUE) == DAC_TRIANGLEAMPLITUDE_31) || \ |
mbed_official | 205:c41fc65bcfb4 | 127 | ((VALUE) == DAC_TRIANGLEAMPLITUDE_63) || \ |
mbed_official | 205:c41fc65bcfb4 | 128 | ((VALUE) == DAC_TRIANGLEAMPLITUDE_127) || \ |
mbed_official | 205:c41fc65bcfb4 | 129 | ((VALUE) == DAC_TRIANGLEAMPLITUDE_255) || \ |
mbed_official | 205:c41fc65bcfb4 | 130 | ((VALUE) == DAC_TRIANGLEAMPLITUDE_511) || \ |
mbed_official | 205:c41fc65bcfb4 | 131 | ((VALUE) == DAC_TRIANGLEAMPLITUDE_1023) || \ |
mbed_official | 205:c41fc65bcfb4 | 132 | ((VALUE) == DAC_TRIANGLEAMPLITUDE_2047) || \ |
mbed_official | 205:c41fc65bcfb4 | 133 | ((VALUE) == DAC_TRIANGLEAMPLITUDE_4095)) |
mbed_official | 205:c41fc65bcfb4 | 134 | /** |
mbed_official | 205:c41fc65bcfb4 | 135 | * @} |
mbed_official | 205:c41fc65bcfb4 | 136 | */ |
mbed_official | 205:c41fc65bcfb4 | 137 | |
mbed_official | 205:c41fc65bcfb4 | 138 | /** @defgroup DACEx_wave_generation |
mbed_official | 205:c41fc65bcfb4 | 139 | * @{ |
mbed_official | 205:c41fc65bcfb4 | 140 | */ |
mbed_official | 205:c41fc65bcfb4 | 141 | #define DAC_WAVE_NOISE ((uint32_t)DAC_CR_WAVE1_0) |
mbed_official | 205:c41fc65bcfb4 | 142 | #define DAC_WAVE_TRIANGLE ((uint32_t)DAC_CR_WAVE1_1) |
mbed_official | 205:c41fc65bcfb4 | 143 | |
mbed_official | 205:c41fc65bcfb4 | 144 | #define IS_DAC_WAVE(WAVE) (((WAVE) == DAC_WAVE_NOISE) || \ |
mbed_official | 205:c41fc65bcfb4 | 145 | ((WAVE) == DAC_WAVE_TRIANGLE)) |
mbed_official | 205:c41fc65bcfb4 | 146 | |
mbed_official | 205:c41fc65bcfb4 | 147 | |
mbed_official | 205:c41fc65bcfb4 | 148 | |
mbed_official | 205:c41fc65bcfb4 | 149 | |
mbed_official | 205:c41fc65bcfb4 | 150 | |
mbed_official | 205:c41fc65bcfb4 | 151 | /** |
mbed_official | 205:c41fc65bcfb4 | 152 | * @} |
mbed_official | 205:c41fc65bcfb4 | 153 | */ |
mbed_official | 205:c41fc65bcfb4 | 154 | |
mbed_official | 205:c41fc65bcfb4 | 155 | /* Exported macro ------------------------------------------------------------*/ |
mbed_official | 205:c41fc65bcfb4 | 156 | /* Exported functions --------------------------------------------------------*/ |
mbed_official | 205:c41fc65bcfb4 | 157 | |
mbed_official | 205:c41fc65bcfb4 | 158 | /** @defgroup DAC_trigger_selection |
mbed_official | 205:c41fc65bcfb4 | 159 | * @{ |
mbed_official | 205:c41fc65bcfb4 | 160 | */ |
mbed_official | 205:c41fc65bcfb4 | 161 | #if defined(STM32F051x8) || defined(STM32F058xx) |
mbed_official | 205:c41fc65bcfb4 | 162 | |
mbed_official | 205:c41fc65bcfb4 | 163 | #define DAC_TRIGGER_NONE ((uint32_t)0x00000000) /*!< Conversion is automatic once the DAC1_DHRxxxx register |
mbed_official | 205:c41fc65bcfb4 | 164 | has been loaded, and not by external trigger */ |
mbed_official | 205:c41fc65bcfb4 | 165 | #define DAC_TRIGGER_T2_TRGO ((uint32_t)(DAC_CR_TSEL1_2 | DAC_CR_TEN1)) /*!< TIM2 TRGO selected as external conversion trigger for DAC channel */ |
mbed_official | 205:c41fc65bcfb4 | 166 | #define DAC_TRIGGER_T3_TRGO ((uint32_t)(DAC_CR_TSEL1_0 | DAC_CR_TEN1)) /*!< TIM3 TRGO selected as external conversion trigger for DAC channel */ |
mbed_official | 205:c41fc65bcfb4 | 167 | #define DAC_TRIGGER_T6_TRGO ((uint32_t)DAC_CR_TEN1) /*!< TIM6 TRGO selected as external conversion trigger for DAC channel */ |
mbed_official | 205:c41fc65bcfb4 | 168 | #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 */ |
mbed_official | 205:c41fc65bcfb4 | 169 | #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 */ |
mbed_official | 205:c41fc65bcfb4 | 170 | #define DAC_TRIGGER_SOFTWARE ((uint32_t)(DAC_CR_TSEL1 | DAC_CR_TEN1)) /*!< Conversion started by software trigger for DAC channel */ |
mbed_official | 205:c41fc65bcfb4 | 171 | |
mbed_official | 205:c41fc65bcfb4 | 172 | #define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_TRIGGER_NONE) || \ |
mbed_official | 205:c41fc65bcfb4 | 173 | ((TRIGGER) == DAC_TRIGGER_T2_TRGO) || \ |
mbed_official | 205:c41fc65bcfb4 | 174 | ((TRIGGER) == DAC_TRIGGER_T3_TRGO) || \ |
mbed_official | 205:c41fc65bcfb4 | 175 | ((TRIGGER) == DAC_TRIGGER_T6_TRGO) || \ |
mbed_official | 205:c41fc65bcfb4 | 176 | ((TRIGGER) == DAC_TRIGGER_T15_TRGO) || \ |
mbed_official | 205:c41fc65bcfb4 | 177 | ((TRIGGER) == DAC_TRIGGER_EXT_IT9) || \ |
mbed_official | 205:c41fc65bcfb4 | 178 | ((TRIGGER) == DAC_TRIGGER_SOFTWARE)) |
mbed_official | 205:c41fc65bcfb4 | 179 | |
mbed_official | 205:c41fc65bcfb4 | 180 | #endif /* STM32F051x8 || STM32F058xx */ |
mbed_official | 205:c41fc65bcfb4 | 181 | |
mbed_official | 205:c41fc65bcfb4 | 182 | #if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) |
mbed_official | 205:c41fc65bcfb4 | 183 | |
mbed_official | 205:c41fc65bcfb4 | 184 | #define DAC_TRIGGER_NONE ((uint32_t)0x00000000) /*!< Conversion is automatic once the DAC1_DHRxxxx register |
mbed_official | 205:c41fc65bcfb4 | 185 | has been loaded, and not by external trigger */ |
mbed_official | 205:c41fc65bcfb4 | 186 | #define DAC_TRIGGER_T2_TRGO ((uint32_t)(DAC_CR_TSEL1_2 | DAC_CR_TEN1)) /*!< TIM2 TRGO selected as external conversion trigger for DAC channel */ |
mbed_official | 205:c41fc65bcfb4 | 187 | #define DAC_TRIGGER_T3_TRGO ((uint32_t)(DAC_CR_TSEL1_0 | DAC_CR_TEN1)) /*!< TIM3 TRGO selected as external conversion trigger for DAC channel */ |
mbed_official | 205:c41fc65bcfb4 | 188 | #define DAC_TRIGGER_T6_TRGO ((uint32_t)DAC_CR_TEN1) /*!< TIM6 TRGO selected as external conversion trigger for DAC channel */ |
mbed_official | 205:c41fc65bcfb4 | 189 | #define DAC_TRIGGER_T7_TRGO ((uint32_t)(DAC_CR_TSEL1_1 | DAC_CR_TEN1)) /*!< TIM7 TRGO selected as external conversion trigger for DAC channel */ |
mbed_official | 205:c41fc65bcfb4 | 190 | #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 */ |
mbed_official | 205:c41fc65bcfb4 | 191 | #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 */ |
mbed_official | 205:c41fc65bcfb4 | 192 | #define DAC_TRIGGER_SOFTWARE ((uint32_t)(DAC_CR_TSEL1 | DAC_CR_TEN1)) /*!< Conversion started by software trigger for DAC channel */ |
mbed_official | 205:c41fc65bcfb4 | 193 | |
mbed_official | 205:c41fc65bcfb4 | 194 | #define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_TRIGGER_NONE) || \ |
mbed_official | 205:c41fc65bcfb4 | 195 | ((TRIGGER) == DAC_TRIGGER_T2_TRGO) || \ |
mbed_official | 205:c41fc65bcfb4 | 196 | ((TRIGGER) == DAC_TRIGGER_T3_TRGO) || \ |
mbed_official | 205:c41fc65bcfb4 | 197 | ((TRIGGER) == DAC_TRIGGER_T6_TRGO) || \ |
mbed_official | 205:c41fc65bcfb4 | 198 | ((TRIGGER) == DAC_TRIGGER_T7_TRGO) || \ |
mbed_official | 205:c41fc65bcfb4 | 199 | ((TRIGGER) == DAC_TRIGGER_T15_TRGO) || \ |
mbed_official | 205:c41fc65bcfb4 | 200 | ((TRIGGER) == DAC_TRIGGER_EXT_IT9) || \ |
mbed_official | 205:c41fc65bcfb4 | 201 | ((TRIGGER) == DAC_TRIGGER_SOFTWARE)) |
mbed_official | 205:c41fc65bcfb4 | 202 | |
mbed_official | 205:c41fc65bcfb4 | 203 | #endif /* STM32F071xB || STM32F072xB || STM32F078xx */ |
mbed_official | 205:c41fc65bcfb4 | 204 | |
mbed_official | 205:c41fc65bcfb4 | 205 | #if defined(STM32F071xB) || defined(STM32F072xB) || defined(STM32F078xx) |
mbed_official | 205:c41fc65bcfb4 | 206 | |
mbed_official | 205:c41fc65bcfb4 | 207 | /** @defgroup DAC_Channel_selection |
mbed_official | 205:c41fc65bcfb4 | 208 | * @{ |
mbed_official | 205:c41fc65bcfb4 | 209 | */ |
mbed_official | 205:c41fc65bcfb4 | 210 | #define DAC_CHANNEL_1 ((uint32_t)0x00000000) |
mbed_official | 205:c41fc65bcfb4 | 211 | #define DAC_CHANNEL_2 ((uint32_t)0x00000010) |
mbed_official | 205:c41fc65bcfb4 | 212 | |
mbed_official | 205:c41fc65bcfb4 | 213 | #define IS_DAC_CHANNEL(CHANNEL) (((CHANNEL) == DAC_CHANNEL_1) || \ |
mbed_official | 205:c41fc65bcfb4 | 214 | ((CHANNEL) == DAC_CHANNEL_2)) |
mbed_official | 205:c41fc65bcfb4 | 215 | /** |
mbed_official | 205:c41fc65bcfb4 | 216 | * @} |
mbed_official | 205:c41fc65bcfb4 | 217 | */ |
mbed_official | 205:c41fc65bcfb4 | 218 | |
mbed_official | 205:c41fc65bcfb4 | 219 | #endif /* STM32F071xB || STM32F072xB || STM32F078xx */ |
mbed_official | 205:c41fc65bcfb4 | 220 | |
mbed_official | 205:c41fc65bcfb4 | 221 | #if defined(STM32F051x8) || defined(STM32F058xx) |
mbed_official | 205:c41fc65bcfb4 | 222 | |
mbed_official | 205:c41fc65bcfb4 | 223 | #define DAC_CHANNEL_1 ((uint32_t)0x00000000) |
mbed_official | 205:c41fc65bcfb4 | 224 | #define IS_DAC_CHANNEL(CHANNEL) (((CHANNEL) == DAC_CHANNEL_1)) |
mbed_official | 205:c41fc65bcfb4 | 225 | |
mbed_official | 205:c41fc65bcfb4 | 226 | #endif /* STM32F051x8 || STM32F058xx */ |
mbed_official | 205:c41fc65bcfb4 | 227 | |
mbed_official | 205:c41fc65bcfb4 | 228 | /** |
mbed_official | 205:c41fc65bcfb4 | 229 | * @} |
mbed_official | 205:c41fc65bcfb4 | 230 | */ |
mbed_official | 205:c41fc65bcfb4 | 231 | |
mbed_official | 205:c41fc65bcfb4 | 232 | |
mbed_official | 205:c41fc65bcfb4 | 233 | /* Extension features functions ***********************************************/ |
mbed_official | 205:c41fc65bcfb4 | 234 | uint32_t HAL_DACEx_DualGetValue(DAC_HandleTypeDef* hdac); |
mbed_official | 205:c41fc65bcfb4 | 235 | HAL_StatusTypeDef HAL_DACEx_TriangleWaveGenerate(DAC_HandleTypeDef* hdac, uint32_t Channel, uint32_t Amplitude); |
mbed_official | 205:c41fc65bcfb4 | 236 | HAL_StatusTypeDef HAL_DACEx_NoiseWaveGenerate(DAC_HandleTypeDef* hdac, uint32_t Channel, uint32_t Amplitude); |
mbed_official | 205:c41fc65bcfb4 | 237 | HAL_StatusTypeDef HAL_DACEx_DualSetValue(DAC_HandleTypeDef* hdac, uint32_t Alignment, uint32_t Data1, uint32_t Data2); |
mbed_official | 205:c41fc65bcfb4 | 238 | |
mbed_official | 205:c41fc65bcfb4 | 239 | void HAL_DACEx_ConvCpltCallbackCh2(DAC_HandleTypeDef* hdac); |
mbed_official | 205:c41fc65bcfb4 | 240 | void HAL_DACEx_ConvHalfCpltCallbackCh2(DAC_HandleTypeDef* hdac); |
mbed_official | 205:c41fc65bcfb4 | 241 | void HAL_DACEx_ErrorCallbackCh2(DAC_HandleTypeDef* hdac); |
mbed_official | 205:c41fc65bcfb4 | 242 | void HAL_DACEx_DMAUnderrunCallbackCh2(DAC_HandleTypeDef* hdac); |
mbed_official | 205:c41fc65bcfb4 | 243 | |
mbed_official | 205:c41fc65bcfb4 | 244 | void DAC_DMAConvCpltCh2(DMA_HandleTypeDef *hdma); |
mbed_official | 205:c41fc65bcfb4 | 245 | void DAC_DMAErrorCh2(DMA_HandleTypeDef *hdma); |
mbed_official | 205:c41fc65bcfb4 | 246 | void DAC_DMAHalfConvCpltCh2(DMA_HandleTypeDef *hdma); |
mbed_official | 205:c41fc65bcfb4 | 247 | |
mbed_official | 205:c41fc65bcfb4 | 248 | #endif /* */ |
mbed_official | 205:c41fc65bcfb4 | 249 | |
mbed_official | 205:c41fc65bcfb4 | 250 | /** |
mbed_official | 205:c41fc65bcfb4 | 251 | * @} |
mbed_official | 205:c41fc65bcfb4 | 252 | */ |
mbed_official | 205:c41fc65bcfb4 | 253 | |
mbed_official | 205:c41fc65bcfb4 | 254 | /** |
mbed_official | 205:c41fc65bcfb4 | 255 | * @} |
mbed_official | 205:c41fc65bcfb4 | 256 | */ |
mbed_official | 205:c41fc65bcfb4 | 257 | |
mbed_official | 205:c41fc65bcfb4 | 258 | #ifdef __cplusplus |
mbed_official | 205:c41fc65bcfb4 | 259 | } |
mbed_official | 205:c41fc65bcfb4 | 260 | #endif /* STM32F051x8 || STM32F058xx || */ |
mbed_official | 205:c41fc65bcfb4 | 261 | /* STM32F071xB || STM32F072xB || STM32F078xx */ |
mbed_official | 205:c41fc65bcfb4 | 262 | |
mbed_official | 205:c41fc65bcfb4 | 263 | #endif /*__STM32F0xx_HAL_DAC_EX_H */ |
mbed_official | 205:c41fc65bcfb4 | 264 | |
mbed_official | 205:c41fc65bcfb4 | 265 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |