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