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 mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
100:cbbeb26dbd92
.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 100:cbbeb26dbd92 1 /**
Kojto 100:cbbeb26dbd92 2 ******************************************************************************
Kojto 100:cbbeb26dbd92 3 * @file stm32f3xx_hal_dac.h
Kojto 100:cbbeb26dbd92 4 * @author MCD Application Team
Kojto 100:cbbeb26dbd92 5 * @version V1.1.0
Kojto 100:cbbeb26dbd92 6 * @date 12-Sept-2014
Kojto 100:cbbeb26dbd92 7 * @brief Header file of DAC HAL module.
Kojto 100:cbbeb26dbd92 8 ******************************************************************************
Kojto 100:cbbeb26dbd92 9 * @attention
Kojto 100:cbbeb26dbd92 10 *
Kojto 100:cbbeb26dbd92 11 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
Kojto 100:cbbeb26dbd92 12 *
Kojto 100:cbbeb26dbd92 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 100:cbbeb26dbd92 14 * are permitted provided that the following conditions are met:
Kojto 100:cbbeb26dbd92 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 100:cbbeb26dbd92 16 * this list of conditions and the following disclaimer.
Kojto 100:cbbeb26dbd92 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 100:cbbeb26dbd92 18 * this list of conditions and the following disclaimer in the documentation
Kojto 100:cbbeb26dbd92 19 * and/or other materials provided with the distribution.
Kojto 100:cbbeb26dbd92 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 100:cbbeb26dbd92 21 * may be used to endorse or promote products derived from this software
Kojto 100:cbbeb26dbd92 22 * without specific prior written permission.
Kojto 100:cbbeb26dbd92 23 *
Kojto 100:cbbeb26dbd92 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 100:cbbeb26dbd92 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 100:cbbeb26dbd92 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 100:cbbeb26dbd92 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 100:cbbeb26dbd92 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 100:cbbeb26dbd92 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 100:cbbeb26dbd92 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 100:cbbeb26dbd92 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 100:cbbeb26dbd92 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 100:cbbeb26dbd92 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 100:cbbeb26dbd92 34 *
Kojto 100:cbbeb26dbd92 35 ******************************************************************************
Kojto 100:cbbeb26dbd92 36 */
Kojto 100:cbbeb26dbd92 37
Kojto 100:cbbeb26dbd92 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 100:cbbeb26dbd92 39 #ifndef __STM32F3xx_HAL_DAC_H
Kojto 100:cbbeb26dbd92 40 #define __STM32F3xx_HAL_DAC_H
Kojto 100:cbbeb26dbd92 41
Kojto 100:cbbeb26dbd92 42 #ifdef __cplusplus
Kojto 100:cbbeb26dbd92 43 extern "C" {
Kojto 100:cbbeb26dbd92 44 #endif
Kojto 100:cbbeb26dbd92 45
Kojto 100:cbbeb26dbd92 46 /* Includes ------------------------------------------------------------------*/
Kojto 100:cbbeb26dbd92 47 #include "stm32f3xx_hal_def.h"
Kojto 100:cbbeb26dbd92 48
Kojto 100:cbbeb26dbd92 49 /** @addtogroup STM32F3xx_HAL_Driver
Kojto 100:cbbeb26dbd92 50 * @{
Kojto 100:cbbeb26dbd92 51 */
Kojto 100:cbbeb26dbd92 52
Kojto 100:cbbeb26dbd92 53 /** @addtogroup DAC DAC HAL module driver
Kojto 100:cbbeb26dbd92 54 * @{
Kojto 100:cbbeb26dbd92 55 */
Kojto 100:cbbeb26dbd92 56
Kojto 100:cbbeb26dbd92 57 /* Exported types ------------------------------------------------------------*/
Kojto 100:cbbeb26dbd92 58 /** @defgroup DAC_Exported_Types DAC Exported Types
Kojto 100:cbbeb26dbd92 59 * @{
Kojto 100:cbbeb26dbd92 60 */
Kojto 100:cbbeb26dbd92 61
Kojto 100:cbbeb26dbd92 62 /**
Kojto 100:cbbeb26dbd92 63 * @brief HAL State structures definition
Kojto 100:cbbeb26dbd92 64 */
Kojto 100:cbbeb26dbd92 65 typedef enum
Kojto 100:cbbeb26dbd92 66 {
Kojto 100:cbbeb26dbd92 67 HAL_DAC_STATE_RESET = 0x00, /*!< DAC not yet initialized or disabled */
Kojto 100:cbbeb26dbd92 68 HAL_DAC_STATE_READY = 0x01, /*!< DAC initialized and ready for use */
Kojto 100:cbbeb26dbd92 69 HAL_DAC_STATE_BUSY = 0x02, /*!< DAC internal processing is ongoing */
Kojto 100:cbbeb26dbd92 70 HAL_DAC_STATE_TIMEOUT = 0x03, /*!< DAC timeout state */
Kojto 100:cbbeb26dbd92 71 HAL_DAC_STATE_ERROR = 0x04 /*!< DAC error state */
Kojto 100:cbbeb26dbd92 72
Kojto 100:cbbeb26dbd92 73 }HAL_DAC_StateTypeDef;
Kojto 100:cbbeb26dbd92 74
Kojto 100:cbbeb26dbd92 75
Kojto 100:cbbeb26dbd92 76 /**
Kojto 100:cbbeb26dbd92 77 * @brief DAC Configuration regular Channel structure definition
Kojto 100:cbbeb26dbd92 78 */
Kojto 100:cbbeb26dbd92 79 typedef struct
Kojto 100:cbbeb26dbd92 80 {
Kojto 100:cbbeb26dbd92 81 uint32_t DAC_Trigger; /*!< Specifies the external trigger for the selected DAC channel.
Kojto 100:cbbeb26dbd92 82 This parameter can be a value of @ref DACEx_trigger_selection */
Kojto 100:cbbeb26dbd92 83
Kojto 100:cbbeb26dbd92 84 uint32_t DAC_OutputBuffer; /*!< Specifies whether the DAC channel output buffer is enabled or disabled.
Kojto 100:cbbeb26dbd92 85 This parameter can be a value of @ref DAC_output_buffer */
Kojto 100:cbbeb26dbd92 86
Kojto 100:cbbeb26dbd92 87 }DAC_ChannelConfTypeDef;
Kojto 100:cbbeb26dbd92 88
Kojto 100:cbbeb26dbd92 89 /**
Kojto 100:cbbeb26dbd92 90 * @brief DAC handle Structure definition
Kojto 100:cbbeb26dbd92 91 */
Kojto 100:cbbeb26dbd92 92 typedef struct __DAC_HandleTypeDef
Kojto 100:cbbeb26dbd92 93 {
Kojto 100:cbbeb26dbd92 94 DAC_TypeDef *Instance; /*!< Register base address */
Kojto 100:cbbeb26dbd92 95
Kojto 100:cbbeb26dbd92 96 __IO HAL_DAC_StateTypeDef State; /*!< DAC communication state */
Kojto 100:cbbeb26dbd92 97
Kojto 100:cbbeb26dbd92 98 HAL_LockTypeDef Lock; /*!< DAC locking object */
Kojto 100:cbbeb26dbd92 99
Kojto 100:cbbeb26dbd92 100 DMA_HandleTypeDef *DMA_Handle1; /*!< Pointer DMA handler for channel 1 */
Kojto 100:cbbeb26dbd92 101
Kojto 100:cbbeb26dbd92 102 DMA_HandleTypeDef *DMA_Handle2; /*!< Pointer DMA handler for channel 2 */
Kojto 100:cbbeb26dbd92 103
Kojto 100:cbbeb26dbd92 104 __IO uint32_t ErrorCode; /*!< DAC Error code */
Kojto 100:cbbeb26dbd92 105
Kojto 100:cbbeb26dbd92 106 }DAC_HandleTypeDef;
Kojto 100:cbbeb26dbd92 107 /**
Kojto 100:cbbeb26dbd92 108 * @}
Kojto 100:cbbeb26dbd92 109 */
Kojto 100:cbbeb26dbd92 110
Kojto 100:cbbeb26dbd92 111 /* Exported constants --------------------------------------------------------*/
Kojto 100:cbbeb26dbd92 112 /** @defgroup DAC_Exported_Constants DAC Exported Contants
Kojto 100:cbbeb26dbd92 113 * @{
Kojto 100:cbbeb26dbd92 114 */
Kojto 100:cbbeb26dbd92 115
Kojto 100:cbbeb26dbd92 116 /** @defgroup DAC_Error_Code DAC Error Code
Kojto 100:cbbeb26dbd92 117 * @{
Kojto 100:cbbeb26dbd92 118 */
Kojto 100:cbbeb26dbd92 119 #define HAL_DAC_ERROR_NONE 0x00 /*!< No error */
Kojto 100:cbbeb26dbd92 120 #define HAL_DAC_ERROR_DMAUNDERRUNCH1 0x01 /*!< DAC channel1 DMA underrun error */
Kojto 100:cbbeb26dbd92 121 #define HAL_DAC_ERROR_DMAUNDERRUNCH2 0x02 /*!< DAC channel2 DMA underrun error */
Kojto 100:cbbeb26dbd92 122 #define HAL_DAC_ERROR_DMA 0x04 /*!< DMA error */
Kojto 100:cbbeb26dbd92 123 /**
Kojto 100:cbbeb26dbd92 124 * @}
Kojto 100:cbbeb26dbd92 125 */
Kojto 100:cbbeb26dbd92 126
Kojto 100:cbbeb26dbd92 127 /** @defgroup DAC_wave_generation DAC wave generation
Kojto 100:cbbeb26dbd92 128 * @{
Kojto 100:cbbeb26dbd92 129 */
Kojto 100:cbbeb26dbd92 130 #define DAC_WAVEGENERATION_NONE ((uint32_t)0x00000000)
Kojto 100:cbbeb26dbd92 131 #define DAC_WAVEGENERATION_NOISE ((uint32_t)DAC_CR_WAVE1_0)
Kojto 100:cbbeb26dbd92 132 #define DAC_WAVEGENERATION_TRIANGLE ((uint32_t)DAC_CR_WAVE1_1)
Kojto 100:cbbeb26dbd92 133
Kojto 100:cbbeb26dbd92 134 #define IS_DAC_GENERATE_WAVE(WAVE) (((WAVE) == DAC_WAVEGENERATION_NONE) || \
Kojto 100:cbbeb26dbd92 135 ((WAVE) == DAC_WAVEGENERATION_NOISE) || \
Kojto 100:cbbeb26dbd92 136 ((WAVE) == DAC_WAVEGENERATION_TRIANGLE))
Kojto 100:cbbeb26dbd92 137 /**
Kojto 100:cbbeb26dbd92 138 * @}
Kojto 100:cbbeb26dbd92 139 */
Kojto 100:cbbeb26dbd92 140
Kojto 100:cbbeb26dbd92 141 /** @defgroup DAC_lfsrunmask_triangleamplitude DAC lfsrunmask triangleamplitude
Kojto 100:cbbeb26dbd92 142 * @{
Kojto 100:cbbeb26dbd92 143 */
Kojto 100:cbbeb26dbd92 144 #define DAC_LFSRUNMASK_BIT0 ((uint32_t)0x00000000) /*!< Unmask DAC channel LFSR bit0 for noise wave generation */
Kojto 100:cbbeb26dbd92 145 #define DAC_LFSRUNMASK_BITS1_0 ((uint32_t)DAC_CR_MAMP1_0) /*!< Unmask DAC channel LFSR bit[1:0] for noise wave generation */
Kojto 100:cbbeb26dbd92 146 #define DAC_LFSRUNMASK_BITS2_0 ((uint32_t)DAC_CR_MAMP1_1) /*!< Unmask DAC channel LFSR bit[2:0] for noise wave generation */
Kojto 100:cbbeb26dbd92 147 #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 */
Kojto 100:cbbeb26dbd92 148 #define DAC_LFSRUNMASK_BITS4_0 ((uint32_t)DAC_CR_MAMP1_2) /*!< Unmask DAC channel LFSR bit[4:0] for noise wave generation */
Kojto 100:cbbeb26dbd92 149 #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 */
Kojto 100:cbbeb26dbd92 150 #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 */
Kojto 100:cbbeb26dbd92 151 #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 */
Kojto 100:cbbeb26dbd92 152 #define DAC_LFSRUNMASK_BITS8_0 ((uint32_t)DAC_CR_MAMP1_3) /*!< Unmask DAC channel LFSR bit[8:0] for noise wave generation */
Kojto 100:cbbeb26dbd92 153 #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 */
Kojto 100:cbbeb26dbd92 154 #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 */
Kojto 100:cbbeb26dbd92 155 #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 */
Kojto 100:cbbeb26dbd92 156 #define DAC_TRIANGLEAMPLITUDE_1 ((uint32_t)0x00000000) /*!< Select max triangle amplitude of 1 */
Kojto 100:cbbeb26dbd92 157 #define DAC_TRIANGLEAMPLITUDE_3 ((uint32_t)DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 3 */
Kojto 100:cbbeb26dbd92 158 #define DAC_TRIANGLEAMPLITUDE_7 ((uint32_t)DAC_CR_MAMP1_1) /*!< Select max triangle amplitude of 7 */
Kojto 100:cbbeb26dbd92 159 #define DAC_TRIANGLEAMPLITUDE_15 ((uint32_t)DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 15 */
Kojto 100:cbbeb26dbd92 160 #define DAC_TRIANGLEAMPLITUDE_31 ((uint32_t)DAC_CR_MAMP1_2) /*!< Select max triangle amplitude of 31 */
Kojto 100:cbbeb26dbd92 161 #define DAC_TRIANGLEAMPLITUDE_63 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 63 */
Kojto 100:cbbeb26dbd92 162 #define DAC_TRIANGLEAMPLITUDE_127 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1) /*!< Select max triangle amplitude of 127 */
Kojto 100:cbbeb26dbd92 163 #define DAC_TRIANGLEAMPLITUDE_255 ((uint32_t)DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 255 */
Kojto 100:cbbeb26dbd92 164 #define DAC_TRIANGLEAMPLITUDE_511 ((uint32_t)DAC_CR_MAMP1_3) /*!< Select max triangle amplitude of 511 */
Kojto 100:cbbeb26dbd92 165 #define DAC_TRIANGLEAMPLITUDE_1023 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 1023 */
Kojto 100:cbbeb26dbd92 166 #define DAC_TRIANGLEAMPLITUDE_2047 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1) /*!< Select max triangle amplitude of 2047 */
Kojto 100:cbbeb26dbd92 167 #define DAC_TRIANGLEAMPLITUDE_4095 ((uint32_t)DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Select max triangle amplitude of 4095 */
Kojto 100:cbbeb26dbd92 168
Kojto 100:cbbeb26dbd92 169 #define IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(VALUE) (((VALUE) == DAC_LFSRUNMASK_BIT0) || \
Kojto 100:cbbeb26dbd92 170 ((VALUE) == DAC_LFSRUNMASK_BITS1_0) || \
Kojto 100:cbbeb26dbd92 171 ((VALUE) == DAC_LFSRUNMASK_BITS2_0) || \
Kojto 100:cbbeb26dbd92 172 ((VALUE) == DAC_LFSRUNMASK_BITS3_0) || \
Kojto 100:cbbeb26dbd92 173 ((VALUE) == DAC_LFSRUNMASK_BITS4_0) || \
Kojto 100:cbbeb26dbd92 174 ((VALUE) == DAC_LFSRUNMASK_BITS5_0) || \
Kojto 100:cbbeb26dbd92 175 ((VALUE) == DAC_LFSRUNMASK_BITS6_0) || \
Kojto 100:cbbeb26dbd92 176 ((VALUE) == DAC_LFSRUNMASK_BITS7_0) || \
Kojto 100:cbbeb26dbd92 177 ((VALUE) == DAC_LFSRUNMASK_BITS8_0) || \
Kojto 100:cbbeb26dbd92 178 ((VALUE) == DAC_LFSRUNMASK_BITS9_0) || \
Kojto 100:cbbeb26dbd92 179 ((VALUE) == DAC_LFSRUNMASK_BITS10_0) || \
Kojto 100:cbbeb26dbd92 180 ((VALUE) == DAC_LFSRUNMASK_BITS11_0) || \
Kojto 100:cbbeb26dbd92 181 ((VALUE) == DAC_TRIANGLEAMPLITUDE_1) || \
Kojto 100:cbbeb26dbd92 182 ((VALUE) == DAC_TRIANGLEAMPLITUDE_3) || \
Kojto 100:cbbeb26dbd92 183 ((VALUE) == DAC_TRIANGLEAMPLITUDE_7) || \
Kojto 100:cbbeb26dbd92 184 ((VALUE) == DAC_TRIANGLEAMPLITUDE_15) || \
Kojto 100:cbbeb26dbd92 185 ((VALUE) == DAC_TRIANGLEAMPLITUDE_31) || \
Kojto 100:cbbeb26dbd92 186 ((VALUE) == DAC_TRIANGLEAMPLITUDE_63) || \
Kojto 100:cbbeb26dbd92 187 ((VALUE) == DAC_TRIANGLEAMPLITUDE_127) || \
Kojto 100:cbbeb26dbd92 188 ((VALUE) == DAC_TRIANGLEAMPLITUDE_255) || \
Kojto 100:cbbeb26dbd92 189 ((VALUE) == DAC_TRIANGLEAMPLITUDE_511) || \
Kojto 100:cbbeb26dbd92 190 ((VALUE) == DAC_TRIANGLEAMPLITUDE_1023) || \
Kojto 100:cbbeb26dbd92 191 ((VALUE) == DAC_TRIANGLEAMPLITUDE_2047) || \
Kojto 100:cbbeb26dbd92 192 ((VALUE) == DAC_TRIANGLEAMPLITUDE_4095))
Kojto 100:cbbeb26dbd92 193 /**
Kojto 100:cbbeb26dbd92 194 * @}
Kojto 100:cbbeb26dbd92 195 */
Kojto 100:cbbeb26dbd92 196
Kojto 100:cbbeb26dbd92 197 /** @defgroup DAC_output_buffer DAC output buffer
Kojto 100:cbbeb26dbd92 198 * @{
Kojto 100:cbbeb26dbd92 199 */
Kojto 100:cbbeb26dbd92 200 #define DAC_OUTPUTBUFFER_ENABLE ((uint32_t)0x00000000)
Kojto 100:cbbeb26dbd92 201 #define DAC_OUTPUTBUFFER_DISABLE ((uint32_t)DAC_CR_BOFF1)
Kojto 100:cbbeb26dbd92 202
Kojto 100:cbbeb26dbd92 203 #define IS_DAC_OUTPUT_BUFFER_STATE(STATE) (((STATE) == DAC_OUTPUTBUFFER_ENABLE) || \
Kojto 100:cbbeb26dbd92 204 ((STATE) == DAC_OUTPUTBUFFER_DISABLE))
Kojto 100:cbbeb26dbd92 205 /**
Kojto 100:cbbeb26dbd92 206 * @}
Kojto 100:cbbeb26dbd92 207 */
Kojto 100:cbbeb26dbd92 208
Kojto 100:cbbeb26dbd92 209 /** @defgroup DAC_data_alignement DAC data alignement
Kojto 100:cbbeb26dbd92 210 * @{
Kojto 100:cbbeb26dbd92 211 */
Kojto 100:cbbeb26dbd92 212 #define DAC_ALIGN_12B_R ((uint32_t)0x00000000)
Kojto 100:cbbeb26dbd92 213 #define DAC_ALIGN_12B_L ((uint32_t)0x00000004)
Kojto 100:cbbeb26dbd92 214 #define DAC_ALIGN_8B_R ((uint32_t)0x00000008)
Kojto 100:cbbeb26dbd92 215
Kojto 100:cbbeb26dbd92 216 #define IS_DAC_ALIGN(ALIGN) (((ALIGN) == DAC_ALIGN_12B_R) || \
Kojto 100:cbbeb26dbd92 217 ((ALIGN) == DAC_ALIGN_12B_L) || \
Kojto 100:cbbeb26dbd92 218 ((ALIGN) == DAC_ALIGN_8B_R))
Kojto 100:cbbeb26dbd92 219 /**
Kojto 100:cbbeb26dbd92 220 * @}
Kojto 100:cbbeb26dbd92 221 */
Kojto 100:cbbeb26dbd92 222
Kojto 100:cbbeb26dbd92 223 /** @defgroup DAC_wave_generation DAC wave generation
Kojto 100:cbbeb26dbd92 224 * @{
Kojto 100:cbbeb26dbd92 225 */
Kojto 100:cbbeb26dbd92 226 #define DAC_WAVE_NOISE ((uint32_t)DAC_CR_WAVE1_0)
Kojto 100:cbbeb26dbd92 227 #define DAC_WAVE_TRIANGLE ((uint32_t)DAC_CR_WAVE1_1)
Kojto 100:cbbeb26dbd92 228
Kojto 100:cbbeb26dbd92 229 #define IS_DAC_WAVE(WAVE) (((WAVE) == DAC_WAVE_NOISE) || \
Kojto 100:cbbeb26dbd92 230 ((WAVE) == DAC_WAVE_TRIANGLE))
Kojto 100:cbbeb26dbd92 231 /**
Kojto 100:cbbeb26dbd92 232 * @}
Kojto 100:cbbeb26dbd92 233 */
Kojto 100:cbbeb26dbd92 234
Kojto 100:cbbeb26dbd92 235 /** @defgroup DAC_data DAC data
Kojto 100:cbbeb26dbd92 236 * @{
Kojto 100:cbbeb26dbd92 237 */
Kojto 100:cbbeb26dbd92 238 #define IS_DAC_DATA(DATA) ((DATA) <= 0xFFF0)
Kojto 100:cbbeb26dbd92 239 /**
Kojto 100:cbbeb26dbd92 240 * @}
Kojto 100:cbbeb26dbd92 241 */
Kojto 100:cbbeb26dbd92 242
Kojto 100:cbbeb26dbd92 243 /** @defgroup DAC_flags_definition DAC flags definition
Kojto 100:cbbeb26dbd92 244 * @{
Kojto 100:cbbeb26dbd92 245 */
Kojto 100:cbbeb26dbd92 246 #define DAC_FLAG_DMAUDR1 ((uint32_t)DAC_SR_DMAUDR1)
Kojto 100:cbbeb26dbd92 247 #define DAC_FLAG_DMAUDR2 ((uint32_t)DAC_SR_DMAUDR2)
Kojto 100:cbbeb26dbd92 248
Kojto 100:cbbeb26dbd92 249 #define IS_DAC_FLAG(FLAG) (((FLAG) == DAC_FLAG_DMAUDR1) || \
Kojto 100:cbbeb26dbd92 250 ((FLAG) == DAC_FLAG_DMAUDR2))
Kojto 100:cbbeb26dbd92 251 /**
Kojto 100:cbbeb26dbd92 252 * @}
Kojto 100:cbbeb26dbd92 253 */
Kojto 100:cbbeb26dbd92 254
Kojto 100:cbbeb26dbd92 255 /** @defgroup DAC_interrupts_definition DAC interrupts definition
Kojto 100:cbbeb26dbd92 256 * @{
Kojto 100:cbbeb26dbd92 257 */
Kojto 100:cbbeb26dbd92 258 #define DAC_IT_DMAUDR1 ((uint32_t)DAC_CR_DMAUDRIE1)
Kojto 100:cbbeb26dbd92 259 #define DAC_IT_DMAUDR2 ((uint32_t)DAC_CR_DMAUDRIE2)
Kojto 100:cbbeb26dbd92 260
Kojto 100:cbbeb26dbd92 261
Kojto 100:cbbeb26dbd92 262 #define IS_DAC_IT(IT) (((IT) == DAC_IT_DMAUDR1) || \
Kojto 100:cbbeb26dbd92 263 ((IT) == DAC_IT_DMAUDR2))
Kojto 100:cbbeb26dbd92 264
Kojto 100:cbbeb26dbd92 265 /**
Kojto 100:cbbeb26dbd92 266 * @}
Kojto 100:cbbeb26dbd92 267 */
Kojto 100:cbbeb26dbd92 268
Kojto 100:cbbeb26dbd92 269 /**
Kojto 100:cbbeb26dbd92 270 * @}
Kojto 100:cbbeb26dbd92 271 */
Kojto 100:cbbeb26dbd92 272
Kojto 100:cbbeb26dbd92 273 /* Exported macros -----------------------------------------------------------*/
Kojto 100:cbbeb26dbd92 274 /** @defgroup DAC_Exported_Macros DAC Exported Macros
Kojto 100:cbbeb26dbd92 275 * @{
Kojto 100:cbbeb26dbd92 276 */
Kojto 100:cbbeb26dbd92 277
Kojto 100:cbbeb26dbd92 278 /** @brief Reset DAC handle state
Kojto 100:cbbeb26dbd92 279 * @param __HANDLE__: DAC handle.
Kojto 100:cbbeb26dbd92 280 * @retval None
Kojto 100:cbbeb26dbd92 281 */
Kojto 100:cbbeb26dbd92 282 #define __HAL_DAC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_DAC_STATE_RESET)
Kojto 100:cbbeb26dbd92 283
Kojto 100:cbbeb26dbd92 284 /* Enable the DAC peripheral */
Kojto 100:cbbeb26dbd92 285 #define __HAL_DAC_ENABLE(__HANDLE__, __DAC_Channel__) \
Kojto 100:cbbeb26dbd92 286 ((__HANDLE__)->Instance->CR |= (DAC_CR_EN1 << (__DAC_Channel__)))
Kojto 100:cbbeb26dbd92 287
Kojto 100:cbbeb26dbd92 288 /* Disable the DAC peripheral */
Kojto 100:cbbeb26dbd92 289 #define __HAL_DAC_DISABLE(__HANDLE__, __DAC_Channel__) \
Kojto 100:cbbeb26dbd92 290 ((__HANDLE__)->Instance->CR &= ~(DAC_CR_EN1 << (__DAC_Channel__)))
Kojto 100:cbbeb26dbd92 291
Kojto 100:cbbeb26dbd92 292 /* Set DHR12R1 alignment */
Kojto 100:cbbeb26dbd92 293 #define __HAL_DHR12R1_ALIGNEMENT(__ALIGNEMENT__) (((uint32_t)0x00000008) + (__ALIGNEMENT__))
Kojto 100:cbbeb26dbd92 294
Kojto 100:cbbeb26dbd92 295 /* Set DHR12R2 alignment */
Kojto 100:cbbeb26dbd92 296 #define __HAL_DHR12R2_ALIGNEMENT(__ALIGNEMENT__) (((uint32_t)0x00000014) + (__ALIGNEMENT__))
Kojto 100:cbbeb26dbd92 297
Kojto 100:cbbeb26dbd92 298 /* Set DHR12RD alignment */
Kojto 100:cbbeb26dbd92 299 #define __HAL_DHR12RD_ALIGNEMENT(__ALIGNEMENT__) (((uint32_t)0x00000020) + (__ALIGNEMENT__))
Kojto 100:cbbeb26dbd92 300
Kojto 100:cbbeb26dbd92 301 /* Enable the DAC interrupt */
Kojto 100:cbbeb26dbd92 302 #define __HAL_DAC_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR) |= (__INTERRUPT__))
Kojto 100:cbbeb26dbd92 303
Kojto 100:cbbeb26dbd92 304 /* Disable the DAC interrupt */
Kojto 100:cbbeb26dbd92 305 #define __HAL_DAC_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->CR) &= ~(__INTERRUPT__))
Kojto 100:cbbeb26dbd92 306
Kojto 100:cbbeb26dbd92 307 /* Get the selected DAC's flag status */
Kojto 100:cbbeb26dbd92 308 #define __HAL_DAC_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__))
Kojto 100:cbbeb26dbd92 309
Kojto 100:cbbeb26dbd92 310 /* Clear the DAC's flag */
Kojto 100:cbbeb26dbd92 311 #define __HAL_DAC_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR) = (__FLAG__))
Kojto 100:cbbeb26dbd92 312
Kojto 100:cbbeb26dbd92 313 /**
Kojto 100:cbbeb26dbd92 314 * @}
Kojto 100:cbbeb26dbd92 315 */
Kojto 100:cbbeb26dbd92 316
Kojto 100:cbbeb26dbd92 317 /* Include DAC HAL Extended module */
Kojto 100:cbbeb26dbd92 318 #include "stm32f3xx_hal_dac_ex.h"
Kojto 100:cbbeb26dbd92 319
Kojto 100:cbbeb26dbd92 320 /* Exported functions --------------------------------------------------------*/
Kojto 100:cbbeb26dbd92 321 /** @addtogroup DAC_Exported_Functions DAC Exported Functions
Kojto 100:cbbeb26dbd92 322 * @{
Kojto 100:cbbeb26dbd92 323 */
Kojto 100:cbbeb26dbd92 324
Kojto 100:cbbeb26dbd92 325 /** @addtogroup DAC_Exported_Functions_Group1 Initialization and de-initialization functions
Kojto 100:cbbeb26dbd92 326 * @{
Kojto 100:cbbeb26dbd92 327 */
Kojto 100:cbbeb26dbd92 328 /* Initialization and de-initialization functions *****************************/
Kojto 100:cbbeb26dbd92 329 HAL_StatusTypeDef HAL_DAC_Init(DAC_HandleTypeDef* hdac);
Kojto 100:cbbeb26dbd92 330 HAL_StatusTypeDef HAL_DAC_DeInit(DAC_HandleTypeDef* hdac);
Kojto 100:cbbeb26dbd92 331 void HAL_DAC_MspInit(DAC_HandleTypeDef* hdac);
Kojto 100:cbbeb26dbd92 332 void HAL_DAC_MspDeInit(DAC_HandleTypeDef* hdac);
Kojto 100:cbbeb26dbd92 333
Kojto 100:cbbeb26dbd92 334 /**
Kojto 100:cbbeb26dbd92 335 * @}
Kojto 100:cbbeb26dbd92 336 */
Kojto 100:cbbeb26dbd92 337
Kojto 100:cbbeb26dbd92 338 /** @addtogroup DAC_Exported_Functions_Group2 Input and Output operation functions
Kojto 100:cbbeb26dbd92 339 * @{
Kojto 100:cbbeb26dbd92 340 */
Kojto 100:cbbeb26dbd92 341 /* IO operation functions *****************************************************/
Kojto 100:cbbeb26dbd92 342 HAL_StatusTypeDef HAL_DAC_Start(DAC_HandleTypeDef* hdac, uint32_t channel);
Kojto 100:cbbeb26dbd92 343 HAL_StatusTypeDef HAL_DAC_Stop(DAC_HandleTypeDef* hdac, uint32_t channel);
Kojto 100:cbbeb26dbd92 344 HAL_StatusTypeDef HAL_DAC_Start_DMA(DAC_HandleTypeDef* hdac, uint32_t channel, uint32_t* pData, uint32_t Length, uint32_t alignment);
Kojto 100:cbbeb26dbd92 345 HAL_StatusTypeDef HAL_DAC_Stop_DMA(DAC_HandleTypeDef* hdac, uint32_t channel);
Kojto 100:cbbeb26dbd92 346 uint32_t HAL_DAC_GetValue(DAC_HandleTypeDef* hdac, uint32_t channel);
Kojto 100:cbbeb26dbd92 347 void HAL_DAC_IRQHandler(DAC_HandleTypeDef* hdac);
Kojto 100:cbbeb26dbd92 348 void HAL_DAC_ConvCpltCallbackCh1(DAC_HandleTypeDef* hdac);
Kojto 100:cbbeb26dbd92 349 void HAL_DAC_ConvHalfCpltCallbackCh1(DAC_HandleTypeDef* hdac);
Kojto 100:cbbeb26dbd92 350 void HAL_DAC_ErrorCallbackCh1(DAC_HandleTypeDef *hdac);
Kojto 100:cbbeb26dbd92 351 void HAL_DAC_DMAUnderrunCallbackCh1(DAC_HandleTypeDef *hdac);
Kojto 100:cbbeb26dbd92 352
Kojto 100:cbbeb26dbd92 353 /**
Kojto 100:cbbeb26dbd92 354 * @}
Kojto 100:cbbeb26dbd92 355 */
Kojto 100:cbbeb26dbd92 356
Kojto 100:cbbeb26dbd92 357 /** @addtogroup DAC_Exported_Functions_Group3 Peripheral Control functions
Kojto 100:cbbeb26dbd92 358 * @{
Kojto 100:cbbeb26dbd92 359 */
Kojto 100:cbbeb26dbd92 360 /* Peripheral Control functions ***********************************************/
Kojto 100:cbbeb26dbd92 361 HAL_StatusTypeDef HAL_DAC_ConfigChannel(DAC_HandleTypeDef* hdac, DAC_ChannelConfTypeDef* sConfig, uint32_t channel);
Kojto 100:cbbeb26dbd92 362 HAL_StatusTypeDef HAL_DAC_SetValue(DAC_HandleTypeDef* hdac, uint32_t channel, uint32_t alignment, uint32_t data);
Kojto 100:cbbeb26dbd92 363
Kojto 100:cbbeb26dbd92 364 /**
Kojto 100:cbbeb26dbd92 365 * @}
Kojto 100:cbbeb26dbd92 366 */
Kojto 100:cbbeb26dbd92 367
Kojto 100:cbbeb26dbd92 368 /** @addtogroup DAC_Exported_Functions_Group4 Peripheral State and Error functions
Kojto 100:cbbeb26dbd92 369 * @{
Kojto 100:cbbeb26dbd92 370 */
Kojto 100:cbbeb26dbd92 371 /* Peripheral State and Error functions ***************************************/
Kojto 100:cbbeb26dbd92 372 HAL_DAC_StateTypeDef HAL_DAC_GetState(DAC_HandleTypeDef* hdac);
Kojto 100:cbbeb26dbd92 373 uint32_t HAL_DAC_GetError(DAC_HandleTypeDef *hdac);
Kojto 100:cbbeb26dbd92 374
Kojto 100:cbbeb26dbd92 375 /**
Kojto 100:cbbeb26dbd92 376 * @}
Kojto 100:cbbeb26dbd92 377 */
Kojto 100:cbbeb26dbd92 378
Kojto 100:cbbeb26dbd92 379 /**
Kojto 100:cbbeb26dbd92 380 * @}
Kojto 100:cbbeb26dbd92 381 */
Kojto 100:cbbeb26dbd92 382
Kojto 100:cbbeb26dbd92 383 /**
Kojto 100:cbbeb26dbd92 384 * @}
Kojto 100:cbbeb26dbd92 385 */
Kojto 100:cbbeb26dbd92 386
Kojto 100:cbbeb26dbd92 387 /**
Kojto 100:cbbeb26dbd92 388 * @}
Kojto 100:cbbeb26dbd92 389 */
Kojto 100:cbbeb26dbd92 390
Kojto 100:cbbeb26dbd92 391 #ifdef __cplusplus
Kojto 100:cbbeb26dbd92 392 }
Kojto 100:cbbeb26dbd92 393 #endif
Kojto 100:cbbeb26dbd92 394
Kojto 100:cbbeb26dbd92 395 #endif /*__STM32F3xx_HAL_DAC_H */
Kojto 100:cbbeb26dbd92 396
Kojto 100:cbbeb26dbd92 397 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/