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