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_NUCLEO_F411RE/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 |
---|---|---|---|
bogdanm | 86:04dd9b1680ae | 1 | /** |
bogdanm | 86:04dd9b1680ae | 2 | ****************************************************************************** |
bogdanm | 86:04dd9b1680ae | 3 | * @file stm32f4xx_hal_dac.h |
bogdanm | 86:04dd9b1680ae | 4 | * @author MCD Application Team |
Kojto | 110:165afa46840b | 5 | * @version V1.4.1 |
Kojto | 110:165afa46840b | 6 | * @date 09-October-2015 |
bogdanm | 86:04dd9b1680ae | 7 | * @brief Header file of DAC HAL module. |
bogdanm | 86:04dd9b1680ae | 8 | ****************************************************************************** |
bogdanm | 86:04dd9b1680ae | 9 | * @attention |
bogdanm | 86:04dd9b1680ae | 10 | * |
Kojto | 99:dbbf35b96557 | 11 | * <h2><center>© COPYRIGHT(c) 2015 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 __STM32F4xx_HAL_DAC_H |
bogdanm | 86:04dd9b1680ae | 40 | #define __STM32F4xx_HAL_DAC_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 | |
Kojto | 99:dbbf35b96557 | 46 | #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) ||\ |
Kojto | 99:dbbf35b96557 | 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) |
bogdanm | 86:04dd9b1680ae | 50 | |
bogdanm | 86:04dd9b1680ae | 51 | /* Includes ------------------------------------------------------------------*/ |
bogdanm | 86:04dd9b1680ae | 52 | #include "stm32f4xx_hal_def.h" |
bogdanm | 86:04dd9b1680ae | 53 | |
bogdanm | 86:04dd9b1680ae | 54 | /** @addtogroup STM32F4xx_HAL_Driver |
bogdanm | 86:04dd9b1680ae | 55 | * @{ |
bogdanm | 86:04dd9b1680ae | 56 | */ |
bogdanm | 86:04dd9b1680ae | 57 | |
bogdanm | 86:04dd9b1680ae | 58 | /** @addtogroup DAC |
bogdanm | 86:04dd9b1680ae | 59 | * @{ |
bogdanm | 86:04dd9b1680ae | 60 | */ |
bogdanm | 86:04dd9b1680ae | 61 | |
bogdanm | 86:04dd9b1680ae | 62 | /* Exported types ------------------------------------------------------------*/ |
Kojto | 99:dbbf35b96557 | 63 | /** @defgroup DAC_Exported_Types DAC Exported Types |
Kojto | 99:dbbf35b96557 | 64 | * @{ |
Kojto | 99:dbbf35b96557 | 65 | */ |
bogdanm | 86:04dd9b1680ae | 66 | |
bogdanm | 86:04dd9b1680ae | 67 | /** |
Kojto | 99:dbbf35b96557 | 68 | * @brief HAL State structures definition |
bogdanm | 86:04dd9b1680ae | 69 | */ |
bogdanm | 86:04dd9b1680ae | 70 | typedef enum |
bogdanm | 86:04dd9b1680ae | 71 | { |
bogdanm | 86:04dd9b1680ae | 72 | HAL_DAC_STATE_RESET = 0x00, /*!< DAC not yet initialized or disabled */ |
bogdanm | 86:04dd9b1680ae | 73 | HAL_DAC_STATE_READY = 0x01, /*!< DAC initialized and ready for use */ |
bogdanm | 86:04dd9b1680ae | 74 | HAL_DAC_STATE_BUSY = 0x02, /*!< DAC internal processing is ongoing */ |
bogdanm | 86:04dd9b1680ae | 75 | HAL_DAC_STATE_TIMEOUT = 0x03, /*!< DAC timeout state */ |
bogdanm | 86:04dd9b1680ae | 76 | HAL_DAC_STATE_ERROR = 0x04 /*!< DAC error state */ |
bogdanm | 86:04dd9b1680ae | 77 | }HAL_DAC_StateTypeDef; |
bogdanm | 86:04dd9b1680ae | 78 | |
bogdanm | 86:04dd9b1680ae | 79 | /** |
Kojto | 99:dbbf35b96557 | 80 | * @brief DAC handle Structure definition |
bogdanm | 86:04dd9b1680ae | 81 | */ |
bogdanm | 86:04dd9b1680ae | 82 | typedef struct |
bogdanm | 86:04dd9b1680ae | 83 | { |
bogdanm | 86:04dd9b1680ae | 84 | DAC_TypeDef *Instance; /*!< Register base address */ |
bogdanm | 86:04dd9b1680ae | 85 | |
bogdanm | 86:04dd9b1680ae | 86 | __IO HAL_DAC_StateTypeDef State; /*!< DAC communication state */ |
bogdanm | 86:04dd9b1680ae | 87 | |
bogdanm | 86:04dd9b1680ae | 88 | HAL_LockTypeDef Lock; /*!< DAC locking object */ |
bogdanm | 86:04dd9b1680ae | 89 | |
bogdanm | 86:04dd9b1680ae | 90 | DMA_HandleTypeDef *DMA_Handle1; /*!< Pointer DMA handler for channel 1 */ |
bogdanm | 86:04dd9b1680ae | 91 | |
bogdanm | 86:04dd9b1680ae | 92 | DMA_HandleTypeDef *DMA_Handle2; /*!< Pointer DMA handler for channel 2 */ |
bogdanm | 86:04dd9b1680ae | 93 | |
bogdanm | 86:04dd9b1680ae | 94 | __IO uint32_t ErrorCode; /*!< DAC Error code */ |
bogdanm | 86:04dd9b1680ae | 95 | |
bogdanm | 86:04dd9b1680ae | 96 | }DAC_HandleTypeDef; |
bogdanm | 86:04dd9b1680ae | 97 | |
bogdanm | 86:04dd9b1680ae | 98 | /** |
Kojto | 99:dbbf35b96557 | 99 | * @brief DAC Configuration regular Channel structure definition |
bogdanm | 86:04dd9b1680ae | 100 | */ |
bogdanm | 86:04dd9b1680ae | 101 | typedef struct |
bogdanm | 86:04dd9b1680ae | 102 | { |
bogdanm | 86:04dd9b1680ae | 103 | uint32_t DAC_Trigger; /*!< Specifies the external trigger for the selected DAC channel. |
bogdanm | 86:04dd9b1680ae | 104 | This parameter can be a value of @ref DAC_trigger_selection */ |
bogdanm | 86:04dd9b1680ae | 105 | |
bogdanm | 86:04dd9b1680ae | 106 | uint32_t DAC_OutputBuffer; /*!< Specifies whether the DAC channel output buffer is enabled or disabled. |
bogdanm | 86:04dd9b1680ae | 107 | This parameter can be a value of @ref DAC_output_buffer */ |
bogdanm | 86:04dd9b1680ae | 108 | }DAC_ChannelConfTypeDef; |
Kojto | 99:dbbf35b96557 | 109 | /** |
Kojto | 99:dbbf35b96557 | 110 | * @} |
Kojto | 99:dbbf35b96557 | 111 | */ |
bogdanm | 86:04dd9b1680ae | 112 | |
bogdanm | 86:04dd9b1680ae | 113 | /* Exported constants --------------------------------------------------------*/ |
Kojto | 99:dbbf35b96557 | 114 | /** @defgroup DAC_Exported_Constants DAC Exported Constants |
Kojto | 99:dbbf35b96557 | 115 | * @{ |
Kojto | 99:dbbf35b96557 | 116 | */ |
bogdanm | 86:04dd9b1680ae | 117 | |
Kojto | 99:dbbf35b96557 | 118 | /** @defgroup DAC_Error_Code DAC Error Code |
bogdanm | 86:04dd9b1680ae | 119 | * @{ |
bogdanm | 86:04dd9b1680ae | 120 | */ |
bogdanm | 86:04dd9b1680ae | 121 | #define HAL_DAC_ERROR_NONE 0x00 /*!< No error */ |
bogdanm | 86:04dd9b1680ae | 122 | #define HAL_DAC_ERROR_DMAUNDERRUNCH1 0x01 /*!< DAC channel1 DAM underrun error */ |
bogdanm | 86:04dd9b1680ae | 123 | #define HAL_DAC_ERROR_DMAUNDERRUNCH2 0x02 /*!< DAC channel2 DAM underrun error */ |
bogdanm | 86:04dd9b1680ae | 124 | #define HAL_DAC_ERROR_DMA 0x04 /*!< DMA error */ |
bogdanm | 86:04dd9b1680ae | 125 | /** |
bogdanm | 86:04dd9b1680ae | 126 | * @} |
bogdanm | 86:04dd9b1680ae | 127 | */ |
bogdanm | 86:04dd9b1680ae | 128 | |
Kojto | 99:dbbf35b96557 | 129 | /** @defgroup DAC_trigger_selection DAC Trigger Selection |
bogdanm | 86:04dd9b1680ae | 130 | * @{ |
bogdanm | 86:04dd9b1680ae | 131 | */ |
bogdanm | 86:04dd9b1680ae | 132 | |
bogdanm | 86:04dd9b1680ae | 133 | #define DAC_TRIGGER_NONE ((uint32_t)0x00000000) /*!< Conversion is automatic once the DAC1_DHRxxxx register |
bogdanm | 86:04dd9b1680ae | 134 | has been loaded, and not by external trigger */ |
bogdanm | 86:04dd9b1680ae | 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 */ |
bogdanm | 86:04dd9b1680ae | 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 */ |
bogdanm | 86:04dd9b1680ae | 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 */ |
bogdanm | 86:04dd9b1680ae | 138 | #define DAC_TRIGGER_T6_TRGO ((uint32_t)DAC_CR_TEN1) /*!< TIM6 TRGO selected as external conversion trigger for DAC channel */ |
bogdanm | 86:04dd9b1680ae | 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 */ |
bogdanm | 86:04dd9b1680ae | 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 */ |
bogdanm | 86:04dd9b1680ae | 141 | |
bogdanm | 86:04dd9b1680ae | 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 */ |
bogdanm | 86:04dd9b1680ae | 143 | #define DAC_TRIGGER_SOFTWARE ((uint32_t)(DAC_CR_TSEL1 | DAC_CR_TEN1)) /*!< Conversion started by software trigger for DAC channel */ |
bogdanm | 86:04dd9b1680ae | 144 | /** |
bogdanm | 86:04dd9b1680ae | 145 | * @} |
bogdanm | 86:04dd9b1680ae | 146 | */ |
bogdanm | 86:04dd9b1680ae | 147 | |
Kojto | 99:dbbf35b96557 | 148 | /** @defgroup DAC_output_buffer DAC Output Buffer |
bogdanm | 86:04dd9b1680ae | 149 | * @{ |
bogdanm | 86:04dd9b1680ae | 150 | */ |
bogdanm | 86:04dd9b1680ae | 151 | #define DAC_OUTPUTBUFFER_ENABLE ((uint32_t)0x00000000) |
bogdanm | 86:04dd9b1680ae | 152 | #define DAC_OUTPUTBUFFER_DISABLE ((uint32_t)DAC_CR_BOFF1) |
bogdanm | 86:04dd9b1680ae | 153 | /** |
bogdanm | 86:04dd9b1680ae | 154 | * @} |
bogdanm | 86:04dd9b1680ae | 155 | */ |
bogdanm | 86:04dd9b1680ae | 156 | |
Kojto | 99:dbbf35b96557 | 157 | /** @defgroup DAC_Channel_selection DAC Channel Selection |
bogdanm | 86:04dd9b1680ae | 158 | * @{ |
bogdanm | 86:04dd9b1680ae | 159 | */ |
bogdanm | 86:04dd9b1680ae | 160 | #define DAC_CHANNEL_1 ((uint32_t)0x00000000) |
bogdanm | 86:04dd9b1680ae | 161 | #define DAC_CHANNEL_2 ((uint32_t)0x00000010) |
bogdanm | 86:04dd9b1680ae | 162 | /** |
bogdanm | 86:04dd9b1680ae | 163 | * @} |
bogdanm | 86:04dd9b1680ae | 164 | */ |
bogdanm | 86:04dd9b1680ae | 165 | |
Kojto | 99:dbbf35b96557 | 166 | /** @defgroup DAC_data_alignment DAC Data Alignment |
bogdanm | 86:04dd9b1680ae | 167 | * @{ |
bogdanm | 86:04dd9b1680ae | 168 | */ |
bogdanm | 86:04dd9b1680ae | 169 | #define DAC_ALIGN_12B_R ((uint32_t)0x00000000) |
bogdanm | 86:04dd9b1680ae | 170 | #define DAC_ALIGN_12B_L ((uint32_t)0x00000004) |
bogdanm | 86:04dd9b1680ae | 171 | #define DAC_ALIGN_8B_R ((uint32_t)0x00000008) |
bogdanm | 86:04dd9b1680ae | 172 | /** |
bogdanm | 86:04dd9b1680ae | 173 | * @} |
bogdanm | 86:04dd9b1680ae | 174 | */ |
bogdanm | 86:04dd9b1680ae | 175 | |
Kojto | 99:dbbf35b96557 | 176 | /** @defgroup DAC_flags_definition DAC Flags Definition |
bogdanm | 86:04dd9b1680ae | 177 | * @{ |
bogdanm | 86:04dd9b1680ae | 178 | */ |
bogdanm | 86:04dd9b1680ae | 179 | #define DAC_FLAG_DMAUDR1 ((uint32_t)DAC_SR_DMAUDR1) |
bogdanm | 86:04dd9b1680ae | 180 | #define DAC_FLAG_DMAUDR2 ((uint32_t)DAC_SR_DMAUDR2) |
bogdanm | 86:04dd9b1680ae | 181 | /** |
bogdanm | 86:04dd9b1680ae | 182 | * @} |
bogdanm | 86:04dd9b1680ae | 183 | */ |
bogdanm | 86:04dd9b1680ae | 184 | |
Kojto | 99:dbbf35b96557 | 185 | /** @defgroup DAC_IT_definition DAC IT Definition |
bogdanm | 86:04dd9b1680ae | 186 | * @{ |
bogdanm | 86:04dd9b1680ae | 187 | */ |
bogdanm | 86:04dd9b1680ae | 188 | #define DAC_IT_DMAUDR1 ((uint32_t)DAC_SR_DMAUDR1) |
bogdanm | 86:04dd9b1680ae | 189 | #define DAC_IT_DMAUDR2 ((uint32_t)DAC_SR_DMAUDR2) |
Kojto | 99:dbbf35b96557 | 190 | /** |
Kojto | 99:dbbf35b96557 | 191 | * @} |
Kojto | 99:dbbf35b96557 | 192 | */ |
bogdanm | 86:04dd9b1680ae | 193 | |
bogdanm | 86:04dd9b1680ae | 194 | /** |
bogdanm | 86:04dd9b1680ae | 195 | * @} |
bogdanm | 86:04dd9b1680ae | 196 | */ |
bogdanm | 86:04dd9b1680ae | 197 | |
bogdanm | 86:04dd9b1680ae | 198 | /* Exported macro ------------------------------------------------------------*/ |
Kojto | 99:dbbf35b96557 | 199 | /** @defgroup DAC_Exported_Macros DAC Exported Macros |
Kojto | 99:dbbf35b96557 | 200 | * @{ |
Kojto | 99:dbbf35b96557 | 201 | */ |
bogdanm | 86:04dd9b1680ae | 202 | |
bogdanm | 86:04dd9b1680ae | 203 | /** @brief Reset DAC handle state |
bogdanm | 86:04dd9b1680ae | 204 | * @param __HANDLE__: specifies the DAC handle. |
bogdanm | 86:04dd9b1680ae | 205 | * @retval None |
bogdanm | 86:04dd9b1680ae | 206 | */ |
bogdanm | 86:04dd9b1680ae | 207 | #define __HAL_DAC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DAC_STATE_RESET) |
bogdanm | 86:04dd9b1680ae | 208 | |
bogdanm | 86:04dd9b1680ae | 209 | /** @brief Enable the DAC channel |
bogdanm | 86:04dd9b1680ae | 210 | * @param __HANDLE__: specifies the DAC handle. |
bogdanm | 86:04dd9b1680ae | 211 | * @param __DAC_Channel__: specifies the DAC channel |
bogdanm | 86:04dd9b1680ae | 212 | * @retval None |
bogdanm | 86:04dd9b1680ae | 213 | */ |
Kojto | 99:dbbf35b96557 | 214 | #define __HAL_DAC_ENABLE(__HANDLE__, __DAC_Channel__) ((__HANDLE__)->Instance->CR |= (DAC_CR_EN1 << (__DAC_Channel__))) |
bogdanm | 86:04dd9b1680ae | 215 | |
bogdanm | 86:04dd9b1680ae | 216 | /** @brief Disable the DAC channel |
bogdanm | 86:04dd9b1680ae | 217 | * @param __HANDLE__: specifies the DAC handle |
bogdanm | 86:04dd9b1680ae | 218 | * @param __DAC_Channel__: specifies the DAC channel. |
bogdanm | 86:04dd9b1680ae | 219 | * @retval None |
bogdanm | 86:04dd9b1680ae | 220 | */ |
Kojto | 99:dbbf35b96557 | 221 | #define __HAL_DAC_DISABLE(__HANDLE__, __DAC_Channel__) ((__HANDLE__)->Instance->CR &= ~(DAC_CR_EN1 << (__DAC_Channel__))) |
bogdanm | 86:04dd9b1680ae | 222 | |
bogdanm | 86:04dd9b1680ae | 223 | /** @brief Enable the DAC interrupt |
bogdanm | 86:04dd9b1680ae | 224 | * @param __HANDLE__: specifies the DAC handle |
bogdanm | 86:04dd9b1680ae | 225 | * @param __INTERRUPT__: specifies the DAC interrupt. |
bogdanm | 86:04dd9b1680ae | 226 | * @retval None |
bogdanm | 86:04dd9b1680ae | 227 | */ |
bogdanm | 86:04dd9b1680ae | 228 | #define __HAL_DAC_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR) |= (__INTERRUPT__)) |
bogdanm | 86:04dd9b1680ae | 229 | |
bogdanm | 86:04dd9b1680ae | 230 | /** @brief Disable the DAC interrupt |
bogdanm | 86:04dd9b1680ae | 231 | * @param __HANDLE__: specifies the DAC handle |
bogdanm | 86:04dd9b1680ae | 232 | * @param __INTERRUPT__: specifies the DAC interrupt. |
bogdanm | 86:04dd9b1680ae | 233 | * @retval None |
bogdanm | 86:04dd9b1680ae | 234 | */ |
bogdanm | 86:04dd9b1680ae | 235 | #define __HAL_DAC_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR) &= ~(__INTERRUPT__)) |
bogdanm | 86:04dd9b1680ae | 236 | |
Kojto | 99:dbbf35b96557 | 237 | /** @brief Checks if the specified DAC interrupt source is enabled or disabled. |
Kojto | 99:dbbf35b96557 | 238 | * @param __HANDLE__: DAC handle |
Kojto | 99:dbbf35b96557 | 239 | * @param __INTERRUPT__: DAC interrupt source to check |
Kojto | 99:dbbf35b96557 | 240 | * This parameter can be any combination of the following values: |
Kojto | 99:dbbf35b96557 | 241 | * @arg DAC_IT_DMAUDR1: DAC channel 1 DMA underrun interrupt |
Kojto | 99:dbbf35b96557 | 242 | * @arg DAC_IT_DMAUDR2: DAC channel 2 DMA underrun interrupt |
Kojto | 99:dbbf35b96557 | 243 | * @retval State of interruption (SET or RESET) |
Kojto | 99:dbbf35b96557 | 244 | */ |
Kojto | 99:dbbf35b96557 | 245 | #define __HAL_DAC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR & (__INTERRUPT__)) == (__INTERRUPT__)) |
Kojto | 99:dbbf35b96557 | 246 | |
bogdanm | 86:04dd9b1680ae | 247 | /** @brief Get the selected DAC's flag status. |
bogdanm | 86:04dd9b1680ae | 248 | * @param __HANDLE__: specifies the DAC handle. |
Kojto | 99:dbbf35b96557 | 249 | * @param __FLAG__: specifies the flag to clear. |
Kojto | 99:dbbf35b96557 | 250 | * This parameter can be any combination of the following values: |
Kojto | 99:dbbf35b96557 | 251 | * @arg DAC_FLAG_DMAUDR1: DMA underrun 1 flag |
Kojto | 99:dbbf35b96557 | 252 | * @arg DAC_FLAG_DMAUDR2: DMA underrun 2 flag |
bogdanm | 86:04dd9b1680ae | 253 | * @retval None |
bogdanm | 86:04dd9b1680ae | 254 | */ |
bogdanm | 86:04dd9b1680ae | 255 | #define __HAL_DAC_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__)) |
bogdanm | 86:04dd9b1680ae | 256 | |
bogdanm | 86:04dd9b1680ae | 257 | /** @brief Clear the DAC's flag. |
bogdanm | 86:04dd9b1680ae | 258 | * @param __HANDLE__: specifies the DAC handle. |
Kojto | 99:dbbf35b96557 | 259 | * @param __FLAG__: specifies the flag to clear. |
Kojto | 99:dbbf35b96557 | 260 | * This parameter can be any combination of the following values: |
Kojto | 99:dbbf35b96557 | 261 | * @arg DAC_FLAG_DMAUDR1: DMA underrun 1 flag |
Kojto | 99:dbbf35b96557 | 262 | * @arg DAC_FLAG_DMAUDR2: DMA underrun 2 flag |
bogdanm | 86:04dd9b1680ae | 263 | * @retval None |
bogdanm | 86:04dd9b1680ae | 264 | */ |
bogdanm | 86:04dd9b1680ae | 265 | #define __HAL_DAC_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR) = (__FLAG__)) |
Kojto | 99:dbbf35b96557 | 266 | /** |
Kojto | 99:dbbf35b96557 | 267 | * @} |
Kojto | 99:dbbf35b96557 | 268 | */ |
bogdanm | 86:04dd9b1680ae | 269 | |
bogdanm | 86:04dd9b1680ae | 270 | /* Include DAC HAL Extension module */ |
bogdanm | 86:04dd9b1680ae | 271 | #include "stm32f4xx_hal_dac_ex.h" |
bogdanm | 86:04dd9b1680ae | 272 | |
bogdanm | 86:04dd9b1680ae | 273 | /* Exported functions --------------------------------------------------------*/ |
Kojto | 99:dbbf35b96557 | 274 | /** @addtogroup DAC_Exported_Functions |
Kojto | 99:dbbf35b96557 | 275 | * @{ |
Kojto | 99:dbbf35b96557 | 276 | */ |
Kojto | 99:dbbf35b96557 | 277 | |
Kojto | 99:dbbf35b96557 | 278 | /** @addtogroup DAC_Exported_Functions_Group1 |
Kojto | 99:dbbf35b96557 | 279 | * @{ |
Kojto | 99:dbbf35b96557 | 280 | */ |
bogdanm | 86:04dd9b1680ae | 281 | /* Initialization/de-initialization functions *********************************/ |
bogdanm | 86:04dd9b1680ae | 282 | HAL_StatusTypeDef HAL_DAC_Init(DAC_HandleTypeDef* hdac); |
bogdanm | 86:04dd9b1680ae | 283 | HAL_StatusTypeDef HAL_DAC_DeInit(DAC_HandleTypeDef* hdac); |
bogdanm | 86:04dd9b1680ae | 284 | void HAL_DAC_MspInit(DAC_HandleTypeDef* hdac); |
bogdanm | 86:04dd9b1680ae | 285 | void HAL_DAC_MspDeInit(DAC_HandleTypeDef* hdac); |
Kojto | 99:dbbf35b96557 | 286 | /** |
Kojto | 99:dbbf35b96557 | 287 | * @} |
Kojto | 99:dbbf35b96557 | 288 | */ |
bogdanm | 86:04dd9b1680ae | 289 | |
Kojto | 99:dbbf35b96557 | 290 | /** @addtogroup DAC_Exported_Functions_Group2 |
Kojto | 99:dbbf35b96557 | 291 | * @{ |
Kojto | 99:dbbf35b96557 | 292 | */ |
bogdanm | 86:04dd9b1680ae | 293 | /* I/O operation functions ****************************************************/ |
bogdanm | 86:04dd9b1680ae | 294 | HAL_StatusTypeDef HAL_DAC_Start(DAC_HandleTypeDef* hdac, uint32_t Channel); |
bogdanm | 86:04dd9b1680ae | 295 | HAL_StatusTypeDef HAL_DAC_Stop(DAC_HandleTypeDef* hdac, uint32_t Channel); |
bogdanm | 86:04dd9b1680ae | 296 | HAL_StatusTypeDef HAL_DAC_Start_DMA(DAC_HandleTypeDef* hdac, uint32_t Channel, uint32_t* pData, uint32_t Length, uint32_t Alignment); |
bogdanm | 86:04dd9b1680ae | 297 | HAL_StatusTypeDef HAL_DAC_Stop_DMA(DAC_HandleTypeDef* hdac, uint32_t Channel); |
bogdanm | 86:04dd9b1680ae | 298 | uint32_t HAL_DAC_GetValue(DAC_HandleTypeDef* hdac, uint32_t Channel); |
Kojto | 99:dbbf35b96557 | 299 | /** |
Kojto | 99:dbbf35b96557 | 300 | * @} |
Kojto | 99:dbbf35b96557 | 301 | */ |
bogdanm | 86:04dd9b1680ae | 302 | |
Kojto | 99:dbbf35b96557 | 303 | /** @addtogroup DAC_Exported_Functions_Group3 |
Kojto | 99:dbbf35b96557 | 304 | * @{ |
Kojto | 99:dbbf35b96557 | 305 | */ |
bogdanm | 86:04dd9b1680ae | 306 | /* Peripheral Control functions ***********************************************/ |
bogdanm | 86:04dd9b1680ae | 307 | HAL_StatusTypeDef HAL_DAC_ConfigChannel(DAC_HandleTypeDef* hdac, DAC_ChannelConfTypeDef* sConfig, uint32_t Channel); |
bogdanm | 86:04dd9b1680ae | 308 | HAL_StatusTypeDef HAL_DAC_SetValue(DAC_HandleTypeDef* hdac, uint32_t Channel, uint32_t Alignment, uint32_t Data); |
Kojto | 99:dbbf35b96557 | 309 | /** |
Kojto | 99:dbbf35b96557 | 310 | * @} |
Kojto | 99:dbbf35b96557 | 311 | */ |
bogdanm | 86:04dd9b1680ae | 312 | |
Kojto | 99:dbbf35b96557 | 313 | /** @addtogroup DAC_Exported_Functions_Group4 |
Kojto | 99:dbbf35b96557 | 314 | * @{ |
Kojto | 99:dbbf35b96557 | 315 | */ |
bogdanm | 86:04dd9b1680ae | 316 | /* Peripheral State functions *************************************************/ |
bogdanm | 86:04dd9b1680ae | 317 | HAL_DAC_StateTypeDef HAL_DAC_GetState(DAC_HandleTypeDef* hdac); |
bogdanm | 86:04dd9b1680ae | 318 | void HAL_DAC_IRQHandler(DAC_HandleTypeDef* hdac); |
bogdanm | 86:04dd9b1680ae | 319 | uint32_t HAL_DAC_GetError(DAC_HandleTypeDef *hdac); |
bogdanm | 86:04dd9b1680ae | 320 | |
bogdanm | 86:04dd9b1680ae | 321 | void HAL_DAC_ConvCpltCallbackCh1(DAC_HandleTypeDef* hdac); |
bogdanm | 86:04dd9b1680ae | 322 | void HAL_DAC_ConvHalfCpltCallbackCh1(DAC_HandleTypeDef* hdac); |
bogdanm | 86:04dd9b1680ae | 323 | void HAL_DAC_ErrorCallbackCh1(DAC_HandleTypeDef *hdac); |
bogdanm | 86:04dd9b1680ae | 324 | void HAL_DAC_DMAUnderrunCallbackCh1(DAC_HandleTypeDef *hdac); |
Kojto | 99:dbbf35b96557 | 325 | /** |
Kojto | 99:dbbf35b96557 | 326 | * @} |
Kojto | 99:dbbf35b96557 | 327 | */ |
bogdanm | 86:04dd9b1680ae | 328 | |
Kojto | 99:dbbf35b96557 | 329 | /** |
Kojto | 99:dbbf35b96557 | 330 | * @} |
Kojto | 99:dbbf35b96557 | 331 | */ |
Kojto | 99:dbbf35b96557 | 332 | /* Private types -------------------------------------------------------------*/ |
Kojto | 99:dbbf35b96557 | 333 | /* Private variables ---------------------------------------------------------*/ |
Kojto | 99:dbbf35b96557 | 334 | /* Private constants ---------------------------------------------------------*/ |
Kojto | 99:dbbf35b96557 | 335 | /** @defgroup DAC_Private_Constants DAC Private Constants |
Kojto | 99:dbbf35b96557 | 336 | * @{ |
Kojto | 99:dbbf35b96557 | 337 | */ |
Kojto | 99:dbbf35b96557 | 338 | |
Kojto | 99:dbbf35b96557 | 339 | /** |
Kojto | 99:dbbf35b96557 | 340 | * @} |
Kojto | 99:dbbf35b96557 | 341 | */ |
Kojto | 99:dbbf35b96557 | 342 | |
Kojto | 99:dbbf35b96557 | 343 | /* Private macros ------------------------------------------------------------*/ |
Kojto | 99:dbbf35b96557 | 344 | /** @defgroup DAC_Private_Macros DAC Private Macros |
Kojto | 99:dbbf35b96557 | 345 | * @{ |
Kojto | 99:dbbf35b96557 | 346 | */ |
Kojto | 99:dbbf35b96557 | 347 | #define IS_DAC_DATA(DATA) ((DATA) <= 0xFFF0) |
Kojto | 99:dbbf35b96557 | 348 | #define IS_DAC_ALIGN(ALIGN) (((ALIGN) == DAC_ALIGN_12B_R) || \ |
Kojto | 99:dbbf35b96557 | 349 | ((ALIGN) == DAC_ALIGN_12B_L) || \ |
Kojto | 99:dbbf35b96557 | 350 | ((ALIGN) == DAC_ALIGN_8B_R)) |
Kojto | 99:dbbf35b96557 | 351 | #define IS_DAC_CHANNEL(CHANNEL) (((CHANNEL) == DAC_CHANNEL_1) || \ |
Kojto | 99:dbbf35b96557 | 352 | ((CHANNEL) == DAC_CHANNEL_2)) |
Kojto | 99:dbbf35b96557 | 353 | #define IS_DAC_OUTPUT_BUFFER_STATE(STATE) (((STATE) == DAC_OUTPUTBUFFER_ENABLE) || \ |
Kojto | 99:dbbf35b96557 | 354 | ((STATE) == DAC_OUTPUTBUFFER_DISABLE)) |
Kojto | 99:dbbf35b96557 | 355 | |
Kojto | 99:dbbf35b96557 | 356 | #define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_TRIGGER_NONE) || \ |
Kojto | 99:dbbf35b96557 | 357 | ((TRIGGER) == DAC_TRIGGER_T2_TRGO) || \ |
Kojto | 99:dbbf35b96557 | 358 | ((TRIGGER) == DAC_TRIGGER_T8_TRGO) || \ |
Kojto | 99:dbbf35b96557 | 359 | ((TRIGGER) == DAC_TRIGGER_T7_TRGO) || \ |
Kojto | 99:dbbf35b96557 | 360 | ((TRIGGER) == DAC_TRIGGER_T5_TRGO) || \ |
Kojto | 99:dbbf35b96557 | 361 | ((TRIGGER) == DAC_TRIGGER_T6_TRGO) || \ |
Kojto | 99:dbbf35b96557 | 362 | ((TRIGGER) == DAC_TRIGGER_T4_TRGO) || \ |
Kojto | 99:dbbf35b96557 | 363 | ((TRIGGER) == DAC_TRIGGER_EXT_IT9) || \ |
Kojto | 99:dbbf35b96557 | 364 | ((TRIGGER) == DAC_TRIGGER_SOFTWARE)) |
Kojto | 99:dbbf35b96557 | 365 | |
Kojto | 99:dbbf35b96557 | 366 | /** @brief Set DHR12R1 alignment |
Kojto | 99:dbbf35b96557 | 367 | * @param __ALIGNMENT__: specifies the DAC alignment |
Kojto | 99:dbbf35b96557 | 368 | * @retval None |
Kojto | 99:dbbf35b96557 | 369 | */ |
Kojto | 99:dbbf35b96557 | 370 | #define DAC_DHR12R1_ALIGNMENT(__ALIGNMENT__) (((uint32_t)0x00000008) + (__ALIGNMENT__)) |
Kojto | 99:dbbf35b96557 | 371 | |
Kojto | 99:dbbf35b96557 | 372 | /** @brief Set DHR12R2 alignment |
Kojto | 99:dbbf35b96557 | 373 | * @param __ALIGNMENT__: specifies the DAC alignment |
Kojto | 99:dbbf35b96557 | 374 | * @retval None |
Kojto | 99:dbbf35b96557 | 375 | */ |
Kojto | 99:dbbf35b96557 | 376 | #define DAC_DHR12R2_ALIGNMENT(__ALIGNMENT__) (((uint32_t)0x00000014) + (__ALIGNMENT__)) |
Kojto | 99:dbbf35b96557 | 377 | |
Kojto | 99:dbbf35b96557 | 378 | /** @brief Set DHR12RD alignment |
Kojto | 99:dbbf35b96557 | 379 | * @param __ALIGNMENT__: specifies the DAC alignment |
Kojto | 99:dbbf35b96557 | 380 | * @retval None |
Kojto | 99:dbbf35b96557 | 381 | */ |
Kojto | 99:dbbf35b96557 | 382 | #define DAC_DHR12RD_ALIGNMENT(__ALIGNMENT__) (((uint32_t)0x00000020) + (__ALIGNMENT__)) |
Kojto | 99:dbbf35b96557 | 383 | |
Kojto | 99:dbbf35b96557 | 384 | /** |
Kojto | 99:dbbf35b96557 | 385 | * @} |
Kojto | 99:dbbf35b96557 | 386 | */ |
Kojto | 99:dbbf35b96557 | 387 | |
Kojto | 99:dbbf35b96557 | 388 | /* Private functions ---------------------------------------------------------*/ |
Kojto | 99:dbbf35b96557 | 389 | /** @defgroup DAC_Private_Functions DAC Private Functions |
Kojto | 99:dbbf35b96557 | 390 | * @{ |
Kojto | 99:dbbf35b96557 | 391 | */ |
Kojto | 99:dbbf35b96557 | 392 | /** |
Kojto | 99:dbbf35b96557 | 393 | * @} |
Kojto | 99:dbbf35b96557 | 394 | */ |
Kojto | 99:dbbf35b96557 | 395 | #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx ||\ |
Kojto | 99:dbbf35b96557 | 396 | STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||\ |
Kojto | 110:165afa46840b | 397 | STM32F410xx || STM32F446xx || STM32F469xx || STM32F479xx */ |
bogdanm | 86:04dd9b1680ae | 398 | |
bogdanm | 86:04dd9b1680ae | 399 | /** |
bogdanm | 86:04dd9b1680ae | 400 | * @} |
bogdanm | 86:04dd9b1680ae | 401 | */ |
bogdanm | 86:04dd9b1680ae | 402 | |
bogdanm | 86:04dd9b1680ae | 403 | /** |
bogdanm | 86:04dd9b1680ae | 404 | * @} |
bogdanm | 86:04dd9b1680ae | 405 | */ |
bogdanm | 86:04dd9b1680ae | 406 | |
bogdanm | 86:04dd9b1680ae | 407 | #ifdef __cplusplus |
bogdanm | 86:04dd9b1680ae | 408 | } |
bogdanm | 86:04dd9b1680ae | 409 | #endif |
bogdanm | 86:04dd9b1680ae | 410 | |
bogdanm | 86:04dd9b1680ae | 411 | #endif /*__STM32F4xx_HAL_DAC_H */ |
bogdanm | 86:04dd9b1680ae | 412 | |
bogdanm | 86:04dd9b1680ae | 413 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |