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