The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
Kojto
Date:
Thu Jul 07 14:34:11 2016 +0100
Revision:
122:f9eeca106725
Release 122 of the mbed library

Changes:
- new targets - Nucleo L432KC, Beetle, Nucleo F446ZE, Nucleo L011K4
- Thread safety addition - mbed API should contain a statement about thread safety
- critical section API addition
- CAS API (core_util_atomic_incr/decr)
- DEVICE_ are generated from targets.json file, device.h deprecated
- Callback replaces FunctionPointer to provide std like interface
- mbed HAL API docs improvements
- toolchain - prexif attributes with MBED_
- add new attributes - packed, weak, forcedinline, align
- target.json - contains targets definitions
- ST - L1XX - Cube update to 1.5
- SPI clock selection fix (clock from APB domain)
- F7 - Cube update v1.4.0
- L0 - baudrate init fix
- L1 - Cube update v1.5
- F3 - baudrate init fix, 3 targets CAN support
- F4 - Cube update v1.12.0, 3 targets CAN support
- L4XX - Cube update v1.5.1
- F0 - update Cube to v1.5.0
- L4 - 2 targets (L476RG/VG) CAN support
- NXP - pwm clock fix for KSDK2 MCU
- LPC2368 - remove ARM toolchain support - due to regression
- KSDK2 - fix SPI , I2C address and repeat start
- Silabs - some fixes backported from mbed 3
- Renesas - RZ_A1H - SystemCoreClockUpdate addition

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 122:f9eeca106725 1 /**
Kojto 122:f9eeca106725 2 ******************************************************************************
Kojto 122:f9eeca106725 3 * @file stm32l4xx_ll_dac.h
Kojto 122:f9eeca106725 4 * @author MCD Application Team
Kojto 122:f9eeca106725 5 * @version V1.5.1
Kojto 122:f9eeca106725 6 * @date 31-May-2016
Kojto 122:f9eeca106725 7 * @brief Header file of DAC LL module.
Kojto 122:f9eeca106725 8 ******************************************************************************
Kojto 122:f9eeca106725 9 * @attention
Kojto 122:f9eeca106725 10 *
Kojto 122:f9eeca106725 11 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
Kojto 122:f9eeca106725 12 *
Kojto 122:f9eeca106725 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 122:f9eeca106725 14 * are permitted provided that the following conditions are met:
Kojto 122:f9eeca106725 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 122:f9eeca106725 16 * this list of conditions and the following disclaimer.
Kojto 122:f9eeca106725 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 122:f9eeca106725 18 * this list of conditions and the following disclaimer in the documentation
Kojto 122:f9eeca106725 19 * and/or other materials provided with the distribution.
Kojto 122:f9eeca106725 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 122:f9eeca106725 21 * may be used to endorse or promote products derived from this software
Kojto 122:f9eeca106725 22 * without specific prior written permission.
Kojto 122:f9eeca106725 23 *
Kojto 122:f9eeca106725 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 122:f9eeca106725 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 122:f9eeca106725 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 122:f9eeca106725 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 122:f9eeca106725 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 122:f9eeca106725 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 122:f9eeca106725 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 122:f9eeca106725 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 122:f9eeca106725 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 122:f9eeca106725 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 122:f9eeca106725 34 *
Kojto 122:f9eeca106725 35 ******************************************************************************
Kojto 122:f9eeca106725 36 */
Kojto 122:f9eeca106725 37
Kojto 122:f9eeca106725 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 122:f9eeca106725 39 #ifndef __STM32L4xx_LL_DAC_H
Kojto 122:f9eeca106725 40 #define __STM32L4xx_LL_DAC_H
Kojto 122:f9eeca106725 41
Kojto 122:f9eeca106725 42 #ifdef __cplusplus
Kojto 122:f9eeca106725 43 extern "C" {
Kojto 122:f9eeca106725 44 #endif
Kojto 122:f9eeca106725 45
Kojto 122:f9eeca106725 46 /* Includes ------------------------------------------------------------------*/
Kojto 122:f9eeca106725 47 #include "stm32l4xx.h"
Kojto 122:f9eeca106725 48
Kojto 122:f9eeca106725 49 /** @addtogroup STM32L4xx_LL_Driver
Kojto 122:f9eeca106725 50 * @{
Kojto 122:f9eeca106725 51 */
Kojto 122:f9eeca106725 52
Kojto 122:f9eeca106725 53 #if defined (DAC1)
Kojto 122:f9eeca106725 54
Kojto 122:f9eeca106725 55 /** @defgroup DAC_LL DAC
Kojto 122:f9eeca106725 56 * @{
Kojto 122:f9eeca106725 57 */
Kojto 122:f9eeca106725 58
Kojto 122:f9eeca106725 59 /* Private types -------------------------------------------------------------*/
Kojto 122:f9eeca106725 60 /* Private variables ---------------------------------------------------------*/
Kojto 122:f9eeca106725 61
Kojto 122:f9eeca106725 62 /* Private constants ---------------------------------------------------------*/
Kojto 122:f9eeca106725 63 /** @defgroup DAC_LL_Private_Constants DAC Private Constants
Kojto 122:f9eeca106725 64 * @{
Kojto 122:f9eeca106725 65 */
Kojto 122:f9eeca106725 66
Kojto 122:f9eeca106725 67 /* Internal masks for DAC channels definition */
Kojto 122:f9eeca106725 68 /* To select into literal LL_DAC_CHANNEL_x the relevant bits for: */
Kojto 122:f9eeca106725 69 /* - channel bits position into registers CR, MCR, CCR, SHHR, SHRR */
Kojto 122:f9eeca106725 70 /* - channel bits position into register SWTRIG */
Kojto 122:f9eeca106725 71 /* - channel register offset of data holding register DHRx */
Kojto 122:f9eeca106725 72 /* - channel register offset of data output register DORx */
Kojto 122:f9eeca106725 73 /* - channel register offset of sample-and-hold sample time register SHSRx */
Kojto 122:f9eeca106725 74
Kojto 122:f9eeca106725 75 #define DAC_CR_CH1_BITOFFSET ((uint32_t) 0U) /* Position of channel bits into registers CR, MCR, CCR, SHHR, SHRR of channel 1 */
Kojto 122:f9eeca106725 76 #define DAC_CR_CH2_BITOFFSET ((uint32_t)16U) /* Position of channel bits into registers CR, MCR, CCR, SHHR, SHRR of channel 2 */
Kojto 122:f9eeca106725 77 #define DAC_CR_CHX_BITOFFSET_MASK (DAC_CR_CH1_BITOFFSET | DAC_CR_CH2_BITOFFSET)
Kojto 122:f9eeca106725 78
Kojto 122:f9eeca106725 79 #define DAC_SWTR_CH1 (DAC_SWTRIGR_SWTRIG1) /* Channel bit into register SWTRIGR of channel 1. This bit is into area of LL_DAC_CR_CHx_BITOFFSET but excluded by mask DAC_CR_CHX_BITOFFSET_MASK (done to be enable to trig SW start of both DAC channels simultaneously). */
Kojto 122:f9eeca106725 80 #define DAC_SWTR_CH2 (DAC_SWTRIGR_SWTRIG2) /* Channel bit into register SWTRIGR of channel 2. This bit is into area of LL_DAC_CR_CHx_BITOFFSET but excluded by mask DAC_CR_CHX_BITOFFSET_MASK (done to be enable to trig SW start of both DAC channels simultaneously). */
Kojto 122:f9eeca106725 81 #define DAC_SWTR_CHX_MASK (DAC_SWTR_CH1 | DAC_SWTR_CH2)
Kojto 122:f9eeca106725 82
Kojto 122:f9eeca106725 83 #define DAC_REG_DHR12R1_REGOFFSET ((uint32_t)0x00000000U) /* Register DHR12Rx channel 1 taken as reference */
Kojto 122:f9eeca106725 84 #define DAC_REG_DHR12L1_REGOFFSET ((uint32_t)0x00100000U) /* Register offset of DHR12Lx channel 1 versus DHR12Rx channel 1 (shifted left of 20 bits) */
Kojto 122:f9eeca106725 85 #define DAC_REG_DHR8R1_REGOFFSET ((uint32_t)0x02000000U) /* Register offset of DHR8Rx channel 1 versus DHR12Rx channel 1 (shifted left of 24 bits) */
Kojto 122:f9eeca106725 86 #define DAC_REG_DHR12R2_REGOFFSET ((uint32_t)0x00030000U) /* Register offset of DHR12Rx channel 2 versus DHR12Rx channel 1 (shifted left of 16 bits) */
Kojto 122:f9eeca106725 87 #define DAC_REG_DHR12L2_REGOFFSET ((uint32_t)0x00400000U) /* Register offset of DHR12Lx channel 2 versus DHR12Rx channel 1 (shifted left of 20 bits) */
Kojto 122:f9eeca106725 88 #define DAC_REG_DHR8R2_REGOFFSET ((uint32_t)0x05000000U) /* Register offset of DHR8Rx channel 2 versus DHR12Rx channel 1 (shifted left of 24 bits) */
Kojto 122:f9eeca106725 89 #define DAC_REG_DHR12RX_REGOFFSET_MASK ((uint32_t)0x000F0000U)
Kojto 122:f9eeca106725 90 #define DAC_REG_DHR12LX_REGOFFSET_MASK ((uint32_t)0x00F00000U)
Kojto 122:f9eeca106725 91 #define DAC_REG_DHR8RX_REGOFFSET_MASK ((uint32_t)0x0F000000U)
Kojto 122:f9eeca106725 92 #define DAC_REG_DHRX_REGOFFSET_MASK (DAC_REG_DHR12RX_REGOFFSET_MASK | DAC_REG_DHR12LX_REGOFFSET_MASK | DAC_REG_DHR8RX_REGOFFSET_MASK)
Kojto 122:f9eeca106725 93
Kojto 122:f9eeca106725 94 #define DAC_REG_DOR1_REGOFFSET ((uint32_t)0x00000000U) /* Register DORx channel 1 taken as reference */
Kojto 122:f9eeca106725 95 #define DAC_REG_DOR2_REGOFFSET ((uint32_t)0x10000000U)/* Register offset of DORx channel 1 versus DORx channel 2 (shifted left of 28 bits) */
Kojto 122:f9eeca106725 96 #define DAC_REG_DORX_REGOFFSET_MASK (DAC_REG_DOR1_REGOFFSET | DAC_REG_DOR2_REGOFFSET)
Kojto 122:f9eeca106725 97
Kojto 122:f9eeca106725 98 #define DAC_REG_SHSR1_REGOFFSET ((uint32_t)0x00000000U) /* Register SHSRx channel 1 taken as reference */
Kojto 122:f9eeca106725 99 #define DAC_REG_SHSR2_REGOFFSET ((uint32_t)0x00001000U) /* Register offset of SHSRx channel 1 versus SHSRx channel 2 (shifted left of 12 bits) */
Kojto 122:f9eeca106725 100 #define DAC_REG_SHSRX_REGOFFSET_MASK (DAC_REG_SHSR1_REGOFFSET | DAC_REG_SHSR2_REGOFFSET)
Kojto 122:f9eeca106725 101
Kojto 122:f9eeca106725 102 /* DAC registers bits positions */
Kojto 122:f9eeca106725 103 #define DAC_DHR12RD_DACC2DHR_BITOFFSET_POS ((uint32_t)16U) /* Value equivalent to POSITION_VAL(DAC_DHR12RD_DACC2DHR) */
Kojto 122:f9eeca106725 104 #define DAC_DHR12LD_DACC2DHR_BITOFFSET_POS ((uint32_t)20U) /* Value equivalent to POSITION_VAL(DAC_DHR12LD_DACC2DHR) */
Kojto 122:f9eeca106725 105 #define DAC_DHR8RD_DACC2DHR_BITOFFSET_POS ((uint32_t) 8U) /* Value equivalent to POSITION_VAL(DAC_DHR8RD_DACC2DHR) */
Kojto 122:f9eeca106725 106
Kojto 122:f9eeca106725 107 /* Miscellaneous data */
Kojto 122:f9eeca106725 108 #define DAC_DIGITAL_SCALE_12BITS ((uint32_t)4095U) /* Full-scale digital value with a resolution of 12 bits (voltage range determined by analog voltage references Vref+ and Vref-, refer to reference manual) */
Kojto 122:f9eeca106725 109
Kojto 122:f9eeca106725 110 /**
Kojto 122:f9eeca106725 111 * @}
Kojto 122:f9eeca106725 112 */
Kojto 122:f9eeca106725 113
Kojto 122:f9eeca106725 114
Kojto 122:f9eeca106725 115 /* Private macros ------------------------------------------------------------*/
Kojto 122:f9eeca106725 116 /** @defgroup DAC_LL_Private_Macros DAC Private Macros
Kojto 122:f9eeca106725 117 * @{
Kojto 122:f9eeca106725 118 */
Kojto 122:f9eeca106725 119
Kojto 122:f9eeca106725 120 /**
Kojto 122:f9eeca106725 121 * @brief Driver macro reserved for internal use: isolate bits with the
Kojto 122:f9eeca106725 122 * selected mask and shift them to the register LSB
Kojto 122:f9eeca106725 123 * (shift mask on register position bit 0).
Kojto 122:f9eeca106725 124 * @param __BITS__ Bits in register 32 bits
Kojto 122:f9eeca106725 125 * @param __MASK__ Mask in register 32 bits
Kojto 122:f9eeca106725 126 * @retval Bits in register 32 bits
Kojto 122:f9eeca106725 127 */
Kojto 122:f9eeca106725 128 #define __DAC_MASK_SHIFT(__BITS__, __MASK__) \
Kojto 122:f9eeca106725 129 (((__BITS__) & (__MASK__)) >> POSITION_VAL((__MASK__)))
Kojto 122:f9eeca106725 130
Kojto 122:f9eeca106725 131 /**
Kojto 122:f9eeca106725 132 * @brief Driver macro reserved for internal use: set a pointer to
Kojto 122:f9eeca106725 133 * a register from a register basis from which an offset
Kojto 122:f9eeca106725 134 * is applied.
Kojto 122:f9eeca106725 135 * @param __REG__ Register basis from which the offset is applied.
Kojto 122:f9eeca106725 136 * @param __REG_OFFFSET__ Offset to be applied (unit: number of registers).
Kojto 122:f9eeca106725 137 * @retval Pointer to register address
Kojto 122:f9eeca106725 138 */
Kojto 122:f9eeca106725 139 #define __DAC_PTR_REG_OFFSET(__REG__, __REG_OFFFSET__) \
Kojto 122:f9eeca106725 140 ((uint32_t *)((uint32_t) ((uint32_t)(&(__REG__)) + ((__REG_OFFFSET__) << 2U))))
Kojto 122:f9eeca106725 141
Kojto 122:f9eeca106725 142 /**
Kojto 122:f9eeca106725 143 * @}
Kojto 122:f9eeca106725 144 */
Kojto 122:f9eeca106725 145
Kojto 122:f9eeca106725 146
Kojto 122:f9eeca106725 147 /* Exported types ------------------------------------------------------------*/
Kojto 122:f9eeca106725 148 #if defined(USE_FULL_LL_DRIVER)
Kojto 122:f9eeca106725 149 /** @defgroup DAC_LL_ES_INIT DAC Exported Init structure
Kojto 122:f9eeca106725 150 * @{
Kojto 122:f9eeca106725 151 */
Kojto 122:f9eeca106725 152
Kojto 122:f9eeca106725 153 /**
Kojto 122:f9eeca106725 154 * @brief Structure definition of some features of DAC instance.
Kojto 122:f9eeca106725 155 */
Kojto 122:f9eeca106725 156 typedef struct
Kojto 122:f9eeca106725 157 {
Kojto 122:f9eeca106725 158 uint32_t TriggerSource; /*!< Set the conversion trigger source for the selected DAC channel: internal (SW start) or from external IP (timer event, external interrupt line).
Kojto 122:f9eeca106725 159 This parameter can be a value of @ref DAC_LL_EC_TRIGGER_SOURCE
Kojto 122:f9eeca106725 160
Kojto 122:f9eeca106725 161 This feature can be modified afterwards using unitary function @ref LL_DAC_SetTriggerSource(). */
Kojto 122:f9eeca106725 162
Kojto 122:f9eeca106725 163 uint32_t WaveAutoGeneration; /*!< Set the waveform automatic generation mode for the selected DAC channel.
Kojto 122:f9eeca106725 164 This parameter can be a value of @ref DAC_LL_EC_WAVE_AUTO_GENERATION_MODE
Kojto 122:f9eeca106725 165
Kojto 122:f9eeca106725 166 This feature can be modified afterwards using unitary function @ref LL_DAC_SetWaveAutoGeneration(). */
Kojto 122:f9eeca106725 167
Kojto 122:f9eeca106725 168 uint32_t WaveAutoGenerationConfig; /*!< Set the waveform automatic generation mode for the selected DAC channel.
Kojto 122:f9eeca106725 169 If waveform automatic generation mode is set to noise, this parameter can be a value of @ref DAC_LL_EC_WAVE_NOISE_LFSR_UNMASK_BITS
Kojto 122:f9eeca106725 170 If waveform automatic generation mode is set to triangle, this parameter can be a value of @ref DAC_LL_EC_WAVE_TRIANGLE_AMPLITUDE
Kojto 122:f9eeca106725 171 @note If waveform automatic generation mode is disabled, this parameter is discarded.
Kojto 122:f9eeca106725 172
Kojto 122:f9eeca106725 173 This feature can be modified afterwards using unitary function @ref LL_DAC_SetWaveNoiseLFSR() or @ref LL_DAC_SetWaveTriangleAmplitude(), depending on the wave automatic generation selected. */
Kojto 122:f9eeca106725 174
Kojto 122:f9eeca106725 175 uint32_t OutputBuffer; /*!< Set the output buffer for the selected DAC channel.
Kojto 122:f9eeca106725 176 This parameter can be a value of @ref DAC_LL_EC_OUTPUT_BUFFER
Kojto 122:f9eeca106725 177
Kojto 122:f9eeca106725 178 This feature can be modified afterwards using unitary function @ref LL_DAC_SetOutputBuffer(). */
Kojto 122:f9eeca106725 179
Kojto 122:f9eeca106725 180 uint32_t OutputConnection; /*!< Set the output connection for the selected DAC channel.
Kojto 122:f9eeca106725 181 This parameter can be a value of @ref DAC_LL_EC_OUTPUT_CONNECTION
Kojto 122:f9eeca106725 182
Kojto 122:f9eeca106725 183 This feature can be modified afterwards using unitary function @ref LL_DAC_SetOutputConnection(). */
Kojto 122:f9eeca106725 184
Kojto 122:f9eeca106725 185 uint32_t OutputMode; /*!< Set the output mode normal or sample-and-hold for the selected DAC channel.
Kojto 122:f9eeca106725 186 This parameter can be a value of @ref DAC_LL_EC_OUTPUT_MODE
Kojto 122:f9eeca106725 187
Kojto 122:f9eeca106725 188 This feature can be modified afterwards using unitary function @ref LL_DAC_SetOutputMode(). */
Kojto 122:f9eeca106725 189
Kojto 122:f9eeca106725 190 } LL_DAC_InitTypeDef;
Kojto 122:f9eeca106725 191
Kojto 122:f9eeca106725 192 /**
Kojto 122:f9eeca106725 193 * @}
Kojto 122:f9eeca106725 194 */
Kojto 122:f9eeca106725 195 #endif /* USE_FULL_LL_DRIVER */
Kojto 122:f9eeca106725 196
Kojto 122:f9eeca106725 197 /* Exported constants --------------------------------------------------------*/
Kojto 122:f9eeca106725 198 /** @defgroup DAC_LL_Exported_Constants DAC Exported Constants
Kojto 122:f9eeca106725 199 * @{
Kojto 122:f9eeca106725 200 */
Kojto 122:f9eeca106725 201
Kojto 122:f9eeca106725 202 /** @defgroup DAC_LL_EC_GET_FLAG DAC flags
Kojto 122:f9eeca106725 203 * @brief Flags defines which can be used with LL_DAC_ReadReg function
Kojto 122:f9eeca106725 204 * @{
Kojto 122:f9eeca106725 205 */
Kojto 122:f9eeca106725 206 /* DAC channel 1 flags */
Kojto 122:f9eeca106725 207 #define LL_DAC_FLAG_DMAUDR1 (DAC_SR_DMAUDR1) /*!< DAC channel 1 flag DMA underrun */
Kojto 122:f9eeca106725 208 #define LL_DAC_FLAG_CAL1 (DAC_SR_CAL_FLAG1) /*!< DAC channel 1 flag offset calibration status */
Kojto 122:f9eeca106725 209 #define LL_DAC_FLAG_BWST1 (DAC_SR_BWST1) /*!< DAC channel 1 flag busy writing sample time */
Kojto 122:f9eeca106725 210
Kojto 122:f9eeca106725 211 /* DAC channel 2 flags */
Kojto 122:f9eeca106725 212 #define LL_DAC_FLAG_DMAUDR2 (DAC_SR_DMAUDR2) /*!< DAC channel 2 flag DMA underrun */
Kojto 122:f9eeca106725 213 #define LL_DAC_FLAG_CAL2 (DAC_SR_CAL_FLAG2) /*!< DAC channel 2 flag offset calibration status */
Kojto 122:f9eeca106725 214 #define LL_DAC_FLAG_BWST2 (DAC_SR_BWST2) /*!< DAC channel 2 flag busy writing sample time */
Kojto 122:f9eeca106725 215 /**
Kojto 122:f9eeca106725 216 * @}
Kojto 122:f9eeca106725 217 */
Kojto 122:f9eeca106725 218
Kojto 122:f9eeca106725 219 /** @defgroup DAC_LL_EC_IT DAC interruptions
Kojto 122:f9eeca106725 220 * @brief IT defines which can be used with LL_DAC_ReadReg and LL_DAC_WriteReg functions
Kojto 122:f9eeca106725 221 * @{
Kojto 122:f9eeca106725 222 */
Kojto 122:f9eeca106725 223 #define LL_DAC_IT_DMAUDRIE1 (DAC_CR_DMAUDRIE1) /*!< DAC channel 1 interruption DMA underrun */
Kojto 122:f9eeca106725 224 #define LL_DAC_IT_DMAUDRIE2 (DAC_CR_DMAUDRIE2) /*!< DAC channel 2 interruption DMA underrun */
Kojto 122:f9eeca106725 225 /**
Kojto 122:f9eeca106725 226 * @}
Kojto 122:f9eeca106725 227 */
Kojto 122:f9eeca106725 228
Kojto 122:f9eeca106725 229 /** @defgroup DAC_LL_EC_CHANNEL DAC channels
Kojto 122:f9eeca106725 230 * @{
Kojto 122:f9eeca106725 231 */
Kojto 122:f9eeca106725 232 #define LL_DAC_CHANNEL_1 (DAC_REG_SHSR1_REGOFFSET | DAC_REG_DOR1_REGOFFSET | DAC_REG_DHR12R1_REGOFFSET | DAC_REG_DHR12L1_REGOFFSET | DAC_REG_DHR8R1_REGOFFSET | DAC_CR_CH1_BITOFFSET | DAC_SWTR_CH1) /*!< DAC channel 1 */
Kojto 122:f9eeca106725 233 #define LL_DAC_CHANNEL_2 (DAC_REG_SHSR2_REGOFFSET | DAC_REG_DOR2_REGOFFSET | DAC_REG_DHR12R2_REGOFFSET | DAC_REG_DHR12L2_REGOFFSET | DAC_REG_DHR8R2_REGOFFSET | DAC_CR_CH2_BITOFFSET | DAC_SWTR_CH2) /*!< DAC channel 2 */
Kojto 122:f9eeca106725 234 /**
Kojto 122:f9eeca106725 235 * @}
Kojto 122:f9eeca106725 236 */
Kojto 122:f9eeca106725 237
Kojto 122:f9eeca106725 238 /** @defgroup DAC_LL_EC_OPERATING_MODE DAC operating mode
Kojto 122:f9eeca106725 239 * @{
Kojto 122:f9eeca106725 240 */
Kojto 122:f9eeca106725 241 #define LL_DAC_MODE_NORMAL_OPERATION ((uint32_t)0x00000000U) /*!< DAC channel in mode normal operation */
Kojto 122:f9eeca106725 242 #define LL_DAC_MODE_CALIBRATION (DAC_CR_CEN1) /*!< DAC channel in mode calibration */
Kojto 122:f9eeca106725 243 /**
Kojto 122:f9eeca106725 244 * @}
Kojto 122:f9eeca106725 245 */
Kojto 122:f9eeca106725 246
Kojto 122:f9eeca106725 247 /** @defgroup DAC_LL_EC_TRIGGER_SOURCE DAC trigger source
Kojto 122:f9eeca106725 248 * @{
Kojto 122:f9eeca106725 249 */
Kojto 122:f9eeca106725 250 #define LL_DAC_TRIG_SOFTWARE (DAC_CR_TSEL1_2 | DAC_CR_TSEL1_1 | DAC_CR_TSEL1_0) /*!< DAC channel conversion trigger internal (SW start) */
Kojto 122:f9eeca106725 251 #define LL_DAC_TRIG_EXT_TIM2_TRGO (DAC_CR_TSEL1_2 ) /*!< DAC channel conversion trigger from external IP: TIM2 TRGO. */
Kojto 122:f9eeca106725 252 #define LL_DAC_TRIG_EXT_TIM4_TRGO (DAC_CR_TSEL1_2 | DAC_CR_TSEL1_0) /*!< DAC channel conversion trigger from external IP: TIM4 TRGO. */
Kojto 122:f9eeca106725 253 #define LL_DAC_TRIG_EXT_TIM5_TRGO ( DAC_CR_TSEL1_1 | DAC_CR_TSEL1_0) /*!< DAC channel conversion trigger from external IP: TIM5 TRGO. */
Kojto 122:f9eeca106725 254 #define LL_DAC_TRIG_EXT_TIM6_TRGO ((uint32_t)0x00000000U) /*!< DAC channel conversion trigger from external IP: TIM6 TRGO. */
Kojto 122:f9eeca106725 255 #define LL_DAC_TRIG_EXT_TIM7_TRGO ( DAC_CR_TSEL1_1 ) /*!< DAC channel conversion trigger from external IP: TIM7 TRGO. */
Kojto 122:f9eeca106725 256 #define LL_DAC_TRIG_EXT_TIM8_TRGO ( DAC_CR_TSEL1_0) /*!< DAC channel conversion trigger from external IP: TIM8 TRGO. */
Kojto 122:f9eeca106725 257 #define LL_DAC_TRIG_EXT_EXTI_LINE9 (DAC_CR_TSEL1_2 | DAC_CR_TSEL1_1 ) /*!< DAC channel conversion trigger from external IP: external interrupt line 9. */
Kojto 122:f9eeca106725 258 /**
Kojto 122:f9eeca106725 259 * @}
Kojto 122:f9eeca106725 260 */
Kojto 122:f9eeca106725 261
Kojto 122:f9eeca106725 262 /** @defgroup DAC_LL_EC_WAVE_AUTO_GENERATION_MODE DAC waveform automatic generation mode
Kojto 122:f9eeca106725 263 * @{
Kojto 122:f9eeca106725 264 */
Kojto 122:f9eeca106725 265 #define LL_DAC_WAVE_AUTO_GENERATION_NONE ((uint32_t)0x00000000U) /*!< DAC channel wave auto generation mode disabled. */
Kojto 122:f9eeca106725 266 #define LL_DAC_WAVE_AUTO_GENERATION_NOISE (DAC_CR_WAVE1_0) /*!< DAC channel wave auto generation mode enabled, set generated noise waveform. */
Kojto 122:f9eeca106725 267 #define LL_DAC_WAVE_AUTO_GENERATION_TRIANGLE (DAC_CR_WAVE1_1) /*!< DAC channel wave auto generation mode enabled, set generated triangle waveform. */
Kojto 122:f9eeca106725 268 /**
Kojto 122:f9eeca106725 269 * @}
Kojto 122:f9eeca106725 270 */
Kojto 122:f9eeca106725 271
Kojto 122:f9eeca106725 272 /** @defgroup DAC_LL_EC_WAVE_NOISE_LFSR_UNMASK_BITS DAC wave generation - Noise LFSR unmask bits
Kojto 122:f9eeca106725 273 * @{
Kojto 122:f9eeca106725 274 */
Kojto 122:f9eeca106725 275 #define LL_DAC_NOISE_LFSR_UNMASK_BIT0 ((uint32_t)0x00000000U) /*!< Noise wave generation, unmask LFSR bit0, for the selected DAC channel */
Kojto 122:f9eeca106725 276 #define LL_DAC_NOISE_LFSR_UNMASK_BITS1_0 ( DAC_CR_MAMP1_0) /*!< Noise wave generation, unmask LFSR bits[1:0], for the selected DAC channel */
Kojto 122:f9eeca106725 277 #define LL_DAC_NOISE_LFSR_UNMASK_BITS2_0 ( DAC_CR_MAMP1_1 ) /*!< Noise wave generation, unmask LFSR bits[2:0], for the selected DAC channel */
Kojto 122:f9eeca106725 278 #define LL_DAC_NOISE_LFSR_UNMASK_BITS3_0 ( DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Noise wave generation, unmask LFSR bits[3:0], for the selected DAC channel */
Kojto 122:f9eeca106725 279 #define LL_DAC_NOISE_LFSR_UNMASK_BITS4_0 ( DAC_CR_MAMP1_2 ) /*!< Noise wave generation, unmask LFSR bits[4:0], for the selected DAC channel */
Kojto 122:f9eeca106725 280 #define LL_DAC_NOISE_LFSR_UNMASK_BITS5_0 ( DAC_CR_MAMP1_2 | DAC_CR_MAMP1_0) /*!< Noise wave generation, unmask LFSR bits[5:0], for the selected DAC channel */
Kojto 122:f9eeca106725 281 #define LL_DAC_NOISE_LFSR_UNMASK_BITS6_0 ( DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1 ) /*!< Noise wave generation, unmask LFSR bits[6:0], for the selected DAC channel */
Kojto 122:f9eeca106725 282 #define LL_DAC_NOISE_LFSR_UNMASK_BITS7_0 ( DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Noise wave generation, unmask LFSR bits[7:0], for the selected DAC channel */
Kojto 122:f9eeca106725 283 #define LL_DAC_NOISE_LFSR_UNMASK_BITS8_0 (DAC_CR_MAMP1_3 ) /*!< Noise wave generation, unmask LFSR bits[8:0], for the selected DAC channel */
Kojto 122:f9eeca106725 284 #define LL_DAC_NOISE_LFSR_UNMASK_BITS9_0 (DAC_CR_MAMP1_3 | DAC_CR_MAMP1_0) /*!< Noise wave generation, unmask LFSR bits[9:0], for the selected DAC channel */
Kojto 122:f9eeca106725 285 #define LL_DAC_NOISE_LFSR_UNMASK_BITS10_0 (DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1 ) /*!< Noise wave generation, unmask LFSR bits[10:0], for the selected DAC channel */
Kojto 122:f9eeca106725 286 #define LL_DAC_NOISE_LFSR_UNMASK_BITS11_0 (DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Noise wave generation, unmask LFSR bits[11:0], for the selected DAC channel */
Kojto 122:f9eeca106725 287 /**
Kojto 122:f9eeca106725 288 * @}
Kojto 122:f9eeca106725 289 */
Kojto 122:f9eeca106725 290
Kojto 122:f9eeca106725 291 /** @defgroup DAC_LL_EC_WAVE_TRIANGLE_AMPLITUDE DAC wave generation - Triangle amplitude
Kojto 122:f9eeca106725 292 * @{
Kojto 122:f9eeca106725 293 */
Kojto 122:f9eeca106725 294 #define LL_DAC_TRIANGLE_AMPLITUDE_1 ((uint32_t)0x00000000U) /*!< Triangle wave generation, amplitude of 1 LSB of DAC output range, for the selected DAC channel */
Kojto 122:f9eeca106725 295 #define LL_DAC_TRIANGLE_AMPLITUDE_3 ( DAC_CR_MAMP1_0) /*!< Triangle wave generation, amplitude of 3 LSB of DAC output range, for the selected DAC channel */
Kojto 122:f9eeca106725 296 #define LL_DAC_TRIANGLE_AMPLITUDE_7 ( DAC_CR_MAMP1_1 ) /*!< Triangle wave generation, amplitude of 7 LSB of DAC output range, for the selected DAC channel */
Kojto 122:f9eeca106725 297 #define LL_DAC_TRIANGLE_AMPLITUDE_15 ( DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Triangle wave generation, amplitude of 15 LSB of DAC output range, for the selected DAC channel */
Kojto 122:f9eeca106725 298 #define LL_DAC_TRIANGLE_AMPLITUDE_31 ( DAC_CR_MAMP1_2 ) /*!< Triangle wave generation, amplitude of 31 LSB of DAC output range, for the selected DAC channel */
Kojto 122:f9eeca106725 299 #define LL_DAC_TRIANGLE_AMPLITUDE_63 ( DAC_CR_MAMP1_2 | DAC_CR_MAMP1_0) /*!< Triangle wave generation, amplitude of 63 LSB of DAC output range, for the selected DAC channel */
Kojto 122:f9eeca106725 300 #define LL_DAC_TRIANGLE_AMPLITUDE_127 ( DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1 ) /*!< Triangle wave generation, amplitude of 127 LSB of DAC output range, for the selected DAC channel */
Kojto 122:f9eeca106725 301 #define LL_DAC_TRIANGLE_AMPLITUDE_255 ( DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Triangle wave generation, amplitude of 255 LSB of DAC output range, for the selected DAC channel */
Kojto 122:f9eeca106725 302 #define LL_DAC_TRIANGLE_AMPLITUDE_511 (DAC_CR_MAMP1_3 ) /*!< Triangle wave generation, amplitude of 512 LSB of DAC output range, for the selected DAC channel */
Kojto 122:f9eeca106725 303 #define LL_DAC_TRIANGLE_AMPLITUDE_1023 (DAC_CR_MAMP1_3 | DAC_CR_MAMP1_0) /*!< Triangle wave generation, amplitude of 1023 LSB of DAC output range, for the selected DAC channel */
Kojto 122:f9eeca106725 304 #define LL_DAC_TRIANGLE_AMPLITUDE_2047 (DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1 ) /*!< Triangle wave generation, amplitude of 2047 LSB of DAC output range, for the selected DAC channel */
Kojto 122:f9eeca106725 305 #define LL_DAC_TRIANGLE_AMPLITUDE_4095 (DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0) /*!< Triangle wave generation, amplitude of 4095 LSB of DAC output range, for the selected DAC channel */
Kojto 122:f9eeca106725 306 /**
Kojto 122:f9eeca106725 307 * @}
Kojto 122:f9eeca106725 308 */
Kojto 122:f9eeca106725 309
Kojto 122:f9eeca106725 310 /** @defgroup DAC_LL_EC_OUTPUT_MODE DAC channel output mode
Kojto 122:f9eeca106725 311 * @{
Kojto 122:f9eeca106725 312 */
Kojto 122:f9eeca106725 313 #define LL_DAC_OUTPUT_MODE_NORMAL ((uint32_t)0x00000000U) /*!< The selected DAC channel output is on mode normal. */
Kojto 122:f9eeca106725 314 #define LL_DAC_OUTPUT_MODE_SAMPLE_AND_HOLD (DAC_MCR_MODE1_2) /*!< The selected DAC channel output is on mode sample-and-hold. Mode sample-and-hold requires an external capacitor, refer to description of function @ref LL_DAC_ConfigOutput() or @ref LL_DAC_SetOutputMode(). */
Kojto 122:f9eeca106725 315 /**
Kojto 122:f9eeca106725 316 * @}
Kojto 122:f9eeca106725 317 */
Kojto 122:f9eeca106725 318
Kojto 122:f9eeca106725 319 /** @defgroup DAC_LL_EC_OUTPUT_BUFFER DAC channel output buffer
Kojto 122:f9eeca106725 320 * @{
Kojto 122:f9eeca106725 321 */
Kojto 122:f9eeca106725 322 #define LL_DAC_OUTPUT_BUFFER_ENABLE ((uint32_t)0x00000000U) /*!< The selected DAC channel output is buffered: higher drive current capability, but also higher current consumption */
Kojto 122:f9eeca106725 323 #define LL_DAC_OUTPUT_BUFFER_DISABLE (DAC_MCR_MODE1_1) /*!< The selected DAC channel output is not buffered: lower drive current capability, but also lower current consumption */
Kojto 122:f9eeca106725 324 /**
Kojto 122:f9eeca106725 325 * @}
Kojto 122:f9eeca106725 326 */
Kojto 122:f9eeca106725 327
Kojto 122:f9eeca106725 328 /** @defgroup DAC_LL_EC_OUTPUT_CONNECTION DAC channel output connection
Kojto 122:f9eeca106725 329 * @{
Kojto 122:f9eeca106725 330 */
Kojto 122:f9eeca106725 331 #define LL_DAC_OUTPUT_CONNECT_GPIO ((uint32_t)0x00000000U) /*!< The selected DAC channel output is connected to external pin */
Kojto 122:f9eeca106725 332 #define LL_DAC_OUTPUT_CONNECT_INTERNAL (DAC_MCR_MODE1_0) /*!< The selected DAC channel output is connected to on-chip peripherals via internal paths. On this STM32 serie, output connection depends on output mode (normal or sample and hold) and output buffer state. Refer to comments of function @ref LL_DAC_SetOutputConnection(). */
Kojto 122:f9eeca106725 333 /**
Kojto 122:f9eeca106725 334 * @}
Kojto 122:f9eeca106725 335 */
Kojto 122:f9eeca106725 336
Kojto 122:f9eeca106725 337 /** @defgroup DAC_LL_EC_LEGACY DAC literals legacy naming
Kojto 122:f9eeca106725 338 * @{
Kojto 122:f9eeca106725 339 */
Kojto 122:f9eeca106725 340 #define LL_DAC_TRIGGER_SOFTWARE (LL_DAC_TRIG_SOFTWARE)
Kojto 122:f9eeca106725 341 #define LL_DAC_TRIGGER_TIM2_TRGO (LL_DAC_TRIG_EXT_TIM2_TRGO)
Kojto 122:f9eeca106725 342 #define LL_DAC_TRIGGER_TIM4_TRGO (LL_DAC_TRIG_EXT_TIM4_TRGO)
Kojto 122:f9eeca106725 343 #define LL_DAC_TRIGGER_TIM5_TRGO (LL_DAC_TRIG_EXT_TIM5_TRGO)
Kojto 122:f9eeca106725 344 #define LL_DAC_TRIGGER_TIM6_TRGO (LL_DAC_TRIG_EXT_TIM6_TRGO)
Kojto 122:f9eeca106725 345 #define LL_DAC_TRIGGER_TIM7_TRGO (LL_DAC_TRIG_EXT_TIM7_TRGO)
Kojto 122:f9eeca106725 346 #define LL_DAC_TRIGGER_TIM8_TRGO (LL_DAC_TRIG_EXT_TIM8_TRGO)
Kojto 122:f9eeca106725 347 #define LL_DAC_TRIGGER_EXT_IT9 (LL_DAC_TRIG_EXT_EXTI_LINE9)
Kojto 122:f9eeca106725 348
Kojto 122:f9eeca106725 349 #define LL_DAC_WAVEGENERATION_NONE (LL_DAC_WAVE_AUTO_GENERATION_NONE)
Kojto 122:f9eeca106725 350 #define LL_DAC_WAVEGENERATION_NOISE (LL_DAC_WAVE_AUTO_GENERATION_NOISE)
Kojto 122:f9eeca106725 351 #define LL_DAC_WAVEGENERATION_TRIANGLE (LL_DAC_WAVE_AUTO_GENERATION_TRIANGLE)
Kojto 122:f9eeca106725 352
Kojto 122:f9eeca106725 353 #define LL_DAC_CONNECT_GPIO (LL_DAC_OUTPUT_CONNECT_GPIO)
Kojto 122:f9eeca106725 354 #define LL_DAC_CONNECT_INTERNAL (LL_DAC_OUTPUT_CONNECT_INTERNAL)
Kojto 122:f9eeca106725 355 /**
Kojto 122:f9eeca106725 356 * @}
Kojto 122:f9eeca106725 357 */
Kojto 122:f9eeca106725 358
Kojto 122:f9eeca106725 359
Kojto 122:f9eeca106725 360 /** @defgroup DAC_LL_EC_RESOLUTION DAC channel output resolution
Kojto 122:f9eeca106725 361 * @{
Kojto 122:f9eeca106725 362 */
Kojto 122:f9eeca106725 363 #define LL_DAC_RESOLUTION_12B ((uint32_t)0x00000000U) /*!< DAC channel resolution 12 bits */
Kojto 122:f9eeca106725 364 #define LL_DAC_RESOLUTION_8B ((uint32_t)0x00000002U) /*!< DAC channel resolution 8 bits */
Kojto 122:f9eeca106725 365 /**
Kojto 122:f9eeca106725 366 * @}
Kojto 122:f9eeca106725 367 */
Kojto 122:f9eeca106725 368
Kojto 122:f9eeca106725 369 /** @defgroup DAC_LL_EC_REGISTERS DAC registers compliant with specific purpose
Kojto 122:f9eeca106725 370 * @{
Kojto 122:f9eeca106725 371 */
Kojto 122:f9eeca106725 372 /* List of DAC registers intended to be used (most commonly) with */
Kojto 122:f9eeca106725 373 /* DMA transfer. */
Kojto 122:f9eeca106725 374 /* Refer to function @ref LL_DAC_DMA_GetRegAddr(). */
Kojto 122:f9eeca106725 375 #define LL_DAC_DMA_REG_DATA_12BITS_RIGHT_ALIGNED DAC_REG_DHR12RX_REGOFFSET_MASK /*!< DAC channel data holding register 12 bits right aligned */
Kojto 122:f9eeca106725 376 #define LL_DAC_DMA_REG_DATA_12BITS_LEFT_ALIGNED DAC_REG_DHR12LX_REGOFFSET_MASK /*!< DAC channel data holding register 12 bits left aligned */
Kojto 122:f9eeca106725 377 #define LL_DAC_DMA_REG_DATA_8BITS_RIGHT_ALIGNED DAC_REG_DHR8RX_REGOFFSET_MASK /*!< DAC channel data holding register 8 bits right aligned */
Kojto 122:f9eeca106725 378 /**
Kojto 122:f9eeca106725 379 * @}
Kojto 122:f9eeca106725 380 */
Kojto 122:f9eeca106725 381
Kojto 122:f9eeca106725 382 /** @defgroup DAC_LL_EC_HW_DELAYS Definitions of DAC hardware constraints delays
Kojto 122:f9eeca106725 383 * @note Only DAC IP HW delays are defined in DAC LL driver driver,
Kojto 122:f9eeca106725 384 * not timeout values.
Kojto 122:f9eeca106725 385 * For details on delays values, refer to descriptions in source code
Kojto 122:f9eeca106725 386 * above each literal definition.
Kojto 122:f9eeca106725 387 * @{
Kojto 122:f9eeca106725 388 */
Kojto 122:f9eeca106725 389
Kojto 122:f9eeca106725 390 /* Delay for DAC channel voltage settling time from DAC channel startup */
Kojto 122:f9eeca106725 391 /* (transition from disable to enable). */
Kojto 122:f9eeca106725 392 /* Note: DAC channel startup time depends on board application environment: */
Kojto 122:f9eeca106725 393 /* impedance connected to DAC channel output. */
Kojto 122:f9eeca106725 394 /* The delay below is specified under conditions: */
Kojto 122:f9eeca106725 395 /* - voltage maximum transition (lowest to highest value) */
Kojto 122:f9eeca106725 396 /* - until voltage reaches final value +-1LSB */
Kojto 122:f9eeca106725 397 /* - DAC channel output buffer enabled */
Kojto 122:f9eeca106725 398 /* - load impedance of 5kOhm (min), 50pF (max) */
Kojto 122:f9eeca106725 399 /* Literal set to maximum value (refer to device datasheet, */
Kojto 122:f9eeca106725 400 /* parameter "tWAKEUP"). */
Kojto 122:f9eeca106725 401 /* Unit: us */
Kojto 122:f9eeca106725 402 #define LL_DAC_DELAY_STARTUP_VOLTAGE_SETTLING_US ((uint32_t) 8U) /*!< Delay for DAC channel voltage settling time from DAC channel startup (transition from disable to enable) */
Kojto 122:f9eeca106725 403
Kojto 122:f9eeca106725 404
Kojto 122:f9eeca106725 405 /* Delay for DAC channel voltage settling time. */
Kojto 122:f9eeca106725 406 /* Note: DAC channel startup time depends on board application environment: */
Kojto 122:f9eeca106725 407 /* impedance connected to DAC channel output. */
Kojto 122:f9eeca106725 408 /* The delay below is specified under conditions: */
Kojto 122:f9eeca106725 409 /* - voltage maximum transition (lowest to highest value) */
Kojto 122:f9eeca106725 410 /* - until voltage reaches final value +-1LSB */
Kojto 122:f9eeca106725 411 /* - DAC channel output buffer enabled */
Kojto 122:f9eeca106725 412 /* - load impedance of 5kOhm min, 50pF max */
Kojto 122:f9eeca106725 413 /* Literal set to maximum value (refer to device datasheet, */
Kojto 122:f9eeca106725 414 /* parameter "tSETTLING"). */
Kojto 122:f9eeca106725 415 /* Unit: us */
Kojto 122:f9eeca106725 416 #define LL_DAC_DELAY_VOLTAGE_SETTLING_US ((uint32_t) 2U) /*!< Delay for DAC channel voltage settling time */
Kojto 122:f9eeca106725 417
Kojto 122:f9eeca106725 418 /**
Kojto 122:f9eeca106725 419 * @}
Kojto 122:f9eeca106725 420 */
Kojto 122:f9eeca106725 421
Kojto 122:f9eeca106725 422 /**
Kojto 122:f9eeca106725 423 * @}
Kojto 122:f9eeca106725 424 */
Kojto 122:f9eeca106725 425
Kojto 122:f9eeca106725 426 /* Exported macro ------------------------------------------------------------*/
Kojto 122:f9eeca106725 427 /** @defgroup DAC_LL_Exported_Macros DAC Exported Macros
Kojto 122:f9eeca106725 428 * @{
Kojto 122:f9eeca106725 429 */
Kojto 122:f9eeca106725 430
Kojto 122:f9eeca106725 431 /** @defgroup DAC_LL_EM_WRITE_READ Common write and read registers macros
Kojto 122:f9eeca106725 432 * @{
Kojto 122:f9eeca106725 433 */
Kojto 122:f9eeca106725 434
Kojto 122:f9eeca106725 435 /**
Kojto 122:f9eeca106725 436 * @brief Write a value in DAC register
Kojto 122:f9eeca106725 437 * @param __INSTANCE__ DAC Instance
Kojto 122:f9eeca106725 438 * @param __REG__ Register to be written
Kojto 122:f9eeca106725 439 * @param __VALUE__ Value to be written in the register
Kojto 122:f9eeca106725 440 * @retval None
Kojto 122:f9eeca106725 441 */
Kojto 122:f9eeca106725 442 #define LL_DAC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
Kojto 122:f9eeca106725 443
Kojto 122:f9eeca106725 444 /**
Kojto 122:f9eeca106725 445 * @brief Read a value in DAC register
Kojto 122:f9eeca106725 446 * @param __INSTANCE__ DAC Instance
Kojto 122:f9eeca106725 447 * @param __REG__ Register to be read
Kojto 122:f9eeca106725 448 * @retval Register value
Kojto 122:f9eeca106725 449 */
Kojto 122:f9eeca106725 450 #define LL_DAC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
Kojto 122:f9eeca106725 451
Kojto 122:f9eeca106725 452 /**
Kojto 122:f9eeca106725 453 * @}
Kojto 122:f9eeca106725 454 */
Kojto 122:f9eeca106725 455
Kojto 122:f9eeca106725 456 /** @defgroup DAC_LL_EM_HELPER_MACRO DAC helper macro
Kojto 122:f9eeca106725 457 * @{
Kojto 122:f9eeca106725 458 */
Kojto 122:f9eeca106725 459
Kojto 122:f9eeca106725 460 /**
Kojto 122:f9eeca106725 461 * @brief Helper macro to get DAC channel number in decimal format
Kojto 122:f9eeca106725 462 * from literals LL_DAC_CHANNEL_x.
Kojto 122:f9eeca106725 463 * Example:
Kojto 122:f9eeca106725 464 * __LL_DAC_CHANNEL_TO_DECIMAL_NB(LL_DAC_CHANNEL_1)
Kojto 122:f9eeca106725 465 * will return decimal number "1".
Kojto 122:f9eeca106725 466 * @note The input can be a value from functions where a channel
Kojto 122:f9eeca106725 467 * number is returned.
Kojto 122:f9eeca106725 468 * @param __CHANNEL__ This parameter can be one of the following values:
Kojto 122:f9eeca106725 469 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 470 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 471 * @retval 1...2
Kojto 122:f9eeca106725 472 */
Kojto 122:f9eeca106725 473 #define __LL_DAC_CHANNEL_TO_DECIMAL_NB(__CHANNEL__) \
Kojto 122:f9eeca106725 474 ((__CHANNEL__) & DAC_SWTR_CHX_MASK)
Kojto 122:f9eeca106725 475
Kojto 122:f9eeca106725 476 /**
Kojto 122:f9eeca106725 477 * @brief Helper macro to get DAC channel in literal format LL_DAC_CHANNEL_x
Kojto 122:f9eeca106725 478 * from number in decimal format.
Kojto 122:f9eeca106725 479 * Example:
Kojto 122:f9eeca106725 480 * __LL_DAC_DECIMAL_NB_TO_CHANNEL(1)
Kojto 122:f9eeca106725 481 * will return a data equivalent to "LL_DAC_CHANNEL_1".
Kojto 122:f9eeca106725 482 * @note If the input parameter does not correspond to a DAC channel,
Kojto 122:f9eeca106725 483 * this macro returns value '0'.
Kojto 122:f9eeca106725 484 * @param __DECIMAL_NB__ 1...2
Kojto 122:f9eeca106725 485 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 486 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 487 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 488 */
Kojto 122:f9eeca106725 489 #define __LL_DAC_DECIMAL_NB_TO_CHANNEL(__DECIMAL_NB__) \
Kojto 122:f9eeca106725 490 (((__DECIMAL_NB__) == 1U) \
Kojto 122:f9eeca106725 491 ? ( \
Kojto 122:f9eeca106725 492 LL_DAC_CHANNEL_1 \
Kojto 122:f9eeca106725 493 ) \
Kojto 122:f9eeca106725 494 : \
Kojto 122:f9eeca106725 495 (((__DECIMAL_NB__) == 2U) \
Kojto 122:f9eeca106725 496 ? ( \
Kojto 122:f9eeca106725 497 LL_DAC_CHANNEL_2 \
Kojto 122:f9eeca106725 498 ) \
Kojto 122:f9eeca106725 499 : \
Kojto 122:f9eeca106725 500 ( \
Kojto 122:f9eeca106725 501 0 \
Kojto 122:f9eeca106725 502 ) \
Kojto 122:f9eeca106725 503 ) \
Kojto 122:f9eeca106725 504 )
Kojto 122:f9eeca106725 505
Kojto 122:f9eeca106725 506 /**
Kojto 122:f9eeca106725 507 * @brief Helper macro to define the DAC conversion data full-scale digital
Kojto 122:f9eeca106725 508 * value corresponding to the selected DAC resolution.
Kojto 122:f9eeca106725 509 * @note DAC conversion data full-scale corresponds to voltage range
Kojto 122:f9eeca106725 510 * determined by analog voltage references Vref+ and Vref-
Kojto 122:f9eeca106725 511 * (refer to reference manual).
Kojto 122:f9eeca106725 512 * @param __DAC_RESOLUTION__ This parameter can be one of the following values:
Kojto 122:f9eeca106725 513 * @arg @ref LL_DAC_RESOLUTION_12B
Kojto 122:f9eeca106725 514 * @arg @ref LL_DAC_RESOLUTION_8B
Kojto 122:f9eeca106725 515 * @retval ADC conversion data equivalent voltage value (unit: mVolt)
Kojto 122:f9eeca106725 516 */
Kojto 122:f9eeca106725 517 #define __LL_DAC_DIGITAL_SCALE(__DAC_RESOLUTION__) \
Kojto 122:f9eeca106725 518 (((uint32_t)0xFFFU) >> ((__DAC_RESOLUTION__) << 1U))
Kojto 122:f9eeca106725 519
Kojto 122:f9eeca106725 520 /**
Kojto 122:f9eeca106725 521 * @brief Helper macro to calculate the DAC conversion data (unit: digital
Kojto 122:f9eeca106725 522 * value) corresponding to a voltage (unit: mVolt).
Kojto 122:f9eeca106725 523 * @note This helper macro is intended to provide input data in voltage
Kojto 122:f9eeca106725 524 * rather than digital value,
Kojto 122:f9eeca106725 525 * to be used with LL DAC functions such as
Kojto 122:f9eeca106725 526 * @ref LL_DAC_ConvertData12RightAligned().
Kojto 122:f9eeca106725 527 * @note Analog reference voltage (Vref+) must be either known from
Kojto 122:f9eeca106725 528 * user board environment or can be calculated using ADC measurement
Kojto 122:f9eeca106725 529 * and ADC helper macro @ref __LL_ADC_CALC_VREFANALOG_VOLTAGE().
Kojto 122:f9eeca106725 530 * @param __VREFANALOG_VOLTAGE__ Analog reference voltage (unit: mV)
Kojto 122:f9eeca106725 531 * @param __DAC_VOLTAGE__ Voltage to be generated by DAC channel
Kojto 122:f9eeca106725 532 * (unit: mVolt).
Kojto 122:f9eeca106725 533 * @param __DAC_RESOLUTION__ This parameter can be one of the following values:
Kojto 122:f9eeca106725 534 * @arg @ref LL_DAC_RESOLUTION_12B
Kojto 122:f9eeca106725 535 * @arg @ref LL_DAC_RESOLUTION_8B
Kojto 122:f9eeca106725 536 * @retval DAC conversion data (unit: digital value)
Kojto 122:f9eeca106725 537 */
Kojto 122:f9eeca106725 538 #define __LL_DAC_CALC_VOLTAGE_TO_DATA(__VREFANALOG_VOLTAGE__,\
Kojto 122:f9eeca106725 539 __DAC_VOLTAGE__,\
Kojto 122:f9eeca106725 540 __DAC_RESOLUTION__) \
Kojto 122:f9eeca106725 541 ((__DAC_VOLTAGE__) * __LL_DAC_DIGITAL_SCALE(__DAC_RESOLUTION__) \
Kojto 122:f9eeca106725 542 / (__VREFANALOG_VOLTAGE__) \
Kojto 122:f9eeca106725 543 )
Kojto 122:f9eeca106725 544
Kojto 122:f9eeca106725 545 /**
Kojto 122:f9eeca106725 546 * @}
Kojto 122:f9eeca106725 547 */
Kojto 122:f9eeca106725 548
Kojto 122:f9eeca106725 549 /**
Kojto 122:f9eeca106725 550 * @}
Kojto 122:f9eeca106725 551 */
Kojto 122:f9eeca106725 552
Kojto 122:f9eeca106725 553
Kojto 122:f9eeca106725 554 /* Exported functions --------------------------------------------------------*/
Kojto 122:f9eeca106725 555 /** @defgroup DAC_LL_Exported_Functions DAC Exported Functions
Kojto 122:f9eeca106725 556 * @{
Kojto 122:f9eeca106725 557 */
Kojto 122:f9eeca106725 558 /** @defgroup DAC_LL_EF_Configuration Configuration of DAC channels
Kojto 122:f9eeca106725 559 * @{
Kojto 122:f9eeca106725 560 */
Kojto 122:f9eeca106725 561
Kojto 122:f9eeca106725 562 /**
Kojto 122:f9eeca106725 563 * @brief Set the operating mode for the selected DAC channel:
Kojto 122:f9eeca106725 564 * calibration or normal operating mode.
Kojto 122:f9eeca106725 565 * @rmtoll CR CEN1 LL_DAC_SetMode\n
Kojto 122:f9eeca106725 566 * CR CEN2 LL_DAC_SetMode
Kojto 122:f9eeca106725 567 * @param DACx DAC instance
Kojto 122:f9eeca106725 568 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 569 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 570 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 571 * @param ChannelMode This parameter can be one of the following values:
Kojto 122:f9eeca106725 572 * @arg @ref LL_DAC_MODE_NORMAL_OPERATION
Kojto 122:f9eeca106725 573 * @arg @ref LL_DAC_MODE_CALIBRATION
Kojto 122:f9eeca106725 574 * @retval None
Kojto 122:f9eeca106725 575 */
Kojto 122:f9eeca106725 576 __STATIC_INLINE void LL_DAC_SetMode(DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t ChannelMode)
Kojto 122:f9eeca106725 577 {
Kojto 122:f9eeca106725 578 MODIFY_REG(DACx->CR,
Kojto 122:f9eeca106725 579 DAC_CR_CEN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK),
Kojto 122:f9eeca106725 580 ChannelMode << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
Kojto 122:f9eeca106725 581 }
Kojto 122:f9eeca106725 582
Kojto 122:f9eeca106725 583 /**
Kojto 122:f9eeca106725 584 * @brief Get the operating mode for the selected DAC channel:
Kojto 122:f9eeca106725 585 * calibration or normal operating mode.
Kojto 122:f9eeca106725 586 * @rmtoll CR CEN1 LL_DAC_GetMode\n
Kojto 122:f9eeca106725 587 * CR CEN2 LL_DAC_GetMode
Kojto 122:f9eeca106725 588 * @param DACx DAC instance
Kojto 122:f9eeca106725 589 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 590 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 591 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 592 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 593 * @arg @ref LL_DAC_MODE_NORMAL_OPERATION
Kojto 122:f9eeca106725 594 * @arg @ref LL_DAC_MODE_CALIBRATION
Kojto 122:f9eeca106725 595 */
Kojto 122:f9eeca106725 596 __STATIC_INLINE uint32_t LL_DAC_GetMode(DAC_TypeDef *DACx, uint32_t DAC_Channel)
Kojto 122:f9eeca106725 597 {
Kojto 122:f9eeca106725 598 return (uint32_t)(READ_BIT(DACx->CR, DAC_CR_CEN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
Kojto 122:f9eeca106725 599 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
Kojto 122:f9eeca106725 600 );
Kojto 122:f9eeca106725 601 }
Kojto 122:f9eeca106725 602
Kojto 122:f9eeca106725 603 /**
Kojto 122:f9eeca106725 604 * @brief Set the offset trimming value for the selected DAC channel.
Kojto 122:f9eeca106725 605 * Trimming has an impact when output buffer is enabled
Kojto 122:f9eeca106725 606 * and is intended to replace factory calibration default values.
Kojto 122:f9eeca106725 607 * @rmtoll CCR OTRIM1 LL_DAC_SetTrimmingValue\n
Kojto 122:f9eeca106725 608 * CCR OTRIM2 LL_DAC_SetTrimmingValue
Kojto 122:f9eeca106725 609 * @param DACx DAC instance
Kojto 122:f9eeca106725 610 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 611 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 612 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 613 * @param TrimmingValue Value between Min_Data=0x00 and Max_Data=0x1F
Kojto 122:f9eeca106725 614 * @retval None
Kojto 122:f9eeca106725 615 */
Kojto 122:f9eeca106725 616 __STATIC_INLINE void LL_DAC_SetTrimmingValue(DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t TrimmingValue)
Kojto 122:f9eeca106725 617 {
Kojto 122:f9eeca106725 618 MODIFY_REG(DACx->CCR,
Kojto 122:f9eeca106725 619 DAC_CCR_OTRIM1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK),
Kojto 122:f9eeca106725 620 TrimmingValue << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
Kojto 122:f9eeca106725 621 }
Kojto 122:f9eeca106725 622
Kojto 122:f9eeca106725 623 /**
Kojto 122:f9eeca106725 624 * @brief Get the offset trimming value for the selected DAC channel.
Kojto 122:f9eeca106725 625 * Trimming has an impact when output buffer is enabled
Kojto 122:f9eeca106725 626 * and is intended to replace factory calibration default values.
Kojto 122:f9eeca106725 627 * @rmtoll CCR OTRIM1 LL_DAC_GetTrimmingValue\n
Kojto 122:f9eeca106725 628 * CCR OTRIM2 LL_DAC_GetTrimmingValue
Kojto 122:f9eeca106725 629 * @param DACx DAC instance
Kojto 122:f9eeca106725 630 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 631 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 632 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 633 * @retval TrimmingValue Value between Min_Data=0x00 and Max_Data=0x1F
Kojto 122:f9eeca106725 634 */
Kojto 122:f9eeca106725 635 __STATIC_INLINE uint32_t LL_DAC_GetTrimmingValue(DAC_TypeDef *DACx, uint32_t DAC_Channel)
Kojto 122:f9eeca106725 636 {
Kojto 122:f9eeca106725 637 return (uint32_t)(READ_BIT(DACx->CCR, DAC_CCR_OTRIM1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
Kojto 122:f9eeca106725 638 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
Kojto 122:f9eeca106725 639 );
Kojto 122:f9eeca106725 640 }
Kojto 122:f9eeca106725 641
Kojto 122:f9eeca106725 642 /**
Kojto 122:f9eeca106725 643 * @brief Set the conversion trigger source for the selected DAC channel.
Kojto 122:f9eeca106725 644 * @note For conversion trigger source to be effective, DAC trigger
Kojto 122:f9eeca106725 645 * must be enabled using function @ref LL_DAC_EnableTrigger().
Kojto 122:f9eeca106725 646 * @note To set conversion trigger source, DAC channel must be disabled.
Kojto 122:f9eeca106725 647 * Otherwise, the setting is discarded.
Kojto 122:f9eeca106725 648 * @note Availability of parameters of trigger sources from timer
Kojto 122:f9eeca106725 649 * depends on timers availability on the selected device.
Kojto 122:f9eeca106725 650 * @rmtoll CR TSEL1 LL_DAC_SetTriggerSource\n
Kojto 122:f9eeca106725 651 * CR TSEL2 LL_DAC_SetTriggerSource
Kojto 122:f9eeca106725 652 * @param DACx DAC instance
Kojto 122:f9eeca106725 653 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 654 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 655 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 656 * @param TriggerSource This parameter can be one of the following values:
Kojto 122:f9eeca106725 657 * @arg @ref LL_DAC_TRIG_SOFTWARE
Kojto 122:f9eeca106725 658 * @arg @ref LL_DAC_TRIG_EXT_TIM2_TRGO
Kojto 122:f9eeca106725 659 * @arg @ref LL_DAC_TRIG_EXT_TIM4_TRGO
Kojto 122:f9eeca106725 660 * @arg @ref LL_DAC_TRIG_EXT_TIM5_TRGO
Kojto 122:f9eeca106725 661 * @arg @ref LL_DAC_TRIG_EXT_TIM6_TRGO
Kojto 122:f9eeca106725 662 * @arg @ref LL_DAC_TRIG_EXT_TIM7_TRGO
Kojto 122:f9eeca106725 663 * @arg @ref LL_DAC_TRIG_EXT_TIM8_TRGO
Kojto 122:f9eeca106725 664 * @arg @ref LL_DAC_TRIG_EXT_EXTI_LINE9
Kojto 122:f9eeca106725 665 * @retval None
Kojto 122:f9eeca106725 666 */
Kojto 122:f9eeca106725 667 __STATIC_INLINE void LL_DAC_SetTriggerSource(DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t TriggerSource)
Kojto 122:f9eeca106725 668 {
Kojto 122:f9eeca106725 669 MODIFY_REG(DACx->CR,
Kojto 122:f9eeca106725 670 DAC_CR_TSEL1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK),
Kojto 122:f9eeca106725 671 TriggerSource << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
Kojto 122:f9eeca106725 672 }
Kojto 122:f9eeca106725 673
Kojto 122:f9eeca106725 674 /**
Kojto 122:f9eeca106725 675 * @brief Get the conversion trigger source for the selected DAC channel.
Kojto 122:f9eeca106725 676 * @note For conversion trigger source to be effective, DAC trigger
Kojto 122:f9eeca106725 677 * must be enabled using function @ref LL_DAC_EnableTrigger().
Kojto 122:f9eeca106725 678 * @note Availability of parameters of trigger sources from timer
Kojto 122:f9eeca106725 679 * depends on timers availability on the selected device.
Kojto 122:f9eeca106725 680 * @rmtoll CR TSEL1 LL_DAC_GetTriggerSource\n
Kojto 122:f9eeca106725 681 * CR TSEL2 LL_DAC_GetTriggerSource
Kojto 122:f9eeca106725 682 * @param DACx DAC instance
Kojto 122:f9eeca106725 683 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 684 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 685 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 686 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 687 * @arg @ref LL_DAC_TRIG_SOFTWARE
Kojto 122:f9eeca106725 688 * @arg @ref LL_DAC_TRIG_EXT_TIM2_TRGO
Kojto 122:f9eeca106725 689 * @arg @ref LL_DAC_TRIG_EXT_TIM4_TRGO
Kojto 122:f9eeca106725 690 * @arg @ref LL_DAC_TRIG_EXT_TIM5_TRGO
Kojto 122:f9eeca106725 691 * @arg @ref LL_DAC_TRIG_EXT_TIM6_TRGO
Kojto 122:f9eeca106725 692 * @arg @ref LL_DAC_TRIG_EXT_TIM7_TRGO
Kojto 122:f9eeca106725 693 * @arg @ref LL_DAC_TRIG_EXT_TIM8_TRGO
Kojto 122:f9eeca106725 694 * @arg @ref LL_DAC_TRIGGER_EXT_IT9
Kojto 122:f9eeca106725 695 */
Kojto 122:f9eeca106725 696 __STATIC_INLINE uint32_t LL_DAC_GetTriggerSource(DAC_TypeDef *DACx, uint32_t DAC_Channel)
Kojto 122:f9eeca106725 697 {
Kojto 122:f9eeca106725 698 return (uint32_t)(READ_BIT(DACx->CR, DAC_CR_TSEL1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
Kojto 122:f9eeca106725 699 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
Kojto 122:f9eeca106725 700 );
Kojto 122:f9eeca106725 701 }
Kojto 122:f9eeca106725 702
Kojto 122:f9eeca106725 703 /**
Kojto 122:f9eeca106725 704 * @brief Set the waveform automatic generation mode
Kojto 122:f9eeca106725 705 * for the selected DAC channel.
Kojto 122:f9eeca106725 706 * @rmtoll CR WAVE1 LL_DAC_SetWaveAutoGeneration\n
Kojto 122:f9eeca106725 707 * CR WAVE2 LL_DAC_SetWaveAutoGeneration
Kojto 122:f9eeca106725 708 * @param DACx DAC instance
Kojto 122:f9eeca106725 709 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 710 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 711 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 712 * @param WaveAutoGeneration This parameter can be one of the following values:
Kojto 122:f9eeca106725 713 * @arg @ref LL_DAC_WAVE_AUTO_GENERATION_NONE
Kojto 122:f9eeca106725 714 * @arg @ref LL_DAC_WAVE_AUTO_GENERATION_NOISE
Kojto 122:f9eeca106725 715 * @arg @ref LL_DAC_WAVE_AUTO_GENERATION_TRIANGLE
Kojto 122:f9eeca106725 716 * @retval None
Kojto 122:f9eeca106725 717 */
Kojto 122:f9eeca106725 718 __STATIC_INLINE void LL_DAC_SetWaveAutoGeneration(DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t WaveAutoGeneration)
Kojto 122:f9eeca106725 719 {
Kojto 122:f9eeca106725 720 MODIFY_REG(DACx->CR,
Kojto 122:f9eeca106725 721 DAC_CR_WAVE1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK),
Kojto 122:f9eeca106725 722 WaveAutoGeneration << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
Kojto 122:f9eeca106725 723 }
Kojto 122:f9eeca106725 724
Kojto 122:f9eeca106725 725 /**
Kojto 122:f9eeca106725 726 * @brief Get the waveform automatic generation mode
Kojto 122:f9eeca106725 727 * for the selected DAC channel.
Kojto 122:f9eeca106725 728 * @rmtoll CR WAVE1 LL_DAC_GetWaveAutoGeneration\n
Kojto 122:f9eeca106725 729 * CR WAVE2 LL_DAC_GetWaveAutoGeneration
Kojto 122:f9eeca106725 730 * @param DACx DAC instance
Kojto 122:f9eeca106725 731 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 732 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 733 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 734 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 735 * @arg @ref LL_DAC_WAVE_AUTO_GENERATION_NONE
Kojto 122:f9eeca106725 736 * @arg @ref LL_DAC_WAVE_AUTO_GENERATION_NOISE
Kojto 122:f9eeca106725 737 * @arg @ref LL_DAC_WAVE_AUTO_GENERATION_TRIANGLE
Kojto 122:f9eeca106725 738 */
Kojto 122:f9eeca106725 739 __STATIC_INLINE uint32_t LL_DAC_GetWaveAutoGeneration(DAC_TypeDef *DACx, uint32_t DAC_Channel)
Kojto 122:f9eeca106725 740 {
Kojto 122:f9eeca106725 741 return (uint32_t)(READ_BIT(DACx->CR, DAC_CR_WAVE1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
Kojto 122:f9eeca106725 742 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
Kojto 122:f9eeca106725 743 );
Kojto 122:f9eeca106725 744 }
Kojto 122:f9eeca106725 745
Kojto 122:f9eeca106725 746 /**
Kojto 122:f9eeca106725 747 * @brief Set the noise waveform generation for the selected DAC channel:
Kojto 122:f9eeca106725 748 * Noise mode and parameters LFSR (linear feedback shift register).
Kojto 122:f9eeca106725 749 * @note For wave generation to be effective, DAC channel
Kojto 122:f9eeca106725 750 * wave generation mode must be enabled using
Kojto 122:f9eeca106725 751 * function @ref LL_DAC_SetWaveAutoGeneration().
Kojto 122:f9eeca106725 752 * @note This setting can be set when the selected DAC channel is disabled
Kojto 122:f9eeca106725 753 * (otherwise, the setting operation is ignored).
Kojto 122:f9eeca106725 754 * @rmtoll CR MAMP1 LL_DAC_SetWaveNoiseLFSR\n
Kojto 122:f9eeca106725 755 * CR MAMP2 LL_DAC_SetWaveNoiseLFSR
Kojto 122:f9eeca106725 756 * @param DACx DAC instance
Kojto 122:f9eeca106725 757 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 758 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 759 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 760 * @param NoiseLFSRMask This parameter can be one of the following values:
Kojto 122:f9eeca106725 761 * @arg @ref LL_DAC_NOISE_LFSR_UNMASK_BIT0
Kojto 122:f9eeca106725 762 * @arg @ref LL_DAC_NOISE_LFSR_UNMASK_BITS1_0
Kojto 122:f9eeca106725 763 * @arg @ref LL_DAC_NOISE_LFSR_UNMASK_BITS2_0
Kojto 122:f9eeca106725 764 * @arg @ref LL_DAC_NOISE_LFSR_UNMASK_BITS3_0
Kojto 122:f9eeca106725 765 * @arg @ref LL_DAC_NOISE_LFSR_UNMASK_BITS4_0
Kojto 122:f9eeca106725 766 * @arg @ref LL_DAC_NOISE_LFSR_UNMASK_BITS5_0
Kojto 122:f9eeca106725 767 * @arg @ref LL_DAC_NOISE_LFSR_UNMASK_BITS6_0
Kojto 122:f9eeca106725 768 * @arg @ref LL_DAC_NOISE_LFSR_UNMASK_BITS7_0
Kojto 122:f9eeca106725 769 * @arg @ref LL_DAC_NOISE_LFSR_UNMASK_BITS8_0
Kojto 122:f9eeca106725 770 * @arg @ref LL_DAC_NOISE_LFSR_UNMASK_BITS9_0
Kojto 122:f9eeca106725 771 * @arg @ref LL_DAC_NOISE_LFSR_UNMASK_BITS10_0
Kojto 122:f9eeca106725 772 * @arg @ref LL_DAC_NOISE_LFSR_UNMASK_BITS11_0
Kojto 122:f9eeca106725 773 * @retval None
Kojto 122:f9eeca106725 774 */
Kojto 122:f9eeca106725 775 __STATIC_INLINE void LL_DAC_SetWaveNoiseLFSR(DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t NoiseLFSRMask)
Kojto 122:f9eeca106725 776 {
Kojto 122:f9eeca106725 777 MODIFY_REG(DACx->CR,
Kojto 122:f9eeca106725 778 DAC_CR_MAMP1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK),
Kojto 122:f9eeca106725 779 NoiseLFSRMask << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
Kojto 122:f9eeca106725 780 }
Kojto 122:f9eeca106725 781
Kojto 122:f9eeca106725 782 /**
Kojto 122:f9eeca106725 783 * @brief Set the noise waveform generation for the selected DAC channel:
Kojto 122:f9eeca106725 784 * Noise mode and parameters LFSR (linear feedback shift register).
Kojto 122:f9eeca106725 785 * @rmtoll CR MAMP1 LL_DAC_GetWaveNoiseLFSR\n
Kojto 122:f9eeca106725 786 * CR MAMP2 LL_DAC_GetWaveNoiseLFSR
Kojto 122:f9eeca106725 787 * @param DACx DAC instance
Kojto 122:f9eeca106725 788 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 789 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 790 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 791 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 792 * @arg @ref LL_DAC_NOISE_LFSR_UNMASK_BIT0
Kojto 122:f9eeca106725 793 * @arg @ref LL_DAC_NOISE_LFSR_UNMASK_BITS1_0
Kojto 122:f9eeca106725 794 * @arg @ref LL_DAC_NOISE_LFSR_UNMASK_BITS2_0
Kojto 122:f9eeca106725 795 * @arg @ref LL_DAC_NOISE_LFSR_UNMASK_BITS3_0
Kojto 122:f9eeca106725 796 * @arg @ref LL_DAC_NOISE_LFSR_UNMASK_BITS4_0
Kojto 122:f9eeca106725 797 * @arg @ref LL_DAC_NOISE_LFSR_UNMASK_BITS5_0
Kojto 122:f9eeca106725 798 * @arg @ref LL_DAC_NOISE_LFSR_UNMASK_BITS6_0
Kojto 122:f9eeca106725 799 * @arg @ref LL_DAC_NOISE_LFSR_UNMASK_BITS7_0
Kojto 122:f9eeca106725 800 * @arg @ref LL_DAC_NOISE_LFSR_UNMASK_BITS8_0
Kojto 122:f9eeca106725 801 * @arg @ref LL_DAC_NOISE_LFSR_UNMASK_BITS9_0
Kojto 122:f9eeca106725 802 * @arg @ref LL_DAC_NOISE_LFSR_UNMASK_BITS10_0
Kojto 122:f9eeca106725 803 * @arg @ref LL_DAC_NOISE_LFSR_UNMASK_BITS11_0
Kojto 122:f9eeca106725 804 */
Kojto 122:f9eeca106725 805 __STATIC_INLINE uint32_t LL_DAC_GetWaveNoiseLFSR(DAC_TypeDef *DACx, uint32_t DAC_Channel)
Kojto 122:f9eeca106725 806 {
Kojto 122:f9eeca106725 807 return (uint32_t)(READ_BIT(DACx->CR, DAC_CR_MAMP1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
Kojto 122:f9eeca106725 808 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
Kojto 122:f9eeca106725 809 );
Kojto 122:f9eeca106725 810 }
Kojto 122:f9eeca106725 811
Kojto 122:f9eeca106725 812 /**
Kojto 122:f9eeca106725 813 * @brief Set the triangle waveform generation for the selected DAC channel:
Kojto 122:f9eeca106725 814 * triangle mode and amplitude.
Kojto 122:f9eeca106725 815 * @note For wave generation to be effective, DAC channel
Kojto 122:f9eeca106725 816 * wave generation mode must be enabled using
Kojto 122:f9eeca106725 817 * function @ref LL_DAC_SetWaveAutoGeneration().
Kojto 122:f9eeca106725 818 * @note This setting can be set when the selected DAC channel is disabled
Kojto 122:f9eeca106725 819 * (otherwise, the setting operation is ignored).
Kojto 122:f9eeca106725 820 * @rmtoll CR MAMP1 LL_DAC_SetWaveTriangleAmplitude\n
Kojto 122:f9eeca106725 821 * CR MAMP2 LL_DAC_SetWaveTriangleAmplitude
Kojto 122:f9eeca106725 822 * @param DACx DAC instance
Kojto 122:f9eeca106725 823 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 824 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 825 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 826 * @param TriangleAmplitude This parameter can be one of the following values:
Kojto 122:f9eeca106725 827 * @arg @ref LL_DAC_TRIANGLE_AMPLITUDE_1
Kojto 122:f9eeca106725 828 * @arg @ref LL_DAC_TRIANGLE_AMPLITUDE_3
Kojto 122:f9eeca106725 829 * @arg @ref LL_DAC_TRIANGLE_AMPLITUDE_7
Kojto 122:f9eeca106725 830 * @arg @ref LL_DAC_TRIANGLE_AMPLITUDE_15
Kojto 122:f9eeca106725 831 * @arg @ref LL_DAC_TRIANGLE_AMPLITUDE_31
Kojto 122:f9eeca106725 832 * @arg @ref LL_DAC_TRIANGLE_AMPLITUDE_63
Kojto 122:f9eeca106725 833 * @arg @ref LL_DAC_TRIANGLE_AMPLITUDE_127
Kojto 122:f9eeca106725 834 * @arg @ref LL_DAC_TRIANGLE_AMPLITUDE_255
Kojto 122:f9eeca106725 835 * @arg @ref LL_DAC_TRIANGLE_AMPLITUDE_511
Kojto 122:f9eeca106725 836 * @arg @ref LL_DAC_TRIANGLE_AMPLITUDE_1023
Kojto 122:f9eeca106725 837 * @arg @ref LL_DAC_TRIANGLE_AMPLITUDE_2047
Kojto 122:f9eeca106725 838 * @arg @ref LL_DAC_TRIANGLE_AMPLITUDE_4095
Kojto 122:f9eeca106725 839 * @retval None
Kojto 122:f9eeca106725 840 */
Kojto 122:f9eeca106725 841 __STATIC_INLINE void LL_DAC_SetWaveTriangleAmplitude(DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t TriangleAmplitude)
Kojto 122:f9eeca106725 842 {
Kojto 122:f9eeca106725 843 MODIFY_REG(DACx->CR,
Kojto 122:f9eeca106725 844 DAC_CR_MAMP1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK),
Kojto 122:f9eeca106725 845 TriangleAmplitude << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
Kojto 122:f9eeca106725 846 }
Kojto 122:f9eeca106725 847
Kojto 122:f9eeca106725 848 /**
Kojto 122:f9eeca106725 849 * @brief Set the triangle waveform generation for the selected DAC channel:
Kojto 122:f9eeca106725 850 * triangle mode and amplitude.
Kojto 122:f9eeca106725 851 * @rmtoll CR MAMP1 LL_DAC_GetWaveTriangleAmplitude\n
Kojto 122:f9eeca106725 852 * CR MAMP2 LL_DAC_GetWaveTriangleAmplitude
Kojto 122:f9eeca106725 853 * @param DACx DAC instance
Kojto 122:f9eeca106725 854 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 855 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 856 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 857 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 858 * @arg @ref LL_DAC_TRIANGLE_AMPLITUDE_1
Kojto 122:f9eeca106725 859 * @arg @ref LL_DAC_TRIANGLE_AMPLITUDE_3
Kojto 122:f9eeca106725 860 * @arg @ref LL_DAC_TRIANGLE_AMPLITUDE_7
Kojto 122:f9eeca106725 861 * @arg @ref LL_DAC_TRIANGLE_AMPLITUDE_15
Kojto 122:f9eeca106725 862 * @arg @ref LL_DAC_TRIANGLE_AMPLITUDE_31
Kojto 122:f9eeca106725 863 * @arg @ref LL_DAC_TRIANGLE_AMPLITUDE_63
Kojto 122:f9eeca106725 864 * @arg @ref LL_DAC_TRIANGLE_AMPLITUDE_127
Kojto 122:f9eeca106725 865 * @arg @ref LL_DAC_TRIANGLE_AMPLITUDE_255
Kojto 122:f9eeca106725 866 * @arg @ref LL_DAC_TRIANGLE_AMPLITUDE_511
Kojto 122:f9eeca106725 867 * @arg @ref LL_DAC_TRIANGLE_AMPLITUDE_1023
Kojto 122:f9eeca106725 868 * @arg @ref LL_DAC_TRIANGLE_AMPLITUDE_2047
Kojto 122:f9eeca106725 869 * @arg @ref LL_DAC_TRIANGLE_AMPLITUDE_4095
Kojto 122:f9eeca106725 870 */
Kojto 122:f9eeca106725 871 __STATIC_INLINE uint32_t LL_DAC_GetWaveTriangleAmplitude(DAC_TypeDef *DACx, uint32_t DAC_Channel)
Kojto 122:f9eeca106725 872 {
Kojto 122:f9eeca106725 873 return (uint32_t)(READ_BIT(DACx->CR, DAC_CR_MAMP1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
Kojto 122:f9eeca106725 874 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
Kojto 122:f9eeca106725 875 );
Kojto 122:f9eeca106725 876 }
Kojto 122:f9eeca106725 877
Kojto 122:f9eeca106725 878 /**
Kojto 122:f9eeca106725 879 * @brief Set the output for the selected DAC channel.
Kojto 122:f9eeca106725 880 * @note This function set several features:
Kojto 122:f9eeca106725 881 * - mode normal or sample-and-hold
Kojto 122:f9eeca106725 882 * - buffer
Kojto 122:f9eeca106725 883 * - connection to GPIO or internal path.
Kojto 122:f9eeca106725 884 * These features can also be set individually using
Kojto 122:f9eeca106725 885 * dedicated functions:
Kojto 122:f9eeca106725 886 * - @ref LL_DAC_SetOutputBuffer()
Kojto 122:f9eeca106725 887 * - @ref LL_DAC_SetOutputMode()
Kojto 122:f9eeca106725 888 * - @ref LL_DAC_SetOutputConnection()
Kojto 122:f9eeca106725 889 * @note On this STM32 serie, output connection depends on output mode
Kojto 122:f9eeca106725 890 * (normal or sample and hold) and output buffer state.
Kojto 122:f9eeca106725 891 * - if output connection is set to internal path and output buffer
Kojto 122:f9eeca106725 892 * is enabled (whatever output mode):
Kojto 122:f9eeca106725 893 * output connection is also connected to GPIO pin
Kojto 122:f9eeca106725 894 * (both connections to GPIO pin and internal path).
Kojto 122:f9eeca106725 895 * - if output connection is set to GPIO pin, output buffer
Kojto 122:f9eeca106725 896 * is disabled, output mode set to sample and hold:
Kojto 122:f9eeca106725 897 * output connection is also connected to internal path
Kojto 122:f9eeca106725 898 * (both connections to GPIO pin and internal path).
Kojto 122:f9eeca106725 899 * @note Mode sample-and-hold requires an external capacitor
Kojto 122:f9eeca106725 900 * to be connected between DAC channel output and ground.
Kojto 122:f9eeca106725 901 * Capacitor value depends on load on DAC channel output and
Kojto 122:f9eeca106725 902 * sample-and-hold timings configured.
Kojto 122:f9eeca106725 903 * As indication, capacitor typical value is 100nF
Kojto 122:f9eeca106725 904 * (refer to device datasheet, parameter "CSH").
Kojto 122:f9eeca106725 905 * @rmtoll CR MODE1 LL_DAC_ConfigOutput\n
Kojto 122:f9eeca106725 906 * CR MODE2 LL_DAC_ConfigOutput
Kojto 122:f9eeca106725 907 * @param DACx DAC instance
Kojto 122:f9eeca106725 908 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 909 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 910 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 911 * @param OutputMode This parameter can be one of the following values:
Kojto 122:f9eeca106725 912 * @arg @ref LL_DAC_OUTPUT_MODE_NORMAL
Kojto 122:f9eeca106725 913 * @arg @ref LL_DAC_OUTPUT_MODE_SAMPLE_AND_HOLD
Kojto 122:f9eeca106725 914 * @param OutputBuffer This parameter can be one of the following values:
Kojto 122:f9eeca106725 915 * @arg @ref LL_DAC_OUTPUT_BUFFER_ENABLE
Kojto 122:f9eeca106725 916 * @arg @ref LL_DAC_OUTPUT_BUFFER_DISABLE
Kojto 122:f9eeca106725 917 * @param OutputConnection This parameter can be one of the following values:
Kojto 122:f9eeca106725 918 * @arg @ref LL_DAC_OUTPUT_CONNECT_GPIO
Kojto 122:f9eeca106725 919 * @arg @ref LL_DAC_OUTPUT_CONNECT_INTERNAL
Kojto 122:f9eeca106725 920 * @retval None
Kojto 122:f9eeca106725 921 */
Kojto 122:f9eeca106725 922 __STATIC_INLINE void LL_DAC_ConfigOutput(DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t OutputMode, uint32_t OutputBuffer, uint32_t OutputConnection)
Kojto 122:f9eeca106725 923 {
Kojto 122:f9eeca106725 924 MODIFY_REG(DACx->MCR,
Kojto 122:f9eeca106725 925 (DAC_MCR_MODE1_2 | DAC_MCR_MODE1_1 | DAC_MCR_MODE1_0) << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK),
Kojto 122:f9eeca106725 926 (OutputMode | OutputBuffer | OutputConnection) << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
Kojto 122:f9eeca106725 927 }
Kojto 122:f9eeca106725 928
Kojto 122:f9eeca106725 929 /**
Kojto 122:f9eeca106725 930 * @brief Set the output mode normal or sample-and-hold
Kojto 122:f9eeca106725 931 * for the selected DAC channel.
Kojto 122:f9eeca106725 932 * @note Mode sample-and-hold requires an external capacitor
Kojto 122:f9eeca106725 933 * to be connected between DAC channel output and ground.
Kojto 122:f9eeca106725 934 * Capacitor value depends on load on DAC channel output and
Kojto 122:f9eeca106725 935 * sample-and-hold timings configured.
Kojto 122:f9eeca106725 936 * As indication, capacitor typical value is 100nF
Kojto 122:f9eeca106725 937 * (refer to device datasheet, parameter "CSH").
Kojto 122:f9eeca106725 938 * @rmtoll CR MODE1 LL_DAC_SetOutputMode\n
Kojto 122:f9eeca106725 939 * CR MODE2 LL_DAC_SetOutputMode
Kojto 122:f9eeca106725 940 * @param DACx DAC instance
Kojto 122:f9eeca106725 941 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 942 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 943 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 944 * @param OutputMode This parameter can be one of the following values:
Kojto 122:f9eeca106725 945 * @arg @ref LL_DAC_OUTPUT_MODE_NORMAL
Kojto 122:f9eeca106725 946 * @arg @ref LL_DAC_OUTPUT_MODE_SAMPLE_AND_HOLD
Kojto 122:f9eeca106725 947 * @retval None
Kojto 122:f9eeca106725 948 */
Kojto 122:f9eeca106725 949 __STATIC_INLINE void LL_DAC_SetOutputMode(DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t OutputMode)
Kojto 122:f9eeca106725 950 {
Kojto 122:f9eeca106725 951 MODIFY_REG(DACx->MCR,
Kojto 122:f9eeca106725 952 DAC_MCR_MODE1_2 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK),
Kojto 122:f9eeca106725 953 OutputMode << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
Kojto 122:f9eeca106725 954 }
Kojto 122:f9eeca106725 955
Kojto 122:f9eeca106725 956 /**
Kojto 122:f9eeca106725 957 * @brief Get the output mode normal or sample-and-hold for the selected DAC channel.
Kojto 122:f9eeca106725 958 * @rmtoll CR MODE1 LL_DAC_GetOutputMode\n
Kojto 122:f9eeca106725 959 * CR MODE2 LL_DAC_GetOutputMode
Kojto 122:f9eeca106725 960 * @param DACx DAC instance
Kojto 122:f9eeca106725 961 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 962 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 963 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 964 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 965 * @arg @ref LL_DAC_OUTPUT_MODE_NORMAL
Kojto 122:f9eeca106725 966 * @arg @ref LL_DAC_OUTPUT_MODE_SAMPLE_AND_HOLD
Kojto 122:f9eeca106725 967 */
Kojto 122:f9eeca106725 968 __STATIC_INLINE uint32_t LL_DAC_GetOutputMode(DAC_TypeDef *DACx, uint32_t DAC_Channel)
Kojto 122:f9eeca106725 969 {
Kojto 122:f9eeca106725 970 return (uint32_t)(READ_BIT(DACx->MCR, DAC_MCR_MODE1_2 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
Kojto 122:f9eeca106725 971 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
Kojto 122:f9eeca106725 972 );
Kojto 122:f9eeca106725 973 }
Kojto 122:f9eeca106725 974
Kojto 122:f9eeca106725 975 /**
Kojto 122:f9eeca106725 976 * @brief Set the output buffer for the selected DAC channel.
Kojto 122:f9eeca106725 977 * @note On this STM32 serie, when buffer is enabled, its offset can be
Kojto 122:f9eeca106725 978 * trimmed: factory calibration default values can be
Kojto 122:f9eeca106725 979 * replaced by user trimming values, using function
Kojto 122:f9eeca106725 980 * @ref LL_DAC_SetTrimmingValue().
Kojto 122:f9eeca106725 981 * @rmtoll CR MODE1 LL_DAC_SetOutputBuffer\n
Kojto 122:f9eeca106725 982 * CR MODE2 LL_DAC_SetOutputBuffer
Kojto 122:f9eeca106725 983 * @param DACx DAC instance
Kojto 122:f9eeca106725 984 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 985 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 986 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 987 * @param OutputBuffer This parameter can be one of the following values:
Kojto 122:f9eeca106725 988 * @arg @ref LL_DAC_OUTPUT_BUFFER_ENABLE
Kojto 122:f9eeca106725 989 * @arg @ref LL_DAC_OUTPUT_BUFFER_DISABLE
Kojto 122:f9eeca106725 990 * @retval None
Kojto 122:f9eeca106725 991 */
Kojto 122:f9eeca106725 992 __STATIC_INLINE void LL_DAC_SetOutputBuffer(DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t OutputBuffer)
Kojto 122:f9eeca106725 993 {
Kojto 122:f9eeca106725 994 MODIFY_REG(DACx->MCR,
Kojto 122:f9eeca106725 995 DAC_MCR_MODE1_1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK),
Kojto 122:f9eeca106725 996 OutputBuffer << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
Kojto 122:f9eeca106725 997 }
Kojto 122:f9eeca106725 998
Kojto 122:f9eeca106725 999 /**
Kojto 122:f9eeca106725 1000 * @brief Get the output buffer state for the selected DAC channel.
Kojto 122:f9eeca106725 1001 * @rmtoll CR MODE1 LL_DAC_GetOutputBuffer\n
Kojto 122:f9eeca106725 1002 * CR MODE2 LL_DAC_GetOutputBuffer
Kojto 122:f9eeca106725 1003 * @param DACx DAC instance
Kojto 122:f9eeca106725 1004 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 1005 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 1006 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 1007 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 1008 * @arg @ref LL_DAC_OUTPUT_BUFFER_ENABLE
Kojto 122:f9eeca106725 1009 * @arg @ref LL_DAC_OUTPUT_BUFFER_DISABLE
Kojto 122:f9eeca106725 1010 */
Kojto 122:f9eeca106725 1011 __STATIC_INLINE uint32_t LL_DAC_GetOutputBuffer(DAC_TypeDef *DACx, uint32_t DAC_Channel)
Kojto 122:f9eeca106725 1012 {
Kojto 122:f9eeca106725 1013 return (uint32_t)(READ_BIT(DACx->MCR, DAC_MCR_MODE1_1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
Kojto 122:f9eeca106725 1014 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
Kojto 122:f9eeca106725 1015 );
Kojto 122:f9eeca106725 1016 }
Kojto 122:f9eeca106725 1017
Kojto 122:f9eeca106725 1018 /**
Kojto 122:f9eeca106725 1019 * @brief Set the output connection for the selected DAC channel.
Kojto 122:f9eeca106725 1020 * @note On this STM32 serie, output connection depends on output mode (normal or
Kojto 122:f9eeca106725 1021 * sample and hold) and output buffer state.
Kojto 122:f9eeca106725 1022 * - if output connection is set to internal path and output buffer
Kojto 122:f9eeca106725 1023 * is enabled (whatever output mode):
Kojto 122:f9eeca106725 1024 * output connection is also connected to GPIO pin
Kojto 122:f9eeca106725 1025 * (both connections to GPIO pin and internal path).
Kojto 122:f9eeca106725 1026 * - if output connection is set to GPIO pin, output buffer
Kojto 122:f9eeca106725 1027 * is disabled, output mode set to sample and hold:
Kojto 122:f9eeca106725 1028 * output connection is also connected to internal path
Kojto 122:f9eeca106725 1029 * (both connections to GPIO pin and internal path).
Kojto 122:f9eeca106725 1030 * @rmtoll CR MODE1 LL_DAC_SetOutputConnection\n
Kojto 122:f9eeca106725 1031 * CR MODE2 LL_DAC_SetOutputConnection
Kojto 122:f9eeca106725 1032 * @param DACx DAC instance
Kojto 122:f9eeca106725 1033 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 1034 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 1035 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 1036 * @param OutputConnection This parameter can be one of the following values:
Kojto 122:f9eeca106725 1037 * @arg @ref LL_DAC_OUTPUT_CONNECT_GPIO
Kojto 122:f9eeca106725 1038 * @arg @ref LL_DAC_OUTPUT_CONNECT_INTERNAL
Kojto 122:f9eeca106725 1039 * @retval None
Kojto 122:f9eeca106725 1040 */
Kojto 122:f9eeca106725 1041 __STATIC_INLINE void LL_DAC_SetOutputConnection(DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t OutputConnection)
Kojto 122:f9eeca106725 1042 {
Kojto 122:f9eeca106725 1043 MODIFY_REG(DACx->MCR,
Kojto 122:f9eeca106725 1044 DAC_MCR_MODE1_0 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK),
Kojto 122:f9eeca106725 1045 OutputConnection << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
Kojto 122:f9eeca106725 1046 }
Kojto 122:f9eeca106725 1047
Kojto 122:f9eeca106725 1048 /**
Kojto 122:f9eeca106725 1049 * @brief Get the output connection for the selected DAC channel.
Kojto 122:f9eeca106725 1050 * @note On this STM32 serie, output connection depends on output mode (normal or
Kojto 122:f9eeca106725 1051 * sample and hold) and output buffer state.
Kojto 122:f9eeca106725 1052 * - if output connection is set to internal path and output buffer
Kojto 122:f9eeca106725 1053 * is enabled (whatever output mode):
Kojto 122:f9eeca106725 1054 * output connection is also connected to GPIO pin
Kojto 122:f9eeca106725 1055 * (both connections to GPIO pin and internal path).
Kojto 122:f9eeca106725 1056 * - if output connection is set to GPIO pin, output buffer
Kojto 122:f9eeca106725 1057 * is disabled, output mode set to sample and hold:
Kojto 122:f9eeca106725 1058 * output connection is also connected to internal path
Kojto 122:f9eeca106725 1059 * (both connections to GPIO pin and internal path).
Kojto 122:f9eeca106725 1060 * @rmtoll CR MODE1 LL_DAC_GetOutputConnection\n
Kojto 122:f9eeca106725 1061 * CR MODE2 LL_DAC_GetOutputConnection
Kojto 122:f9eeca106725 1062 * @param DACx DAC instance
Kojto 122:f9eeca106725 1063 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 1064 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 1065 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 1066 * @retval Returned value can be one of the following values:
Kojto 122:f9eeca106725 1067 * @arg @ref LL_DAC_OUTPUT_CONNECT_GPIO
Kojto 122:f9eeca106725 1068 * @arg @ref LL_DAC_OUTPUT_CONNECT_INTERNAL
Kojto 122:f9eeca106725 1069 */
Kojto 122:f9eeca106725 1070 __STATIC_INLINE uint32_t LL_DAC_GetOutputConnection(DAC_TypeDef *DACx, uint32_t DAC_Channel)
Kojto 122:f9eeca106725 1071 {
Kojto 122:f9eeca106725 1072 return (uint32_t)(READ_BIT(DACx->MCR, DAC_MCR_MODE1_0 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
Kojto 122:f9eeca106725 1073 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
Kojto 122:f9eeca106725 1074 );
Kojto 122:f9eeca106725 1075 }
Kojto 122:f9eeca106725 1076
Kojto 122:f9eeca106725 1077 /**
Kojto 122:f9eeca106725 1078 * @brief Set the sample-and-hold timing for the selected DAC channel:
Kojto 122:f9eeca106725 1079 * sample time
Kojto 122:f9eeca106725 1080 * @note Sample time must be set when DAC channel is disabled
Kojto 122:f9eeca106725 1081 * or during DAC operation when DAC channel flag BWSTx is reset,
Kojto 122:f9eeca106725 1082 * otherwise the setting is ignored.
Kojto 122:f9eeca106725 1083 * Check BWSTx flag state using function "LL_DAC_IsActiveFlag_BWSTx()".
Kojto 122:f9eeca106725 1084 * @rmtoll SHSR1 TSAMPLE1 LL_DAC_SetSampleAndHoldSampleTime\n
Kojto 122:f9eeca106725 1085 * SHSR2 TSAMPLE2 LL_DAC_SetSampleAndHoldSampleTime
Kojto 122:f9eeca106725 1086 * @param DACx DAC instance
Kojto 122:f9eeca106725 1087 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 1088 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 1089 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 1090 * @param SampleTime Value between Min_Data=0x000 and Max_Data=0x3FF
Kojto 122:f9eeca106725 1091 * @retval None
Kojto 122:f9eeca106725 1092 */
Kojto 122:f9eeca106725 1093 __STATIC_INLINE void LL_DAC_SetSampleAndHoldSampleTime(DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t SampleTime)
Kojto 122:f9eeca106725 1094 {
Kojto 122:f9eeca106725 1095 register uint32_t *preg = __DAC_PTR_REG_OFFSET(DACx->SHSR1, __DAC_MASK_SHIFT(DAC_Channel, DAC_REG_SHSRX_REGOFFSET_MASK));
Kojto 122:f9eeca106725 1096
Kojto 122:f9eeca106725 1097 MODIFY_REG(*preg,
Kojto 122:f9eeca106725 1098 DAC_SHSR1_TSAMPLE1,
Kojto 122:f9eeca106725 1099 SampleTime);
Kojto 122:f9eeca106725 1100 }
Kojto 122:f9eeca106725 1101
Kojto 122:f9eeca106725 1102 /**
Kojto 122:f9eeca106725 1103 * @brief Get the sample-and-hold timing for the selected DAC channel:
Kojto 122:f9eeca106725 1104 * sample time
Kojto 122:f9eeca106725 1105 * @rmtoll SHSR1 TSAMPLE1 LL_DAC_GetSampleAndHoldSampleTime\n
Kojto 122:f9eeca106725 1106 * SHSR2 TSAMPLE2 LL_DAC_GetSampleAndHoldSampleTime
Kojto 122:f9eeca106725 1107 * @param DACx DAC instance
Kojto 122:f9eeca106725 1108 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 1109 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 1110 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 1111 * @retval Value between Min_Data=0x000 and Max_Data=0x3FF
Kojto 122:f9eeca106725 1112 */
Kojto 122:f9eeca106725 1113 __STATIC_INLINE uint32_t LL_DAC_GetSampleAndHoldSampleTime(DAC_TypeDef *DACx, uint32_t DAC_Channel)
Kojto 122:f9eeca106725 1114 {
Kojto 122:f9eeca106725 1115 register uint32_t *preg = __DAC_PTR_REG_OFFSET(DACx->SHSR1, __DAC_MASK_SHIFT(DAC_Channel, DAC_REG_SHSRX_REGOFFSET_MASK));
Kojto 122:f9eeca106725 1116
Kojto 122:f9eeca106725 1117 return (uint32_t) READ_BIT(*preg, DAC_SHSR1_TSAMPLE1);
Kojto 122:f9eeca106725 1118 }
Kojto 122:f9eeca106725 1119
Kojto 122:f9eeca106725 1120 /**
Kojto 122:f9eeca106725 1121 * @brief Set the sample-and-hold timing for the selected DAC channel:
Kojto 122:f9eeca106725 1122 * hold time
Kojto 122:f9eeca106725 1123 * @rmtoll SHHR THOLD1 LL_DAC_SetSampleAndHoldHoldTime\n
Kojto 122:f9eeca106725 1124 * SHHR THOLD2 LL_DAC_SetSampleAndHoldHoldTime
Kojto 122:f9eeca106725 1125 * @param DACx DAC instance
Kojto 122:f9eeca106725 1126 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 1127 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 1128 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 1129 * @param HoldTime Value between Min_Data=0x000 and Max_Data=0x3FF
Kojto 122:f9eeca106725 1130 * @retval None
Kojto 122:f9eeca106725 1131 */
Kojto 122:f9eeca106725 1132 __STATIC_INLINE void LL_DAC_SetSampleAndHoldHoldTime(DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t HoldTime)
Kojto 122:f9eeca106725 1133 {
Kojto 122:f9eeca106725 1134 MODIFY_REG(DACx->SHHR,
Kojto 122:f9eeca106725 1135 DAC_SHHR_THOLD1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK),
Kojto 122:f9eeca106725 1136 HoldTime << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
Kojto 122:f9eeca106725 1137 }
Kojto 122:f9eeca106725 1138
Kojto 122:f9eeca106725 1139 /**
Kojto 122:f9eeca106725 1140 * @brief Get the sample-and-hold timing for the selected DAC channel:
Kojto 122:f9eeca106725 1141 * hold time
Kojto 122:f9eeca106725 1142 * @rmtoll SHHR THOLD1 LL_DAC_GetSampleAndHoldHoldTime\n
Kojto 122:f9eeca106725 1143 * SHHR THOLD2 LL_DAC_GetSampleAndHoldHoldTime
Kojto 122:f9eeca106725 1144 * @param DACx DAC instance
Kojto 122:f9eeca106725 1145 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 1146 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 1147 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 1148 * @retval Value between Min_Data=0x000 and Max_Data=0x3FF
Kojto 122:f9eeca106725 1149 */
Kojto 122:f9eeca106725 1150 __STATIC_INLINE uint32_t LL_DAC_GetSampleAndHoldHoldTime(DAC_TypeDef *DACx, uint32_t DAC_Channel)
Kojto 122:f9eeca106725 1151 {
Kojto 122:f9eeca106725 1152 return (uint32_t)(READ_BIT(DACx->SHHR, DAC_SHHR_THOLD1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
Kojto 122:f9eeca106725 1153 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
Kojto 122:f9eeca106725 1154 );
Kojto 122:f9eeca106725 1155 }
Kojto 122:f9eeca106725 1156
Kojto 122:f9eeca106725 1157 /**
Kojto 122:f9eeca106725 1158 * @brief Set the sample-and-hold timing for the selected DAC channel:
Kojto 122:f9eeca106725 1159 * refresh time
Kojto 122:f9eeca106725 1160 * @rmtoll SHRR TREFRESH1 LL_DAC_SetSampleAndHoldRefreshTime\n
Kojto 122:f9eeca106725 1161 * SHRR TREFRESH2 LL_DAC_SetSampleAndHoldRefreshTime
Kojto 122:f9eeca106725 1162 * @param DACx DAC instance
Kojto 122:f9eeca106725 1163 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 1164 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 1165 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 1166 * @param RefreshTime Value between Min_Data=0x00 and Max_Data=0xFF
Kojto 122:f9eeca106725 1167 * @retval None
Kojto 122:f9eeca106725 1168 */
Kojto 122:f9eeca106725 1169 __STATIC_INLINE void LL_DAC_SetSampleAndHoldRefreshTime(DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t RefreshTime)
Kojto 122:f9eeca106725 1170 {
Kojto 122:f9eeca106725 1171 MODIFY_REG(DACx->SHRR,
Kojto 122:f9eeca106725 1172 DAC_SHRR_TREFRESH1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK),
Kojto 122:f9eeca106725 1173 RefreshTime << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
Kojto 122:f9eeca106725 1174 }
Kojto 122:f9eeca106725 1175
Kojto 122:f9eeca106725 1176 /**
Kojto 122:f9eeca106725 1177 * @brief Get the sample-and-hold timing for the selected DAC channel:
Kojto 122:f9eeca106725 1178 * refresh time
Kojto 122:f9eeca106725 1179 * @rmtoll SHRR TREFRESH1 LL_DAC_GetSampleAndHoldRefreshTime\n
Kojto 122:f9eeca106725 1180 * SHRR TREFRESH2 LL_DAC_GetSampleAndHoldRefreshTime
Kojto 122:f9eeca106725 1181 * @param DACx DAC instance
Kojto 122:f9eeca106725 1182 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 1183 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 1184 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 1185 * @retval Value between Min_Data=0x00 and Max_Data=0xFF
Kojto 122:f9eeca106725 1186 */
Kojto 122:f9eeca106725 1187 __STATIC_INLINE uint32_t LL_DAC_GetSampleAndHoldRefreshTime(DAC_TypeDef *DACx, uint32_t DAC_Channel)
Kojto 122:f9eeca106725 1188 {
Kojto 122:f9eeca106725 1189 return (uint32_t)(READ_BIT(DACx->SHRR, DAC_SHRR_TREFRESH1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
Kojto 122:f9eeca106725 1190 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
Kojto 122:f9eeca106725 1191 );
Kojto 122:f9eeca106725 1192 }
Kojto 122:f9eeca106725 1193
Kojto 122:f9eeca106725 1194 /**
Kojto 122:f9eeca106725 1195 * @}
Kojto 122:f9eeca106725 1196 */
Kojto 122:f9eeca106725 1197
Kojto 122:f9eeca106725 1198 /** @defgroup DAC_LL_EF_Configuration_Legacy_Functions DAC configuration, legacy functions name
Kojto 122:f9eeca106725 1199 * @{
Kojto 122:f9eeca106725 1200 */
Kojto 122:f9eeca106725 1201 /* Old functions name kept for legacy purpose, to be replaced by the */
Kojto 122:f9eeca106725 1202 /* current functions name. */
Kojto 122:f9eeca106725 1203 __STATIC_INLINE void LL_DAC_SetWaveMode(DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t WaveMode)
Kojto 122:f9eeca106725 1204 {
Kojto 122:f9eeca106725 1205 LL_DAC_SetWaveAutoGeneration(DACx, DAC_Channel, WaveMode);
Kojto 122:f9eeca106725 1206 }
Kojto 122:f9eeca106725 1207 __STATIC_INLINE uint32_t LL_DAC_GetWaveMode(DAC_TypeDef *DACx, uint32_t DAC_Channel)
Kojto 122:f9eeca106725 1208 {
Kojto 122:f9eeca106725 1209 return LL_DAC_GetWaveAutoGeneration(DACx, DAC_Channel);
Kojto 122:f9eeca106725 1210 }
Kojto 122:f9eeca106725 1211
Kojto 122:f9eeca106725 1212 /**
Kojto 122:f9eeca106725 1213 * @}
Kojto 122:f9eeca106725 1214 */
Kojto 122:f9eeca106725 1215
Kojto 122:f9eeca106725 1216 /** @defgroup DAC_LL_EF_DMA_Management DMA Management
Kojto 122:f9eeca106725 1217 * @{
Kojto 122:f9eeca106725 1218 */
Kojto 122:f9eeca106725 1219
Kojto 122:f9eeca106725 1220 /**
Kojto 122:f9eeca106725 1221 * @brief Enable DAC DMA transfer request of the selected channel.
Kojto 122:f9eeca106725 1222 * @note To configure DMA source address (peripheral address),
Kojto 122:f9eeca106725 1223 * use function @ref LL_DAC_DMA_GetRegAddr().
Kojto 122:f9eeca106725 1224 * @rmtoll CR DMAEN1 LL_DAC_EnableDMAReq\n
Kojto 122:f9eeca106725 1225 * CR DMAEN2 LL_DAC_EnableDMAReq
Kojto 122:f9eeca106725 1226 * @param DACx DAC instance
Kojto 122:f9eeca106725 1227 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 1228 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 1229 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 1230 * @retval None
Kojto 122:f9eeca106725 1231 */
Kojto 122:f9eeca106725 1232 __STATIC_INLINE void LL_DAC_EnableDMAReq(DAC_TypeDef *DACx, uint32_t DAC_Channel)
Kojto 122:f9eeca106725 1233 {
Kojto 122:f9eeca106725 1234 SET_BIT(DACx->CR,
Kojto 122:f9eeca106725 1235 DAC_CR_DMAEN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
Kojto 122:f9eeca106725 1236 }
Kojto 122:f9eeca106725 1237
Kojto 122:f9eeca106725 1238 /**
Kojto 122:f9eeca106725 1239 * @brief Disable DAC DMA transfer request of the selected channel.
Kojto 122:f9eeca106725 1240 * @note To configure DMA source address (peripheral address),
Kojto 122:f9eeca106725 1241 * use function @ref LL_DAC_DMA_GetRegAddr().
Kojto 122:f9eeca106725 1242 * @rmtoll CR DMAEN1 LL_DAC_DisableDMAReq\n
Kojto 122:f9eeca106725 1243 * CR DMAEN2 LL_DAC_DisableDMAReq
Kojto 122:f9eeca106725 1244 * @param DACx DAC instance
Kojto 122:f9eeca106725 1245 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 1246 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 1247 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 1248 * @retval None
Kojto 122:f9eeca106725 1249 */
Kojto 122:f9eeca106725 1250 __STATIC_INLINE void LL_DAC_DisableDMAReq(DAC_TypeDef *DACx, uint32_t DAC_Channel)
Kojto 122:f9eeca106725 1251 {
Kojto 122:f9eeca106725 1252 CLEAR_BIT(DACx->CR,
Kojto 122:f9eeca106725 1253 DAC_CR_DMAEN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
Kojto 122:f9eeca106725 1254 }
Kojto 122:f9eeca106725 1255
Kojto 122:f9eeca106725 1256 /**
Kojto 122:f9eeca106725 1257 * @brief Get DAC DMA transfer request state of the selected channel.
Kojto 122:f9eeca106725 1258 * (0: DAC DMA transfer request is disabled, 1: DAC DMA transfer request is enabled)
Kojto 122:f9eeca106725 1259 * @rmtoll CR DMAEN1 LL_DAC_IsDMAReqEnabled\n
Kojto 122:f9eeca106725 1260 * CR DMAEN2 LL_DAC_IsDMAReqEnabled
Kojto 122:f9eeca106725 1261 * @param DACx DAC instance
Kojto 122:f9eeca106725 1262 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 1263 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 1264 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 1265 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 1266 */
Kojto 122:f9eeca106725 1267 __STATIC_INLINE uint32_t LL_DAC_IsDMAReqEnabled(DAC_TypeDef *DACx, uint32_t DAC_Channel)
Kojto 122:f9eeca106725 1268 {
Kojto 122:f9eeca106725 1269 return (READ_BIT(DACx->CR,
Kojto 122:f9eeca106725 1270 DAC_CR_DMAEN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
Kojto 122:f9eeca106725 1271 == (DAC_CR_DMAEN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)));
Kojto 122:f9eeca106725 1272 }
Kojto 122:f9eeca106725 1273
Kojto 122:f9eeca106725 1274 /**
Kojto 122:f9eeca106725 1275 * @brief Function to help to configure DMA transfer to DAC: retrieve the
Kojto 122:f9eeca106725 1276 * DAC register address from DAC instance and a list of DAC registers
Kojto 122:f9eeca106725 1277 * intended to be used (most commonly) with DMA transfer.
Kojto 122:f9eeca106725 1278 * @note These DAC registers are data holding registers:
Kojto 122:f9eeca106725 1279 * when DAC conversion is requested, DAC generates a DMA transfer
Kojto 122:f9eeca106725 1280 * request to have data available in DAC data holding registers.
Kojto 122:f9eeca106725 1281 * @note This macro is intended to be used with LL DMA driver, refer to
Kojto 122:f9eeca106725 1282 * function "LL_DMA_ConfigAddresses()".
Kojto 122:f9eeca106725 1283 * Example:
Kojto 122:f9eeca106725 1284 * LL_DMA_ConfigAddresses(DMA1,
Kojto 122:f9eeca106725 1285 * LL_DMA_CHANNEL_1,
Kojto 122:f9eeca106725 1286 * (uint32_t)&< array or variable >,
Kojto 122:f9eeca106725 1287 * LL_DAC_DMA_GetRegAddr(DAC1, LL_DAC_CHANNEL_1, LL_DAC_DMA_REG_DATA_12BITS_RIGHT_ALIGNED),
Kojto 122:f9eeca106725 1288 * LL_DMA_DIRECTION_MEMORY_TO_PERIPH);
Kojto 122:f9eeca106725 1289 * @rmtoll DHR12R1 DACC1DHR LL_DAC_DMA_GetRegAddr\n
Kojto 122:f9eeca106725 1290 * DHR12L1 DACC1DHR LL_DAC_DMA_GetRegAddr\n
Kojto 122:f9eeca106725 1291 * DHR8R1 DACC1DHR LL_DAC_DMA_GetRegAddr\n
Kojto 122:f9eeca106725 1292 * DHR12R2 DACC2DHR LL_DAC_DMA_GetRegAddr\n
Kojto 122:f9eeca106725 1293 * DHR12L2 DACC2DHR LL_DAC_DMA_GetRegAddr\n
Kojto 122:f9eeca106725 1294 * DHR8R2 DACC2DHR LL_DAC_DMA_GetRegAddr
Kojto 122:f9eeca106725 1295 * @param DACx DAC instance
Kojto 122:f9eeca106725 1296 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 1297 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 1298 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 1299 * @param Register This parameter can be one of the following values:
Kojto 122:f9eeca106725 1300 * @arg @ref LL_DAC_DMA_REG_DATA_12BITS_RIGHT_ALIGNED
Kojto 122:f9eeca106725 1301 * @arg @ref LL_DAC_DMA_REG_DATA_12BITS_LEFT_ALIGNED
Kojto 122:f9eeca106725 1302 * @arg @ref LL_DAC_DMA_REG_DATA_8BITS_RIGHT_ALIGNED
Kojto 122:f9eeca106725 1303 * @retval DAC register address
Kojto 122:f9eeca106725 1304 */
Kojto 122:f9eeca106725 1305 __STATIC_INLINE uint32_t LL_DAC_DMA_GetRegAddr(DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t Register)
Kojto 122:f9eeca106725 1306 {
Kojto 122:f9eeca106725 1307 /* Retrieve address of register DHR12Rx, DHR12Lx or DHR8Rx depending on */
Kojto 122:f9eeca106725 1308 /* DAC channel selected. */
Kojto 122:f9eeca106725 1309 return ((uint32_t)(__DAC_PTR_REG_OFFSET((DACx)->DHR12R1, __DAC_MASK_SHIFT(DAC_Channel, Register))));
Kojto 122:f9eeca106725 1310 }
Kojto 122:f9eeca106725 1311 /**
Kojto 122:f9eeca106725 1312 * @}
Kojto 122:f9eeca106725 1313 */
Kojto 122:f9eeca106725 1314
Kojto 122:f9eeca106725 1315 /** @defgroup DAC_LL_EF_Operation Operation on DAC channels
Kojto 122:f9eeca106725 1316 * @{
Kojto 122:f9eeca106725 1317 */
Kojto 122:f9eeca106725 1318
Kojto 122:f9eeca106725 1319 /**
Kojto 122:f9eeca106725 1320 * @brief Enable DAC selected channel.
Kojto 122:f9eeca106725 1321 * @rmtoll CR EN1 LL_DAC_Enable\n
Kojto 122:f9eeca106725 1322 * CR EN2 LL_DAC_Enable
Kojto 122:f9eeca106725 1323 * @note After enable from off state, DAC channel requires a delay
Kojto 122:f9eeca106725 1324 * for output voltage to reach accuracy +/- 1 LSB.
Kojto 122:f9eeca106725 1325 * Refer to device datasheet, parameter "tWAKEUP".
Kojto 122:f9eeca106725 1326 * @param DACx DAC instance
Kojto 122:f9eeca106725 1327 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 1328 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 1329 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 1330 * @retval None
Kojto 122:f9eeca106725 1331 */
Kojto 122:f9eeca106725 1332 __STATIC_INLINE void LL_DAC_Enable(DAC_TypeDef *DACx, uint32_t DAC_Channel)
Kojto 122:f9eeca106725 1333 {
Kojto 122:f9eeca106725 1334 SET_BIT(DACx->CR,
Kojto 122:f9eeca106725 1335 DAC_CR_EN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
Kojto 122:f9eeca106725 1336 }
Kojto 122:f9eeca106725 1337
Kojto 122:f9eeca106725 1338 /**
Kojto 122:f9eeca106725 1339 * @brief Disable DAC selected channel.
Kojto 122:f9eeca106725 1340 * @rmtoll CR EN1 LL_DAC_Disable\n
Kojto 122:f9eeca106725 1341 * CR EN2 LL_DAC_Disable
Kojto 122:f9eeca106725 1342 * @param DACx DAC instance
Kojto 122:f9eeca106725 1343 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 1344 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 1345 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 1346 * @retval None
Kojto 122:f9eeca106725 1347 */
Kojto 122:f9eeca106725 1348 __STATIC_INLINE void LL_DAC_Disable(DAC_TypeDef *DACx, uint32_t DAC_Channel)
Kojto 122:f9eeca106725 1349 {
Kojto 122:f9eeca106725 1350 CLEAR_BIT(DACx->CR,
Kojto 122:f9eeca106725 1351 DAC_CR_EN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
Kojto 122:f9eeca106725 1352 }
Kojto 122:f9eeca106725 1353
Kojto 122:f9eeca106725 1354 /**
Kojto 122:f9eeca106725 1355 * @brief Get DAC enable state of the selected channel.
Kojto 122:f9eeca106725 1356 * (0: DAC channel is disabled, 1: DAC channel is enabled)
Kojto 122:f9eeca106725 1357 * @rmtoll CR EN1 LL_DAC_IsEnabled\n
Kojto 122:f9eeca106725 1358 * CR EN2 LL_DAC_IsEnabled
Kojto 122:f9eeca106725 1359 * @param DACx DAC instance
Kojto 122:f9eeca106725 1360 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 1361 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 1362 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 1363 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 1364 */
Kojto 122:f9eeca106725 1365 __STATIC_INLINE uint32_t LL_DAC_IsEnabled(DAC_TypeDef *DACx, uint32_t DAC_Channel)
Kojto 122:f9eeca106725 1366 {
Kojto 122:f9eeca106725 1367 return (READ_BIT(DACx->CR,
Kojto 122:f9eeca106725 1368 DAC_CR_EN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
Kojto 122:f9eeca106725 1369 == (DAC_CR_EN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)));
Kojto 122:f9eeca106725 1370 }
Kojto 122:f9eeca106725 1371
Kojto 122:f9eeca106725 1372 /**
Kojto 122:f9eeca106725 1373 * @brief Enable DAC trigger of the selected channel.
Kojto 122:f9eeca106725 1374 * @note - If DAC trigger is disabled, DAC conversion is performed
Kojto 122:f9eeca106725 1375 * automatically once the data holding register is updated,
Kojto 122:f9eeca106725 1376 * using functions "LL_DAC_ConvertData{8; 12}{Right; Left} Aligned()":
Kojto 122:f9eeca106725 1377 * @ref LL_DAC_ConvertData12RightAligned(), ...
Kojto 122:f9eeca106725 1378 * - If DAC trigger is enabled, DAC conversion is performed
Kojto 122:f9eeca106725 1379 * only when a hardware of software trigger event is occurring.
Kojto 122:f9eeca106725 1380 * Select trigger source using
Kojto 122:f9eeca106725 1381 * function @ref LL_DAC_SetTriggerSource().
Kojto 122:f9eeca106725 1382 * @rmtoll CR TEN1 LL_DAC_EnableTrigger\n
Kojto 122:f9eeca106725 1383 * CR TEN2 LL_DAC_EnableTrigger
Kojto 122:f9eeca106725 1384 * @param DACx DAC instance
Kojto 122:f9eeca106725 1385 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 1386 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 1387 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 1388 * @retval None
Kojto 122:f9eeca106725 1389 */
Kojto 122:f9eeca106725 1390 __STATIC_INLINE void LL_DAC_EnableTrigger(DAC_TypeDef *DACx, uint32_t DAC_Channel)
Kojto 122:f9eeca106725 1391 {
Kojto 122:f9eeca106725 1392 SET_BIT(DACx->CR,
Kojto 122:f9eeca106725 1393 DAC_CR_TEN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
Kojto 122:f9eeca106725 1394 }
Kojto 122:f9eeca106725 1395
Kojto 122:f9eeca106725 1396 /**
Kojto 122:f9eeca106725 1397 * @brief Disable DAC trigger of the selected channel.
Kojto 122:f9eeca106725 1398 * @rmtoll CR TEN1 LL_DAC_DisableTrigger\n
Kojto 122:f9eeca106725 1399 * CR TEN2 LL_DAC_DisableTrigger
Kojto 122:f9eeca106725 1400 * @param DACx DAC instance
Kojto 122:f9eeca106725 1401 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 1402 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 1403 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 1404 * @retval None
Kojto 122:f9eeca106725 1405 */
Kojto 122:f9eeca106725 1406 __STATIC_INLINE void LL_DAC_DisableTrigger(DAC_TypeDef *DACx, uint32_t DAC_Channel)
Kojto 122:f9eeca106725 1407 {
Kojto 122:f9eeca106725 1408 CLEAR_BIT(DACx->CR,
Kojto 122:f9eeca106725 1409 DAC_CR_TEN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
Kojto 122:f9eeca106725 1410 }
Kojto 122:f9eeca106725 1411
Kojto 122:f9eeca106725 1412 /**
Kojto 122:f9eeca106725 1413 * @brief Get DAC trigger state of the selected channel.
Kojto 122:f9eeca106725 1414 * (0: DAC trigger is disabled, 1: DAC trigger is enabled)
Kojto 122:f9eeca106725 1415 * @rmtoll CR TEN1 LL_DAC_IsTriggerEnabled\n
Kojto 122:f9eeca106725 1416 * CR TEN2 LL_DAC_IsTriggerEnabled
Kojto 122:f9eeca106725 1417 * @param DACx DAC instance
Kojto 122:f9eeca106725 1418 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 1419 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 1420 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 1421 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 1422 */
Kojto 122:f9eeca106725 1423 __STATIC_INLINE uint32_t LL_DAC_IsTriggerEnabled(DAC_TypeDef *DACx, uint32_t DAC_Channel)
Kojto 122:f9eeca106725 1424 {
Kojto 122:f9eeca106725 1425 return (READ_BIT(DACx->CR,
Kojto 122:f9eeca106725 1426 DAC_CR_TEN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
Kojto 122:f9eeca106725 1427 == (DAC_CR_TEN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)));
Kojto 122:f9eeca106725 1428 }
Kojto 122:f9eeca106725 1429
Kojto 122:f9eeca106725 1430 /**
Kojto 122:f9eeca106725 1431 * @brief Trig DAC conversion by software for the selected DAC channel.
Kojto 122:f9eeca106725 1432 * @note Preliminarily, DAC trigger must be set to software trigger
Kojto 122:f9eeca106725 1433 * using function @ref LL_DAC_SetTriggerSource()
Kojto 122:f9eeca106725 1434 * with parameter "LL_DAC_TRIGGER_SOFTWARE".
Kojto 122:f9eeca106725 1435 * and DAC trigger must be enabled using
Kojto 122:f9eeca106725 1436 * function @ref LL_DAC_EnableTrigger().
Kojto 122:f9eeca106725 1437 * @note For devices featuring DAC with 2 channels: this function
Kojto 122:f9eeca106725 1438 * can perform a SW start of both DAC channels simultaneously.
Kojto 122:f9eeca106725 1439 * Two channels can be selected as parameter.
Kojto 122:f9eeca106725 1440 * Example: (LL_DAC_CHANNEL_1 | LL_DAC_CHANNEL_2)
Kojto 122:f9eeca106725 1441 * @rmtoll SWTRIGR SWTRIG1 LL_DAC_TrigSWConversion\n
Kojto 122:f9eeca106725 1442 * SWTRIGR SWTRIG2 LL_DAC_TrigSWConversion
Kojto 122:f9eeca106725 1443 * @param DACx DAC instance
Kojto 122:f9eeca106725 1444 * @param DAC_Channel This parameter can a combination of the following values:
Kojto 122:f9eeca106725 1445 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 1446 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 1447 * @retval None
Kojto 122:f9eeca106725 1448 */
Kojto 122:f9eeca106725 1449 __STATIC_INLINE void LL_DAC_TrigSWConversion(DAC_TypeDef *DACx, uint32_t DAC_Channel)
Kojto 122:f9eeca106725 1450 {
Kojto 122:f9eeca106725 1451 SET_BIT(DACx->SWTRIGR,
Kojto 122:f9eeca106725 1452 (DAC_Channel & DAC_SWTR_CHX_MASK));
Kojto 122:f9eeca106725 1453 }
Kojto 122:f9eeca106725 1454
Kojto 122:f9eeca106725 1455 /**
Kojto 122:f9eeca106725 1456 * @brief Set the data to be loaded in the data holding register
Kojto 122:f9eeca106725 1457 * in format 12 bits left alignment (LSB aligned on bit 0),
Kojto 122:f9eeca106725 1458 * for the selected DAC channel.
Kojto 122:f9eeca106725 1459 * @rmtoll DHR12R1 DACC1DHR LL_DAC_ConvertData12RightAligned\n
Kojto 122:f9eeca106725 1460 * DHR12R2 DACC2DHR LL_DAC_ConvertData12RightAligned
Kojto 122:f9eeca106725 1461 * @param DACx DAC instance
Kojto 122:f9eeca106725 1462 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 1463 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 1464 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 1465 * @param Data Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 1466 * @retval None
Kojto 122:f9eeca106725 1467 */
Kojto 122:f9eeca106725 1468 __STATIC_INLINE void LL_DAC_ConvertData12RightAligned(DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t Data)
Kojto 122:f9eeca106725 1469 {
Kojto 122:f9eeca106725 1470 register uint32_t *preg = __DAC_PTR_REG_OFFSET(DACx->DHR12R1, __DAC_MASK_SHIFT(DAC_Channel, DAC_REG_DHR12RX_REGOFFSET_MASK));
Kojto 122:f9eeca106725 1471
Kojto 122:f9eeca106725 1472 MODIFY_REG(*preg,
Kojto 122:f9eeca106725 1473 DAC_DHR12R1_DACC1DHR,
Kojto 122:f9eeca106725 1474 Data);
Kojto 122:f9eeca106725 1475 }
Kojto 122:f9eeca106725 1476
Kojto 122:f9eeca106725 1477 /**
Kojto 122:f9eeca106725 1478 * @brief Set the data to be loaded in the data holding register
Kojto 122:f9eeca106725 1479 * in format 12 bits left alignment (MSB aligned on bit 15),
Kojto 122:f9eeca106725 1480 * for the selected DAC channel.
Kojto 122:f9eeca106725 1481 * @rmtoll DHR12L1 DACC1DHR LL_DAC_ConvertData12LeftAligned\n
Kojto 122:f9eeca106725 1482 * DHR12L2 DACC2DHR LL_DAC_ConvertData12LeftAligned
Kojto 122:f9eeca106725 1483 * @param DACx DAC instance
Kojto 122:f9eeca106725 1484 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 1485 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 1486 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 1487 * @param Data Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 1488 * @retval None
Kojto 122:f9eeca106725 1489 */
Kojto 122:f9eeca106725 1490 __STATIC_INLINE void LL_DAC_ConvertData12LeftAligned(DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t Data)
Kojto 122:f9eeca106725 1491 {
Kojto 122:f9eeca106725 1492 register uint32_t *preg = __DAC_PTR_REG_OFFSET(DACx->DHR12R1, __DAC_MASK_SHIFT(DAC_Channel, DAC_REG_DHR12LX_REGOFFSET_MASK));
Kojto 122:f9eeca106725 1493
Kojto 122:f9eeca106725 1494 MODIFY_REG(*preg,
Kojto 122:f9eeca106725 1495 DAC_DHR12L1_DACC1DHR,
Kojto 122:f9eeca106725 1496 Data);
Kojto 122:f9eeca106725 1497 }
Kojto 122:f9eeca106725 1498
Kojto 122:f9eeca106725 1499 /**
Kojto 122:f9eeca106725 1500 * @brief Set the data to be loaded in the data holding register
Kojto 122:f9eeca106725 1501 * in format 8 bits left alignment (LSB aligned on bit 0),
Kojto 122:f9eeca106725 1502 * for the selected DAC channel.
Kojto 122:f9eeca106725 1503 * @rmtoll DHR8R1 DACC1DHR LL_DAC_ConvertData8RightAligned\n
Kojto 122:f9eeca106725 1504 * DHR8R2 DACC2DHR LL_DAC_ConvertData8RightAligned
Kojto 122:f9eeca106725 1505 * @param DACx DAC instance
Kojto 122:f9eeca106725 1506 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 1507 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 1508 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 1509 * @param Data Value between Min_Data=0x00 and Max_Data=0xFF
Kojto 122:f9eeca106725 1510 * @retval None
Kojto 122:f9eeca106725 1511 */
Kojto 122:f9eeca106725 1512 __STATIC_INLINE void LL_DAC_ConvertData8RightAligned(DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t Data)
Kojto 122:f9eeca106725 1513 {
Kojto 122:f9eeca106725 1514 register uint32_t *preg = __DAC_PTR_REG_OFFSET(DACx->DHR12R1, __DAC_MASK_SHIFT(DAC_Channel, DAC_REG_DHR8RX_REGOFFSET_MASK));
Kojto 122:f9eeca106725 1515
Kojto 122:f9eeca106725 1516 MODIFY_REG(*preg,
Kojto 122:f9eeca106725 1517 DAC_DHR8R1_DACC1DHR,
Kojto 122:f9eeca106725 1518 Data);
Kojto 122:f9eeca106725 1519 }
Kojto 122:f9eeca106725 1520
Kojto 122:f9eeca106725 1521 /**
Kojto 122:f9eeca106725 1522 * @brief Set the data to be loaded in the data holding register
Kojto 122:f9eeca106725 1523 * in format 12 bits left alignment (LSB aligned on bit 0),
Kojto 122:f9eeca106725 1524 * for both DAC channels.
Kojto 122:f9eeca106725 1525 * @rmtoll DHR12RD DACC1DHR LL_DAC_ConvertDualData12RightAligned\n
Kojto 122:f9eeca106725 1526 * DHR12RD DACC2DHR LL_DAC_ConvertDualData12RightAligned
Kojto 122:f9eeca106725 1527 * @param DACx DAC instance
Kojto 122:f9eeca106725 1528 * @param DataChannel1 Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 1529 * @param DataChannel2 Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 1530 * @retval None
Kojto 122:f9eeca106725 1531 */
Kojto 122:f9eeca106725 1532 __STATIC_INLINE void LL_DAC_ConvertDualData12RightAligned(DAC_TypeDef *DACx, uint32_t DataChannel1, uint32_t DataChannel2)
Kojto 122:f9eeca106725 1533 {
Kojto 122:f9eeca106725 1534 MODIFY_REG(DACx->DHR12RD,
Kojto 122:f9eeca106725 1535 (DAC_DHR12RD_DACC2DHR | DAC_DHR12RD_DACC1DHR),
Kojto 122:f9eeca106725 1536 ((DataChannel2 << DAC_DHR12RD_DACC2DHR_BITOFFSET_POS) | DataChannel1));
Kojto 122:f9eeca106725 1537 }
Kojto 122:f9eeca106725 1538
Kojto 122:f9eeca106725 1539 /**
Kojto 122:f9eeca106725 1540 * @brief Set the data to be loaded in the data holding register
Kojto 122:f9eeca106725 1541 * in format 12 bits left alignment (MSB aligned on bit 15),
Kojto 122:f9eeca106725 1542 * for both DAC channels.
Kojto 122:f9eeca106725 1543 * @rmtoll DHR12LD DACC1DHR LL_DAC_ConvertDualData12LeftAligned\n
Kojto 122:f9eeca106725 1544 * DHR12LD DACC2DHR LL_DAC_ConvertDualData12LeftAligned
Kojto 122:f9eeca106725 1545 * @param DACx DAC instance
Kojto 122:f9eeca106725 1546 * @param DataChannel1 Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 1547 * @param DataChannel2 Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 1548 * @retval None
Kojto 122:f9eeca106725 1549 */
Kojto 122:f9eeca106725 1550 __STATIC_INLINE void LL_DAC_ConvertDualData12LeftAligned(DAC_TypeDef *DACx, uint32_t DataChannel1, uint32_t DataChannel2)
Kojto 122:f9eeca106725 1551 {
Kojto 122:f9eeca106725 1552 /* Note: Data of DAC channel 2 shift value subtracted of 4 because */
Kojto 122:f9eeca106725 1553 /* data on 16 bits and DAC channel 2 bits field is on the 12 MSB, */
Kojto 122:f9eeca106725 1554 /* the 4 LSB must be taken into account for the shift value. */
Kojto 122:f9eeca106725 1555 MODIFY_REG(DACx->DHR12LD,
Kojto 122:f9eeca106725 1556 (DAC_DHR12LD_DACC2DHR | DAC_DHR12LD_DACC1DHR),
Kojto 122:f9eeca106725 1557 ((DataChannel2 << (DAC_DHR12LD_DACC2DHR_BITOFFSET_POS - 4U)) | DataChannel1));
Kojto 122:f9eeca106725 1558 }
Kojto 122:f9eeca106725 1559
Kojto 122:f9eeca106725 1560 /**
Kojto 122:f9eeca106725 1561 * @brief Set the data to be loaded in the data holding register
Kojto 122:f9eeca106725 1562 * in format 8 bits left alignment (LSB aligned on bit 0),
Kojto 122:f9eeca106725 1563 * for both DAC channels.
Kojto 122:f9eeca106725 1564 * @rmtoll DHR8RD DACC1DHR LL_DAC_ConvertDualData8RightAligned\n
Kojto 122:f9eeca106725 1565 * DHR8RD DACC2DHR LL_DAC_ConvertDualData8RightAligned
Kojto 122:f9eeca106725 1566 * @param DACx DAC instance
Kojto 122:f9eeca106725 1567 * @param DataChannel1 Value between Min_Data=0x00 and Max_Data=0xFF
Kojto 122:f9eeca106725 1568 * @param DataChannel2 Value between Min_Data=0x00 and Max_Data=0xFF
Kojto 122:f9eeca106725 1569 * @retval None
Kojto 122:f9eeca106725 1570 */
Kojto 122:f9eeca106725 1571 __STATIC_INLINE void LL_DAC_ConvertDualData8RightAligned(DAC_TypeDef *DACx, uint32_t DataChannel1, uint32_t DataChannel2)
Kojto 122:f9eeca106725 1572 {
Kojto 122:f9eeca106725 1573 MODIFY_REG(DACx->DHR8RD,
Kojto 122:f9eeca106725 1574 (DAC_DHR8RD_DACC2DHR | DAC_DHR8RD_DACC1DHR),
Kojto 122:f9eeca106725 1575 ((DataChannel2 << DAC_DHR8RD_DACC2DHR_BITOFFSET_POS) | DataChannel1));
Kojto 122:f9eeca106725 1576 }
Kojto 122:f9eeca106725 1577
Kojto 122:f9eeca106725 1578 /**
Kojto 122:f9eeca106725 1579 * @brief Retrieve output data currently generated for the selected DAC channel.
Kojto 122:f9eeca106725 1580 * @note Whatever alignment and resolution settings
Kojto 122:f9eeca106725 1581 * (using functions "LL_DAC_ConvertData{8; 12}{Right; Left} Aligned()":
Kojto 122:f9eeca106725 1582 * @ref LL_DAC_ConvertData12RightAligned(), ...),
Kojto 122:f9eeca106725 1583 * output data format is 12 bits right aligned (LSB aligned on bit 0).
Kojto 122:f9eeca106725 1584 * @rmtoll DOR1 DACC1DOR LL_DAC_RetrieveOutputData\n
Kojto 122:f9eeca106725 1585 * DOR2 DACC2DOR LL_DAC_RetrieveOutputData
Kojto 122:f9eeca106725 1586 * @param DACx DAC instance
Kojto 122:f9eeca106725 1587 * @param DAC_Channel This parameter can be one of the following values:
Kojto 122:f9eeca106725 1588 * @arg @ref LL_DAC_CHANNEL_1
Kojto 122:f9eeca106725 1589 * @arg @ref LL_DAC_CHANNEL_2
Kojto 122:f9eeca106725 1590 * @retval Value between Min_Data=0x000 and Max_Data=0xFFF
Kojto 122:f9eeca106725 1591 */
Kojto 122:f9eeca106725 1592 __STATIC_INLINE uint32_t LL_DAC_RetrieveOutputData(DAC_TypeDef *DACx, uint32_t DAC_Channel)
Kojto 122:f9eeca106725 1593 {
Kojto 122:f9eeca106725 1594 register uint32_t *preg = __DAC_PTR_REG_OFFSET(DACx->DOR1, __DAC_MASK_SHIFT(DAC_Channel, DAC_REG_DORX_REGOFFSET_MASK));
Kojto 122:f9eeca106725 1595
Kojto 122:f9eeca106725 1596 return (uint16_t) READ_BIT(*preg, DAC_DOR1_DACC1DOR);
Kojto 122:f9eeca106725 1597 }
Kojto 122:f9eeca106725 1598
Kojto 122:f9eeca106725 1599 /**
Kojto 122:f9eeca106725 1600 * @}
Kojto 122:f9eeca106725 1601 */
Kojto 122:f9eeca106725 1602
Kojto 122:f9eeca106725 1603 /** @defgroup DAC_LL_EF_FLAG_Management FLAG Management
Kojto 122:f9eeca106725 1604 * @{
Kojto 122:f9eeca106725 1605 */
Kojto 122:f9eeca106725 1606 /**
Kojto 122:f9eeca106725 1607 * @brief Get DAC calibration offset flag for DAC channel 1
Kojto 122:f9eeca106725 1608 * @rmtoll SR CAL_FLAG1 LL_DAC_IsActiveFlag_CAL1
Kojto 122:f9eeca106725 1609 * @param DACx DAC instance
Kojto 122:f9eeca106725 1610 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 1611 */
Kojto 122:f9eeca106725 1612 __STATIC_INLINE uint32_t LL_DAC_IsActiveFlag_CAL1(DAC_TypeDef *DACx)
Kojto 122:f9eeca106725 1613 {
Kojto 122:f9eeca106725 1614 return (READ_BIT(DACx->SR, LL_DAC_FLAG_CAL1) == (LL_DAC_FLAG_CAL1));
Kojto 122:f9eeca106725 1615 }
Kojto 122:f9eeca106725 1616
Kojto 122:f9eeca106725 1617 /**
Kojto 122:f9eeca106725 1618 * @brief Get DAC calibration offset flag for DAC channel 2
Kojto 122:f9eeca106725 1619 * @rmtoll SR CAL_FLAG2 LL_DAC_IsActiveFlag_CAL2
Kojto 122:f9eeca106725 1620 * @param DACx DAC instance
Kojto 122:f9eeca106725 1621 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 1622 */
Kojto 122:f9eeca106725 1623 __STATIC_INLINE uint32_t LL_DAC_IsActiveFlag_CAL2(DAC_TypeDef *DACx)
Kojto 122:f9eeca106725 1624 {
Kojto 122:f9eeca106725 1625 return (READ_BIT(DACx->SR, LL_DAC_FLAG_CAL2) == (LL_DAC_FLAG_CAL2));
Kojto 122:f9eeca106725 1626 }
Kojto 122:f9eeca106725 1627
Kojto 122:f9eeca106725 1628 /**
Kojto 122:f9eeca106725 1629 * @brief Get DAC busy writing sample time flag for DAC channel 1
Kojto 122:f9eeca106725 1630 * @rmtoll SR BWST1 LL_DAC_IsActiveFlag_BWST1
Kojto 122:f9eeca106725 1631 * @param DACx DAC instance
Kojto 122:f9eeca106725 1632 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 1633 */
Kojto 122:f9eeca106725 1634 __STATIC_INLINE uint32_t LL_DAC_IsActiveFlag_BWST1(DAC_TypeDef *DACx)
Kojto 122:f9eeca106725 1635 {
Kojto 122:f9eeca106725 1636 return (READ_BIT(DACx->SR, LL_DAC_FLAG_BWST1) == (LL_DAC_FLAG_BWST1));
Kojto 122:f9eeca106725 1637 }
Kojto 122:f9eeca106725 1638
Kojto 122:f9eeca106725 1639 /**
Kojto 122:f9eeca106725 1640 * @brief Get DAC busy writing sample time flag for DAC channel 2
Kojto 122:f9eeca106725 1641 * @rmtoll SR BWST2 LL_DAC_IsActiveFlag_BWST2
Kojto 122:f9eeca106725 1642 * @param DACx DAC instance
Kojto 122:f9eeca106725 1643 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 1644 */
Kojto 122:f9eeca106725 1645 __STATIC_INLINE uint32_t LL_DAC_IsActiveFlag_BWST2(DAC_TypeDef *DACx)
Kojto 122:f9eeca106725 1646 {
Kojto 122:f9eeca106725 1647 return (READ_BIT(DACx->SR, LL_DAC_FLAG_BWST2) == (LL_DAC_FLAG_BWST2));
Kojto 122:f9eeca106725 1648 }
Kojto 122:f9eeca106725 1649
Kojto 122:f9eeca106725 1650 /**
Kojto 122:f9eeca106725 1651 * @brief Get DAC underrun flag for DAC channel 1
Kojto 122:f9eeca106725 1652 * @rmtoll SR DMAUDR1 LL_DAC_IsActiveFlag_DMAUDR1
Kojto 122:f9eeca106725 1653 * @param DACx DAC instance
Kojto 122:f9eeca106725 1654 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 1655 */
Kojto 122:f9eeca106725 1656 __STATIC_INLINE uint32_t LL_DAC_IsActiveFlag_DMAUDR1(DAC_TypeDef *DACx)
Kojto 122:f9eeca106725 1657 {
Kojto 122:f9eeca106725 1658 return (READ_BIT(DACx->SR, LL_DAC_FLAG_DMAUDR1) == (LL_DAC_FLAG_DMAUDR1));
Kojto 122:f9eeca106725 1659 }
Kojto 122:f9eeca106725 1660
Kojto 122:f9eeca106725 1661 /**
Kojto 122:f9eeca106725 1662 * @brief Get DAC underrun flag for DAC channel 2
Kojto 122:f9eeca106725 1663 * @rmtoll SR DMAUDR2 LL_DAC_IsActiveFlag_DMAUDR2
Kojto 122:f9eeca106725 1664 * @param DACx DAC instance
Kojto 122:f9eeca106725 1665 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 1666 */
Kojto 122:f9eeca106725 1667 __STATIC_INLINE uint32_t LL_DAC_IsActiveFlag_DMAUDR2(DAC_TypeDef *DACx)
Kojto 122:f9eeca106725 1668 {
Kojto 122:f9eeca106725 1669 return (READ_BIT(DACx->SR, LL_DAC_FLAG_DMAUDR2) == (LL_DAC_FLAG_DMAUDR2));
Kojto 122:f9eeca106725 1670 }
Kojto 122:f9eeca106725 1671
Kojto 122:f9eeca106725 1672 /**
Kojto 122:f9eeca106725 1673 * @brief Clear DAC underrun flag for DAC channel 1
Kojto 122:f9eeca106725 1674 * @rmtoll SR DMAUDR1 LL_DAC_ClearFlag_DMAUDR1
Kojto 122:f9eeca106725 1675 * @param DACx DAC instance
Kojto 122:f9eeca106725 1676 * @retval None
Kojto 122:f9eeca106725 1677 */
Kojto 122:f9eeca106725 1678 __STATIC_INLINE void LL_DAC_ClearFlag_DMAUDR1(DAC_TypeDef *DACx)
Kojto 122:f9eeca106725 1679 {
Kojto 122:f9eeca106725 1680 WRITE_REG(DACx->SR, LL_DAC_FLAG_DMAUDR1);
Kojto 122:f9eeca106725 1681 }
Kojto 122:f9eeca106725 1682
Kojto 122:f9eeca106725 1683 /**
Kojto 122:f9eeca106725 1684 * @brief Clear DAC underrun flag for DAC channel 2
Kojto 122:f9eeca106725 1685 * @rmtoll SR DMAUDR2 LL_DAC_ClearFlag_DMAUDR2
Kojto 122:f9eeca106725 1686 * @param DACx DAC instance
Kojto 122:f9eeca106725 1687 * @retval None
Kojto 122:f9eeca106725 1688 */
Kojto 122:f9eeca106725 1689 __STATIC_INLINE void LL_DAC_ClearFlag_DMAUDR2(DAC_TypeDef *DACx)
Kojto 122:f9eeca106725 1690 {
Kojto 122:f9eeca106725 1691 WRITE_REG(DACx->SR, LL_DAC_FLAG_DMAUDR2);
Kojto 122:f9eeca106725 1692 }
Kojto 122:f9eeca106725 1693
Kojto 122:f9eeca106725 1694 /**
Kojto 122:f9eeca106725 1695 * @}
Kojto 122:f9eeca106725 1696 */
Kojto 122:f9eeca106725 1697
Kojto 122:f9eeca106725 1698 /** @defgroup DAC_LL_EF_IT_Management IT management
Kojto 122:f9eeca106725 1699 * @{
Kojto 122:f9eeca106725 1700 */
Kojto 122:f9eeca106725 1701
Kojto 122:f9eeca106725 1702 /**
Kojto 122:f9eeca106725 1703 * @brief Enable DMA underrun interrupt for DAC channel 1
Kojto 122:f9eeca106725 1704 * @rmtoll CR DMAUDRIE1 LL_DAC_EnableIT_DMAUDR1
Kojto 122:f9eeca106725 1705 * @param DACx DAC instance
Kojto 122:f9eeca106725 1706 * @retval None
Kojto 122:f9eeca106725 1707 */
Kojto 122:f9eeca106725 1708 __STATIC_INLINE void LL_DAC_EnableIT_DMAUDR1(DAC_TypeDef *DACx)
Kojto 122:f9eeca106725 1709 {
Kojto 122:f9eeca106725 1710 SET_BIT(DACx->CR, LL_DAC_IT_DMAUDRIE1);
Kojto 122:f9eeca106725 1711 }
Kojto 122:f9eeca106725 1712
Kojto 122:f9eeca106725 1713 /**
Kojto 122:f9eeca106725 1714 * @brief Enable DMA underrun interrupt for DAC channel 2
Kojto 122:f9eeca106725 1715 * @rmtoll CR DMAUDRIE2 LL_DAC_EnableIT_DMAUDR2
Kojto 122:f9eeca106725 1716 * @param DACx DAC instance
Kojto 122:f9eeca106725 1717 * @retval None
Kojto 122:f9eeca106725 1718 */
Kojto 122:f9eeca106725 1719 __STATIC_INLINE void LL_DAC_EnableIT_DMAUDR2(DAC_TypeDef *DACx)
Kojto 122:f9eeca106725 1720 {
Kojto 122:f9eeca106725 1721 SET_BIT(DACx->CR, LL_DAC_IT_DMAUDRIE2);
Kojto 122:f9eeca106725 1722 }
Kojto 122:f9eeca106725 1723
Kojto 122:f9eeca106725 1724 /**
Kojto 122:f9eeca106725 1725 * @brief Disable DMA underrun interrupt for DAC channel 1
Kojto 122:f9eeca106725 1726 * @rmtoll CR DMAUDRIE1 LL_DAC_DisableIT_DMAUDR1
Kojto 122:f9eeca106725 1727 * @param DACx DAC instance
Kojto 122:f9eeca106725 1728 * @retval None
Kojto 122:f9eeca106725 1729 */
Kojto 122:f9eeca106725 1730 __STATIC_INLINE void LL_DAC_DisableIT_DMAUDR1(DAC_TypeDef *DACx)
Kojto 122:f9eeca106725 1731 {
Kojto 122:f9eeca106725 1732 CLEAR_BIT(DACx->CR, LL_DAC_IT_DMAUDRIE1);
Kojto 122:f9eeca106725 1733 }
Kojto 122:f9eeca106725 1734
Kojto 122:f9eeca106725 1735 /**
Kojto 122:f9eeca106725 1736 * @brief Disable DMA underrun interrupt for DAC channel 2
Kojto 122:f9eeca106725 1737 * @rmtoll CR DMAUDRIE2 LL_DAC_DisableIT_DMAUDR2
Kojto 122:f9eeca106725 1738 * @param DACx DAC instance
Kojto 122:f9eeca106725 1739 * @retval None
Kojto 122:f9eeca106725 1740 */
Kojto 122:f9eeca106725 1741 __STATIC_INLINE void LL_DAC_DisableIT_DMAUDR2(DAC_TypeDef *DACx)
Kojto 122:f9eeca106725 1742 {
Kojto 122:f9eeca106725 1743 CLEAR_BIT(DACx->CR, LL_DAC_IT_DMAUDRIE2);
Kojto 122:f9eeca106725 1744 }
Kojto 122:f9eeca106725 1745
Kojto 122:f9eeca106725 1746 /**
Kojto 122:f9eeca106725 1747 * @brief Get DMA underrun interrupt for DAC channel 1
Kojto 122:f9eeca106725 1748 * @rmtoll CR DMAUDRIE1 LL_DAC_IsEnabledIT_DMAUDR1
Kojto 122:f9eeca106725 1749 * @param DACx DAC instance
Kojto 122:f9eeca106725 1750 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 1751 */
Kojto 122:f9eeca106725 1752 __STATIC_INLINE uint32_t LL_DAC_IsEnabledIT_DMAUDR1(DAC_TypeDef *DACx)
Kojto 122:f9eeca106725 1753 {
Kojto 122:f9eeca106725 1754 return (READ_BIT(DACx->CR, LL_DAC_IT_DMAUDRIE1) == (LL_DAC_IT_DMAUDRIE1));
Kojto 122:f9eeca106725 1755 }
Kojto 122:f9eeca106725 1756
Kojto 122:f9eeca106725 1757 /**
Kojto 122:f9eeca106725 1758 * @brief Get DMA underrun interrupt for DAC channel 2
Kojto 122:f9eeca106725 1759 * @rmtoll CR DMAUDRIE2 LL_DAC_IsEnabledIT_DMAUDR2
Kojto 122:f9eeca106725 1760 * @param DACx DAC instance
Kojto 122:f9eeca106725 1761 * @retval State of bit (1 or 0).
Kojto 122:f9eeca106725 1762 */
Kojto 122:f9eeca106725 1763 __STATIC_INLINE uint32_t LL_DAC_IsEnabledIT_DMAUDR2(DAC_TypeDef *DACx)
Kojto 122:f9eeca106725 1764 {
Kojto 122:f9eeca106725 1765 return (READ_BIT(DACx->CR, LL_DAC_IT_DMAUDRIE2) == (LL_DAC_IT_DMAUDRIE2));
Kojto 122:f9eeca106725 1766 }
Kojto 122:f9eeca106725 1767
Kojto 122:f9eeca106725 1768 /**
Kojto 122:f9eeca106725 1769 * @}
Kojto 122:f9eeca106725 1770 */
Kojto 122:f9eeca106725 1771
Kojto 122:f9eeca106725 1772 #if defined(USE_FULL_LL_DRIVER)
Kojto 122:f9eeca106725 1773 /** @defgroup DAC_LL_EF_Init Initialization and de-initialization functions
Kojto 122:f9eeca106725 1774 * @{
Kojto 122:f9eeca106725 1775 */
Kojto 122:f9eeca106725 1776
Kojto 122:f9eeca106725 1777 ErrorStatus LL_DAC_DeInit(DAC_TypeDef* DACx);
Kojto 122:f9eeca106725 1778 ErrorStatus LL_DAC_Init(DAC_TypeDef* DACx, uint32_t DAC_Channel, LL_DAC_InitTypeDef* DAC_InitStruct);
Kojto 122:f9eeca106725 1779 void LL_DAC_StructInit(LL_DAC_InitTypeDef* DAC_InitStruct);
Kojto 122:f9eeca106725 1780
Kojto 122:f9eeca106725 1781 /**
Kojto 122:f9eeca106725 1782 * @}
Kojto 122:f9eeca106725 1783 */
Kojto 122:f9eeca106725 1784 #endif /* USE_FULL_LL_DRIVER */
Kojto 122:f9eeca106725 1785
Kojto 122:f9eeca106725 1786 /**
Kojto 122:f9eeca106725 1787 * @}
Kojto 122:f9eeca106725 1788 */
Kojto 122:f9eeca106725 1789
Kojto 122:f9eeca106725 1790 /**
Kojto 122:f9eeca106725 1791 * @}
Kojto 122:f9eeca106725 1792 */
Kojto 122:f9eeca106725 1793
Kojto 122:f9eeca106725 1794 #endif /* DAC1 */
Kojto 122:f9eeca106725 1795
Kojto 122:f9eeca106725 1796 /**
Kojto 122:f9eeca106725 1797 * @}
Kojto 122:f9eeca106725 1798 */
Kojto 122:f9eeca106725 1799
Kojto 122:f9eeca106725 1800 #ifdef __cplusplus
Kojto 122:f9eeca106725 1801 }
Kojto 122:f9eeca106725 1802 #endif
Kojto 122:f9eeca106725 1803
Kojto 122:f9eeca106725 1804 #endif /* __STM32L4xx_LL_DAC_H */
Kojto 122:f9eeca106725 1805
Kojto 122:f9eeca106725 1806 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/