20#ifndef STM32H7xx_LL_DAC_H
21#define STM32H7xx_LL_DAC_H
34#if defined(DAC1) || defined(DAC2)
57#define DAC_CR_CH1_BITOFFSET 0UL
59#define DAC_CR_CH2_BITOFFSET 16UL
61#define DAC_CR_CHX_BITOFFSET_MASK (DAC_CR_CH1_BITOFFSET | DAC_CR_CH2_BITOFFSET)
63#define DAC_SWTR_CH1 (DAC_SWTRIGR_SWTRIG1)
64#define DAC_SWTR_CH2 (DAC_SWTRIGR_SWTRIG2)
65#define DAC_SWTR_CHX_MASK (DAC_SWTR_CH1 | DAC_SWTR_CH2)
67#define DAC_REG_DHR12R1_REGOFFSET 0x00000000UL
68#define DAC_REG_DHR12L1_REGOFFSET 0x00100000UL
70#define DAC_REG_DHR8R1_REGOFFSET 0x02000000UL
73#define DAC_REG_DHR12R2_REGOFFSET 0x30000000UL
75#define DAC_REG_DHR12L2_REGOFFSET 0x00400000UL
77#define DAC_REG_DHR8R2_REGOFFSET 0x05000000UL
80#define DAC_REG_DHR12RX_REGOFFSET_MASK 0xF0000000UL
81#define DAC_REG_DHR12LX_REGOFFSET_MASK 0x00F00000UL
82#define DAC_REG_DHR8RX_REGOFFSET_MASK 0x0F000000UL
83#define DAC_REG_DHRX_REGOFFSET_MASK (DAC_REG_DHR12RX_REGOFFSET_MASK\
84 | DAC_REG_DHR12LX_REGOFFSET_MASK | DAC_REG_DHR8RX_REGOFFSET_MASK)
86#define DAC_REG_DOR1_REGOFFSET 0x00000000UL
88#define DAC_REG_DOR2_REGOFFSET 0x00000020UL
90#define DAC_REG_DORX_REGOFFSET_MASK (DAC_REG_DOR1_REGOFFSET | DAC_REG_DOR2_REGOFFSET)
92#define DAC_REG_SHSR1_REGOFFSET 0x00000000UL
93#define DAC_REG_SHSR2_REGOFFSET 0x00000040UL
95#define DAC_REG_SHSRX_REGOFFSET_MASK (DAC_REG_SHSR1_REGOFFSET | DAC_REG_SHSR2_REGOFFSET)
98#define DAC_REG_DHR_REGOFFSET_MASK_POSBIT0 0x0000000FUL
100#define DAC_REG_DORX_REGOFFSET_MASK_POSBIT0 0x00000001UL
102#define DAC_REG_SHSRX_REGOFFSET_MASK_POSBIT0 0x00000001UL
105#define DAC_REG_DHR12RX_REGOFFSET_BITOFFSET_POS 28UL
108#define DAC_REG_DHR12LX_REGOFFSET_BITOFFSET_POS 20UL
111#define DAC_REG_DHR8RX_REGOFFSET_BITOFFSET_POS 24UL
114#define DAC_REG_DORX_REGOFFSET_BITOFFSET_POS 5UL
117#define DAC_REG_SHSRX_REGOFFSET_BITOFFSET_POS 6UL
122#define DAC_DHR12RD_DACC2DHR_BITOFFSET_POS DAC_DHR12RD_DACC2DHR_Pos
123#define DAC_DHR12LD_DACC2DHR_BITOFFSET_POS DAC_DHR12LD_DACC2DHR_Pos
124#define DAC_DHR8RD_DACC2DHR_BITOFFSET_POS DAC_DHR8RD_DACC2DHR_Pos
127#define DAC_DIGITAL_SCALE_12BITS 4095UL
150#define __DAC_PTR_REG_OFFSET(__REG__, __REG_OFFFSET__) \
151 ((uint32_t *)((uint32_t) ((uint32_t)(&(__REG__)) + ((__REG_OFFFSET__) << 2UL))))
159#if defined(USE_FULL_LL_DRIVER) || defined(__rtems__)
170 uint32_t TriggerSource;
178 uint32_t WaveAutoGeneration;
184 uint32_t WaveAutoGenerationConfig;
197 uint32_t OutputBuffer;
203 uint32_t OutputConnection;
233#define LL_DAC_FLAG_DMAUDR1 (DAC_SR_DMAUDR1)
234#define LL_DAC_FLAG_CAL1 (DAC_SR_CAL_FLAG1)
235#define LL_DAC_FLAG_BWST1 (DAC_SR_BWST1)
238#define LL_DAC_FLAG_DMAUDR2 (DAC_SR_DMAUDR2)
239#define LL_DAC_FLAG_CAL2 (DAC_SR_CAL_FLAG2)
240#define LL_DAC_FLAG_BWST2 (DAC_SR_BWST2)
251#define LL_DAC_IT_DMAUDRIE1 (DAC_CR_DMAUDRIE1)
253#define LL_DAC_IT_DMAUDRIE2 (DAC_CR_DMAUDRIE2)
263#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)
264#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)
273#define LL_DAC_MODE_NORMAL_OPERATION 0x00000000UL
274#define LL_DAC_MODE_CALIBRATION (DAC_CR_CEN1)
283#define LL_DAC_TRIG_SOFTWARE 0x00000000U
284#define LL_DAC_TRIG_EXT_TIM1_TRGO ( DAC_CR_TSEL1_0)
285#define LL_DAC_TRIG_EXT_TIM2_TRGO ( DAC_CR_TSEL1_1 )
286#define LL_DAC_TRIG_EXT_TIM4_TRGO ( DAC_CR_TSEL1_1 | DAC_CR_TSEL1_0)
287#define LL_DAC_TRIG_EXT_TIM5_TRGO ( DAC_CR_TSEL1_2 )
288#define LL_DAC_TRIG_EXT_TIM6_TRGO ( DAC_CR_TSEL1_2 | DAC_CR_TSEL1_0)
289#define LL_DAC_TRIG_EXT_TIM7_TRGO ( DAC_CR_TSEL1_2 | DAC_CR_TSEL1_1 )
290#define LL_DAC_TRIG_EXT_TIM8_TRGO ( DAC_CR_TSEL1_2 | DAC_CR_TSEL1_1 | DAC_CR_TSEL1_0)
291#define LL_DAC_TRIG_EXT_TIM15_TRGO (DAC_CR_TSEL1_3 )
293#define LL_DAC_TRIG_EXT_HRTIM_TRGO1 (DAC_CR_TSEL1_3 | DAC_CR_TSEL1_0)
294#define LL_DAC_TRIG_EXT_HRTIM_TRGO2 (DAC_CR_TSEL1_3 | DAC_CR_TSEL1_1 )
296#define LL_DAC_TRIG_EXT_LPTIM1_OUT (DAC_CR_TSEL1_3 | DAC_CR_TSEL1_1 | DAC_CR_TSEL1_0)
297#define LL_DAC_TRIG_EXT_LPTIM2_OUT (DAC_CR_TSEL1_3 | DAC_CR_TSEL1_2 )
298#define LL_DAC_TRIG_EXT_EXTI_LINE9 (DAC_CR_TSEL1_3 | DAC_CR_TSEL1_2 | DAC_CR_TSEL1_0)
300#define LL_DAC_TRIG_EXT_TIM23_TRGO (DAC_CR_TSEL1_3 | DAC_CR_TSEL1_2 | DAC_CR_TSEL1_1 )
303#define LL_DAC_TRIG_EXT_TIM24_TRGO (DAC_CR_TSEL1_3 | DAC_CR_TSEL1_2 | DAC_CR_TSEL1_1 | DAC_CR_TSEL1_0)
306#define LL_DAC_TRIG_EXT_LPTIM3_OUT (DAC_CR_TSEL1_3 | DAC_CR_TSEL1_2 | DAC_CR_TSEL1_1 )
316#define LL_DAC_WAVE_AUTO_GENERATION_NONE 0x00000000UL
317#define LL_DAC_WAVE_AUTO_GENERATION_NOISE ( DAC_CR_WAVE1_0)
318#define LL_DAC_WAVE_AUTO_GENERATION_TRIANGLE (DAC_CR_WAVE1_1 )
327#define LL_DAC_NOISE_LFSR_UNMASK_BIT0 0x00000000UL
328#define LL_DAC_NOISE_LFSR_UNMASK_BITS1_0 ( DAC_CR_MAMP1_0)
329#define LL_DAC_NOISE_LFSR_UNMASK_BITS2_0 ( DAC_CR_MAMP1_1 )
330#define LL_DAC_NOISE_LFSR_UNMASK_BITS3_0 ( DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0)
331#define LL_DAC_NOISE_LFSR_UNMASK_BITS4_0 ( DAC_CR_MAMP1_2 )
332#define LL_DAC_NOISE_LFSR_UNMASK_BITS5_0 ( DAC_CR_MAMP1_2 | DAC_CR_MAMP1_0)
333#define LL_DAC_NOISE_LFSR_UNMASK_BITS6_0 ( DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1 )
334#define LL_DAC_NOISE_LFSR_UNMASK_BITS7_0 ( DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0)
335#define LL_DAC_NOISE_LFSR_UNMASK_BITS8_0 (DAC_CR_MAMP1_3 )
336#define LL_DAC_NOISE_LFSR_UNMASK_BITS9_0 (DAC_CR_MAMP1_3 | DAC_CR_MAMP1_0)
337#define LL_DAC_NOISE_LFSR_UNMASK_BITS10_0 (DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1 )
338#define LL_DAC_NOISE_LFSR_UNMASK_BITS11_0 (DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0)
347#define LL_DAC_TRIANGLE_AMPLITUDE_1 0x00000000UL
348#define LL_DAC_TRIANGLE_AMPLITUDE_3 ( DAC_CR_MAMP1_0)
349#define LL_DAC_TRIANGLE_AMPLITUDE_7 ( DAC_CR_MAMP1_1 )
350#define LL_DAC_TRIANGLE_AMPLITUDE_15 ( DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0)
351#define LL_DAC_TRIANGLE_AMPLITUDE_31 ( DAC_CR_MAMP1_2 )
352#define LL_DAC_TRIANGLE_AMPLITUDE_63 ( DAC_CR_MAMP1_2 | DAC_CR_MAMP1_0)
353#define LL_DAC_TRIANGLE_AMPLITUDE_127 ( DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1 )
354#define LL_DAC_TRIANGLE_AMPLITUDE_255 ( DAC_CR_MAMP1_2 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0)
355#define LL_DAC_TRIANGLE_AMPLITUDE_511 (DAC_CR_MAMP1_3 )
356#define LL_DAC_TRIANGLE_AMPLITUDE_1023 (DAC_CR_MAMP1_3 | DAC_CR_MAMP1_0)
357#define LL_DAC_TRIANGLE_AMPLITUDE_2047 (DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1 )
358#define LL_DAC_TRIANGLE_AMPLITUDE_4095 (DAC_CR_MAMP1_3 | DAC_CR_MAMP1_1 | DAC_CR_MAMP1_0)
367#define LL_DAC_OUTPUT_MODE_NORMAL 0x00000000UL
368#define LL_DAC_OUTPUT_MODE_SAMPLE_AND_HOLD (DAC_MCR_MODE1_2)
377#define LL_DAC_OUTPUT_BUFFER_ENABLE 0x00000000UL
378#define LL_DAC_OUTPUT_BUFFER_DISABLE (DAC_MCR_MODE1_1)
387#define LL_DAC_OUTPUT_CONNECT_GPIO 0x00000000UL
388#define LL_DAC_OUTPUT_CONNECT_INTERNAL (DAC_MCR_MODE1_0)
397#define LL_DAC_TRIGGER_SOFTWARE (LL_DAC_TRIG_SOFTWARE)
398#define LL_DAC_TRIGGER_TIM2_TRGO (LL_DAC_TRIG_EXT_TIM2_TRGO)
399#define LL_DAC_TRIGGER_TIM4_TRGO (LL_DAC_TRIG_EXT_TIM4_TRGO)
400#define LL_DAC_TRIGGER_TIM6_TRGO (LL_DAC_TRIG_EXT_TIM6_TRGO)
401#define LL_DAC_TRIGGER_TIM7_TRGO (LL_DAC_TRIG_EXT_TIM7_TRGO)
402#define LL_DAC_TRIGGER_TIM8_TRGO (LL_DAC_TRIG_EXT_TIM8_TRGO)
403#define LL_DAC_TRIGGER_EXT_IT9 (LL_DAC_TRIG_EXT_EXTI_LINE9)
405#define LL_DAC_WAVEGENERATION_NONE (LL_DAC_WAVE_AUTO_GENERATION_NONE)
406#define LL_DAC_WAVEGENERATION_NOISE (LL_DAC_WAVE_AUTO_GENERATION_NOISE)
407#define LL_DAC_WAVEGENERATION_TRIANGLE (LL_DAC_WAVE_AUTO_GENERATION_TRIANGLE)
409#define LL_DAC_CONNECT_GPIO (LL_DAC_OUTPUT_CONNECT_GPIO)
410#define LL_DAC_CONNECT_INTERNAL (LL_DAC_OUTPUT_CONNECT_INTERNAL)
418#define LL_DAC_RESOLUTION_12B 0x00000000UL
419#define LL_DAC_RESOLUTION_8B 0x00000002UL
431#define LL_DAC_DMA_REG_DATA_12BITS_RIGHT_ALIGNED DAC_REG_DHR12RX_REGOFFSET_BITOFFSET_POS
432#define LL_DAC_DMA_REG_DATA_12BITS_LEFT_ALIGNED DAC_REG_DHR12LX_REGOFFSET_BITOFFSET_POS
433#define LL_DAC_DMA_REG_DATA_8BITS_RIGHT_ALIGNED DAC_REG_DHR8RX_REGOFFSET_BITOFFSET_POS
459#define LL_DAC_DELAY_STARTUP_VOLTAGE_SETTLING_US 8UL
472#define LL_DAC_DELAY_VOLTAGE_SETTLING_US 3UL
500#define LL_DAC_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
508#define LL_DAC_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
532#define __LL_DAC_CHANNEL_TO_DECIMAL_NB(__CHANNEL__) \
533 ((__CHANNEL__) & DAC_SWTR_CHX_MASK)
548#define __LL_DAC_DECIMAL_NB_TO_CHANNEL(__DECIMAL_NB__)\
549 (((__DECIMAL_NB__) == 1UL)? (LL_DAC_CHANNEL_1 ):(((__DECIMAL_NB__) == 2UL) ? ( LL_DAC_CHANNEL_2):(0UL)))
562#define __LL_DAC_DIGITAL_SCALE(__DAC_RESOLUTION__) \
563 ((0x00000FFFUL) >> ((__DAC_RESOLUTION__) << 1UL))
583#define __LL_DAC_CALC_VOLTAGE_TO_DATA(__VREFANALOG_VOLTAGE__, __DAC_VOLTAGE__, __DAC_RESOLUTION__) \
584 ((__DAC_VOLTAGE__) * __LL_DAC_DIGITAL_SCALE(__DAC_RESOLUTION__) \
585 / (__VREFANALOG_VOLTAGE__) \
622__STATIC_INLINE
void LL_DAC_SetMode(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t ChannelMode)
625 DAC_CR_CEN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK),
626 ChannelMode << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
642__STATIC_INLINE uint32_t LL_DAC_GetMode(
const DAC_TypeDef *DACx, uint32_t DAC_Channel)
644 return (uint32_t)(READ_BIT(DACx->
CR,
DAC_CR_CEN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
645 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
662__STATIC_INLINE
void LL_DAC_SetTrimmingValue(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t TrimmingValue)
664 MODIFY_REG(DACx->
CCR,
666 TrimmingValue << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
681__STATIC_INLINE uint32_t LL_DAC_GetTrimmingValue(
const DAC_TypeDef *DACx, uint32_t DAC_Channel)
683 return (uint32_t)(READ_BIT(DACx->
CCR,
DAC_CCR_OTRIM1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
684 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
730__STATIC_INLINE
void LL_DAC_SetTriggerSource(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t TriggerSource)
733 DAC_CR_TSEL1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK),
734 TriggerSource << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
776__STATIC_INLINE uint32_t LL_DAC_GetTriggerSource(
const DAC_TypeDef *DACx, uint32_t DAC_Channel)
778 return (uint32_t)(READ_BIT(DACx->
CR,
DAC_CR_TSEL1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
779 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
798__STATIC_INLINE
void LL_DAC_SetWaveAutoGeneration(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t WaveAutoGeneration)
801 DAC_CR_WAVE1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK),
802 WaveAutoGeneration << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
819__STATIC_INLINE uint32_t LL_DAC_GetWaveAutoGeneration(
const DAC_TypeDef *DACx, uint32_t DAC_Channel)
821 return (uint32_t)(READ_BIT(DACx->
CR,
DAC_CR_WAVE1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
822 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
855__STATIC_INLINE
void LL_DAC_SetWaveNoiseLFSR(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t NoiseLFSRMask)
858 DAC_CR_MAMP1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK),
859 NoiseLFSRMask << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
885__STATIC_INLINE uint32_t LL_DAC_GetWaveNoiseLFSR(
const DAC_TypeDef *DACx, uint32_t DAC_Channel)
887 return (uint32_t)(READ_BIT(DACx->
CR,
DAC_CR_MAMP1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
888 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
921__STATIC_INLINE
void LL_DAC_SetWaveTriangleAmplitude(
DAC_TypeDef *DACx, uint32_t DAC_Channel,
922 uint32_t TriangleAmplitude)
925 DAC_CR_MAMP1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK),
926 TriangleAmplitude << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
952__STATIC_INLINE uint32_t LL_DAC_GetWaveTriangleAmplitude(
const DAC_TypeDef *DACx, uint32_t DAC_Channel)
954 return (uint32_t)(READ_BIT(DACx->
CR,
DAC_CR_MAMP1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
955 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
1003__STATIC_INLINE
void LL_DAC_ConfigOutput(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t OutputMode,
1004 uint32_t OutputBuffer, uint32_t OutputConnection)
1006 MODIFY_REG(DACx->
MCR,
1008 (OutputMode | OutputBuffer | OutputConnection) << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
1031__STATIC_INLINE
void LL_DAC_SetOutputMode(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t OutputMode)
1033 MODIFY_REG(DACx->
MCR,
1034 (uint32_t)
DAC_MCR_MODE1_2 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK),
1035 OutputMode << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
1050__STATIC_INLINE uint32_t LL_DAC_GetOutputMode(
const DAC_TypeDef *DACx, uint32_t DAC_Channel)
1052 return (uint32_t)(READ_BIT(DACx->
MCR, (uint32_t)
DAC_MCR_MODE1_2 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
1053 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
1074__STATIC_INLINE
void LL_DAC_SetOutputBuffer(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t OutputBuffer)
1076 MODIFY_REG(DACx->
MCR,
1077 (uint32_t)
DAC_MCR_MODE1_1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK),
1078 OutputBuffer << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
1093__STATIC_INLINE uint32_t LL_DAC_GetOutputBuffer(
const DAC_TypeDef *DACx, uint32_t DAC_Channel)
1095 return (uint32_t)(READ_BIT(DACx->
MCR, (uint32_t)
DAC_MCR_MODE1_1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
1096 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
1123__STATIC_INLINE
void LL_DAC_SetOutputConnection(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t OutputConnection)
1125 MODIFY_REG(DACx->
MCR,
1126 (uint32_t)
DAC_MCR_MODE1_0 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK),
1127 OutputConnection << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
1152__STATIC_INLINE uint32_t LL_DAC_GetOutputConnection(
const DAC_TypeDef *DACx, uint32_t DAC_Channel)
1154 return (uint32_t)(READ_BIT(DACx->
MCR, (uint32_t)
DAC_MCR_MODE1_0 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
1155 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
1175__STATIC_INLINE
void LL_DAC_SetSampleAndHoldSampleTime(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t SampleTime)
1177 __IO uint32_t *preg = __DAC_PTR_REG_OFFSET(DACx->
SHSR1, (DAC_Channel >> DAC_REG_SHSRX_REGOFFSET_BITOFFSET_POS)
1178 & DAC_REG_SHSRX_REGOFFSET_MASK_POSBIT0);
1194__STATIC_INLINE uint32_t LL_DAC_GetSampleAndHoldSampleTime(
const DAC_TypeDef *DACx, uint32_t DAC_Channel)
1196 __IO uint32_t
const *preg = __DAC_PTR_REG_OFFSET(DACx->
SHSR1, (DAC_Channel >> DAC_REG_SHSRX_REGOFFSET_BITOFFSET_POS)
1197 & DAC_REG_SHSRX_REGOFFSET_MASK_POSBIT0);
1214__STATIC_INLINE
void LL_DAC_SetSampleAndHoldHoldTime(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t HoldTime)
1216 MODIFY_REG(DACx->
SHHR,
1218 HoldTime << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
1232__STATIC_INLINE uint32_t LL_DAC_GetSampleAndHoldHoldTime(
const DAC_TypeDef *DACx, uint32_t DAC_Channel)
1234 return (uint32_t)(READ_BIT(DACx->
SHHR,
DAC_SHHR_THOLD1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
1235 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
1251__STATIC_INLINE
void LL_DAC_SetSampleAndHoldRefreshTime(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t RefreshTime)
1253 MODIFY_REG(DACx->
SHRR,
1255 RefreshTime << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
1269__STATIC_INLINE uint32_t LL_DAC_GetSampleAndHoldRefreshTime(
const DAC_TypeDef *DACx, uint32_t DAC_Channel)
1272 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
1297__STATIC_INLINE
void LL_DAC_EnableDMAReq(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
1300 DAC_CR_DMAEN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
1315__STATIC_INLINE
void LL_DAC_DisableDMAReq(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
1318 DAC_CR_DMAEN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
1332__STATIC_INLINE uint32_t LL_DAC_IsDMAReqEnabled(
const DAC_TypeDef *DACx, uint32_t DAC_Channel)
1334 return ((READ_BIT(DACx->
CR,
1336 == (
DAC_CR_DMAEN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))) ? 1UL : 0UL);
1371__STATIC_INLINE uint32_t LL_DAC_DMA_GetRegAddr(
const DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t Register)
1375 return ((uint32_t)(__DAC_PTR_REG_OFFSET((DACx)->DHR12R1, ((DAC_Channel >> (Register & 0x1FUL))
1376 & DAC_REG_DHR_REGOFFSET_MASK_POSBIT0))));
1400__STATIC_INLINE
void LL_DAC_Enable(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
1403 DAC_CR_EN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
1416__STATIC_INLINE
void LL_DAC_Disable(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
1419 DAC_CR_EN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
1433__STATIC_INLINE uint32_t LL_DAC_IsEnabled(
const DAC_TypeDef *DACx, uint32_t DAC_Channel)
1435 return ((READ_BIT(DACx->
CR,
1436 DAC_CR_EN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
1437 == (
DAC_CR_EN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))) ? 1UL : 0UL);
1458__STATIC_INLINE
void LL_DAC_EnableTrigger(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
1461 DAC_CR_TEN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
1474__STATIC_INLINE
void LL_DAC_DisableTrigger(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
1477 DAC_CR_TEN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
1491__STATIC_INLINE uint32_t LL_DAC_IsTriggerEnabled(
const DAC_TypeDef *DACx, uint32_t DAC_Channel)
1493 return ((READ_BIT(DACx->
CR,
1494 DAC_CR_TEN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
1495 == (
DAC_CR_TEN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))) ? 1UL : 0UL);
1519__STATIC_INLINE
void LL_DAC_TrigSWConversion(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
1522 (DAC_Channel & DAC_SWTR_CHX_MASK));
1538__STATIC_INLINE
void LL_DAC_ConvertData12RightAligned(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t Data)
1540 __IO uint32_t *preg = __DAC_PTR_REG_OFFSET(DACx->
DHR12R1, (DAC_Channel >> DAC_REG_DHR12RX_REGOFFSET_BITOFFSET_POS)
1541 & DAC_REG_DHR_REGOFFSET_MASK_POSBIT0);
1559__STATIC_INLINE
void LL_DAC_ConvertData12LeftAligned(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t Data)
1561 __IO uint32_t *preg = __DAC_PTR_REG_OFFSET(DACx->
DHR12R1, (DAC_Channel >> DAC_REG_DHR12LX_REGOFFSET_BITOFFSET_POS)
1562 & DAC_REG_DHR_REGOFFSET_MASK_POSBIT0);
1580__STATIC_INLINE
void LL_DAC_ConvertData8RightAligned(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t Data)
1582 __IO uint32_t *preg = __DAC_PTR_REG_OFFSET(DACx->
DHR12R1, (DAC_Channel >> DAC_REG_DHR8RX_REGOFFSET_BITOFFSET_POS)
1583 & DAC_REG_DHR_REGOFFSET_MASK_POSBIT0);
1600__STATIC_INLINE
void LL_DAC_ConvertDualData12RightAligned(
DAC_TypeDef *DACx, uint32_t DataChannel1,
1601 uint32_t DataChannel2)
1605 ((DataChannel2 << DAC_DHR12RD_DACC2DHR_BITOFFSET_POS) | DataChannel1));
1619__STATIC_INLINE
void LL_DAC_ConvertDualData12LeftAligned(
DAC_TypeDef *DACx, uint32_t DataChannel1,
1620 uint32_t DataChannel2)
1627 ((DataChannel2 << (DAC_DHR12LD_DACC2DHR_BITOFFSET_POS - 4U)) | DataChannel1));
1641__STATIC_INLINE
void LL_DAC_ConvertDualData8RightAligned(
DAC_TypeDef *DACx, uint32_t DataChannel1,
1642 uint32_t DataChannel2)
1646 ((DataChannel2 << DAC_DHR8RD_DACC2DHR_BITOFFSET_POS) | DataChannel1));
1664__STATIC_INLINE uint32_t LL_DAC_RetrieveOutputData(
const DAC_TypeDef *DACx, uint32_t DAC_Channel)
1666 __IO uint32_t
const *preg = __DAC_PTR_REG_OFFSET(DACx->
DOR1, (DAC_Channel >> DAC_REG_DORX_REGOFFSET_BITOFFSET_POS)
1667 & DAC_REG_DORX_REGOFFSET_MASK_POSBIT0);
1687__STATIC_INLINE uint32_t LL_DAC_IsActiveFlag_CAL1(
const DAC_TypeDef *DACx)
1689 return ((READ_BIT(DACx->
SR, LL_DAC_FLAG_CAL1) == (LL_DAC_FLAG_CAL1)) ? 1UL : 0UL);
1699__STATIC_INLINE uint32_t LL_DAC_IsActiveFlag_CAL2(
const DAC_TypeDef *DACx)
1701 return ((READ_BIT(DACx->
SR, LL_DAC_FLAG_CAL2) == (LL_DAC_FLAG_CAL2)) ? 1UL : 0UL);
1711__STATIC_INLINE uint32_t LL_DAC_IsActiveFlag_BWST1(
const DAC_TypeDef *DACx)
1713 return ((READ_BIT(DACx->
SR, LL_DAC_FLAG_BWST1) == (LL_DAC_FLAG_BWST1)) ? 1UL : 0UL);
1722__STATIC_INLINE uint32_t LL_DAC_IsActiveFlag_BWST2(
const DAC_TypeDef *DACx)
1724 return ((READ_BIT(DACx->
SR, LL_DAC_FLAG_BWST2) == (LL_DAC_FLAG_BWST2)) ? 1UL : 0UL);
1734__STATIC_INLINE uint32_t LL_DAC_IsActiveFlag_DMAUDR1(
const DAC_TypeDef *DACx)
1736 return ((READ_BIT(DACx->
SR, LL_DAC_FLAG_DMAUDR1) == (LL_DAC_FLAG_DMAUDR1)) ? 1UL : 0UL);
1746__STATIC_INLINE uint32_t LL_DAC_IsActiveFlag_DMAUDR2(
const DAC_TypeDef *DACx)
1748 return ((READ_BIT(DACx->
SR, LL_DAC_FLAG_DMAUDR2) == (LL_DAC_FLAG_DMAUDR2)) ? 1UL : 0UL);
1758__STATIC_INLINE
void LL_DAC_ClearFlag_DMAUDR1(
DAC_TypeDef *DACx)
1760 WRITE_REG(DACx->
SR, LL_DAC_FLAG_DMAUDR1);
1770__STATIC_INLINE
void LL_DAC_ClearFlag_DMAUDR2(
DAC_TypeDef *DACx)
1772 WRITE_REG(DACx->
SR, LL_DAC_FLAG_DMAUDR2);
1791__STATIC_INLINE
void LL_DAC_EnableIT_DMAUDR1(
DAC_TypeDef *DACx)
1793 SET_BIT(DACx->
CR, LL_DAC_IT_DMAUDRIE1);
1803__STATIC_INLINE
void LL_DAC_EnableIT_DMAUDR2(
DAC_TypeDef *DACx)
1805 SET_BIT(DACx->
CR, LL_DAC_IT_DMAUDRIE2);
1815__STATIC_INLINE
void LL_DAC_DisableIT_DMAUDR1(
DAC_TypeDef *DACx)
1817 CLEAR_BIT(DACx->
CR, LL_DAC_IT_DMAUDRIE1);
1827__STATIC_INLINE
void LL_DAC_DisableIT_DMAUDR2(
DAC_TypeDef *DACx)
1829 CLEAR_BIT(DACx->
CR, LL_DAC_IT_DMAUDRIE2);
1839__STATIC_INLINE uint32_t LL_DAC_IsEnabledIT_DMAUDR1(
const DAC_TypeDef *DACx)
1841 return ((READ_BIT(DACx->
CR, LL_DAC_IT_DMAUDRIE1) == (LL_DAC_IT_DMAUDRIE1)) ? 1UL : 0UL);
1851__STATIC_INLINE uint32_t LL_DAC_IsEnabledIT_DMAUDR2(
const DAC_TypeDef *DACx)
1853 return ((READ_BIT(DACx->
CR, LL_DAC_IT_DMAUDRIE2) == (LL_DAC_IT_DMAUDRIE2)) ? 1UL : 0UL);
1861#if defined(USE_FULL_LL_DRIVER) || defined(__rtems__)
1867ErrorStatus LL_DAC_DeInit(
const DAC_TypeDef *DACx);
1868ErrorStatus LL_DAC_Init(
DAC_TypeDef *DACx, uint32_t DAC_Channel,
const LL_DAC_InitTypeDef *DAC_InitStruct);
1869void LL_DAC_StructInit(LL_DAC_InitTypeDef *DAC_InitStruct);
#define __IO
Definition: core_cm4.h:239
#define DAC_SHRR_TREFRESH1
Definition: stm32h723xx.h:6125
#define DAC_MCR_MODE1_1
Definition: stm32h723xx.h:6094
#define DAC_DHR12L1_DACC1DHR
Definition: stm32h723xx.h:6004
#define DAC_DHR12LD_DACC1DHR
Definition: stm32h723xx.h:6037
#define DAC_CCR_OTRIM1
Definition: stm32h723xx.h:6084
#define DAC_CR_MAMP1
Definition: stm32h723xx.h:5932
#define DAC_DHR12RD_DACC2DHR
Definition: stm32h723xx.h:6032
#define DAC_CR_CEN1
Definition: stm32h723xx.h:5946
#define DAC_SHHR_THOLD1
Definition: stm32h723xx.h:6117
#define DAC_DHR12R1_DACC1DHR
Definition: stm32h723xx.h:5999
#define DAC_DOR1_DACC1DOR
Definition: stm32h723xx.h:6053
#define DAC_DHR12LD_DACC2DHR
Definition: stm32h723xx.h:6040
#define DAC_CR_WAVE1
Definition: stm32h723xx.h:5926
#define DAC_CR_DMAEN1
Definition: stm32h723xx.h:5940
#define DAC_CR_TEN1
Definition: stm32h723xx.h:5913
#define DAC_DHR8RD_DACC1DHR
Definition: stm32h723xx.h:6045
#define DAC_SHSR1_TSAMPLE1
Definition: stm32h723xx.h:6107
#define DAC_MCR_MODE1_2
Definition: stm32h723xx.h:6095
#define DAC_CR_EN1
Definition: stm32h723xx.h:5910
#define DAC_DHR12RD_DACC1DHR
Definition: stm32h723xx.h:6029
#define DAC_DHR8R1_DACC1DHR
Definition: stm32h723xx.h:6009
#define DAC_DHR8RD_DACC2DHR
Definition: stm32h723xx.h:6048
#define DAC_MCR_MODE1_0
Definition: stm32h723xx.h:6093
#define DAC_CR_TSEL1
Definition: stm32h723xx.h:5917
CMSIS STM32H7xx Device Peripheral Access Layer Header File.
Digital to Analog Converter.
Definition: stm32h723xx.h:469
__IO uint32_t DHR8RD
Definition: stm32h723xx.h:480
__IO uint32_t SR
Definition: stm32h723xx.h:483
__IO uint32_t CR
Definition: stm32h723xx.h:470
__IO uint32_t MCR
Definition: stm32h723xx.h:485
__IO uint32_t SWTRIGR
Definition: stm32h723xx.h:471
__IO uint32_t DOR1
Definition: stm32h723xx.h:481
__IO uint32_t SHHR
Definition: stm32h723xx.h:488
__IO uint32_t CCR
Definition: stm32h723xx.h:484
__IO uint32_t SHSR1
Definition: stm32h723xx.h:486
__IO uint32_t SHRR
Definition: stm32h723xx.h:489
__IO uint32_t DHR12LD
Definition: stm32h723xx.h:479
__IO uint32_t DHR12R1
Definition: stm32h723xx.h:472
__IO uint32_t DHR12RD
Definition: stm32h723xx.h:478