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__,\
585 __DAC_RESOLUTION__) \
586((__DAC_VOLTAGE__) * __LL_DAC_DIGITAL_SCALE(__DAC_RESOLUTION__) \
587 / (__VREFANALOG_VOLTAGE__) \
623__STATIC_INLINE
void LL_DAC_SetMode(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t ChannelMode)
626 DAC_CR_CEN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK),
627 ChannelMode << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
643__STATIC_INLINE uint32_t LL_DAC_GetMode(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
645 return (uint32_t)(READ_BIT(DACx->
CR,
DAC_CR_CEN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
646 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
663__STATIC_INLINE
void LL_DAC_SetTrimmingValue(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t TrimmingValue)
665 MODIFY_REG(DACx->
CCR,
667 TrimmingValue << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
682__STATIC_INLINE uint32_t LL_DAC_GetTrimmingValue(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
684 return (uint32_t)(READ_BIT(DACx->
CCR,
DAC_CCR_OTRIM1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
685 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
731__STATIC_INLINE
void LL_DAC_SetTriggerSource(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t TriggerSource)
734 DAC_CR_TSEL1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK),
735 TriggerSource << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
777__STATIC_INLINE uint32_t LL_DAC_GetTriggerSource(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
779 return (uint32_t)(READ_BIT(DACx->
CR,
DAC_CR_TSEL1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
780 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
799__STATIC_INLINE
void LL_DAC_SetWaveAutoGeneration(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t WaveAutoGeneration)
802 DAC_CR_WAVE1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK),
803 WaveAutoGeneration << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
820__STATIC_INLINE uint32_t LL_DAC_GetWaveAutoGeneration(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
822 return (uint32_t)(READ_BIT(DACx->
CR,
DAC_CR_WAVE1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
823 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
856__STATIC_INLINE
void LL_DAC_SetWaveNoiseLFSR(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t NoiseLFSRMask)
859 DAC_CR_MAMP1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK),
860 NoiseLFSRMask << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
886__STATIC_INLINE uint32_t LL_DAC_GetWaveNoiseLFSR(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
888 return (uint32_t)(READ_BIT(DACx->
CR,
DAC_CR_MAMP1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
889 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
922__STATIC_INLINE
void LL_DAC_SetWaveTriangleAmplitude(
DAC_TypeDef *DACx, uint32_t DAC_Channel,
923 uint32_t TriangleAmplitude)
926 DAC_CR_MAMP1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK),
927 TriangleAmplitude << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
953__STATIC_INLINE uint32_t LL_DAC_GetWaveTriangleAmplitude(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
955 return (uint32_t)(READ_BIT(DACx->
CR,
DAC_CR_MAMP1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
956 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
1004__STATIC_INLINE
void LL_DAC_ConfigOutput(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t OutputMode,
1005 uint32_t OutputBuffer, uint32_t OutputConnection)
1007 MODIFY_REG(DACx->
MCR,
1009 (OutputMode | OutputBuffer | OutputConnection) << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
1032__STATIC_INLINE
void LL_DAC_SetOutputMode(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t OutputMode)
1034 MODIFY_REG(DACx->
MCR,
1035 (uint32_t)
DAC_MCR_MODE1_2 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK),
1036 OutputMode << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
1051__STATIC_INLINE uint32_t LL_DAC_GetOutputMode(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
1053 return (uint32_t)(READ_BIT(DACx->
MCR, (uint32_t)
DAC_MCR_MODE1_2 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
1054 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
1075__STATIC_INLINE
void LL_DAC_SetOutputBuffer(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t OutputBuffer)
1077 MODIFY_REG(DACx->
MCR,
1078 (uint32_t)
DAC_MCR_MODE1_1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK),
1079 OutputBuffer << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
1094__STATIC_INLINE uint32_t LL_DAC_GetOutputBuffer(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
1096 return (uint32_t)(READ_BIT(DACx->
MCR, (uint32_t)
DAC_MCR_MODE1_1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
1097 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
1124__STATIC_INLINE
void LL_DAC_SetOutputConnection(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t OutputConnection)
1126 MODIFY_REG(DACx->
MCR,
1127 (uint32_t)
DAC_MCR_MODE1_0 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK),
1128 OutputConnection << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
1153__STATIC_INLINE uint32_t LL_DAC_GetOutputConnection(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
1155 return (uint32_t)(READ_BIT(DACx->
MCR, (uint32_t)
DAC_MCR_MODE1_0 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
1156 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
1176__STATIC_INLINE
void LL_DAC_SetSampleAndHoldSampleTime(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t SampleTime)
1178 __IO uint32_t *preg = __DAC_PTR_REG_OFFSET(DACx->
SHSR1, (DAC_Channel >> DAC_REG_SHSRX_REGOFFSET_BITOFFSET_POS)
1179 & DAC_REG_SHSRX_REGOFFSET_MASK_POSBIT0);
1195__STATIC_INLINE uint32_t LL_DAC_GetSampleAndHoldSampleTime(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
1197 __IO uint32_t
const *preg = __DAC_PTR_REG_OFFSET(DACx->
SHSR1, (DAC_Channel >> DAC_REG_SHSRX_REGOFFSET_BITOFFSET_POS)
1198 & DAC_REG_SHSRX_REGOFFSET_MASK_POSBIT0);
1215__STATIC_INLINE
void LL_DAC_SetSampleAndHoldHoldTime(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t HoldTime)
1217 MODIFY_REG(DACx->
SHHR,
1219 HoldTime << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
1233__STATIC_INLINE uint32_t LL_DAC_GetSampleAndHoldHoldTime(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
1235 return (uint32_t)(READ_BIT(DACx->
SHHR,
DAC_SHHR_THOLD1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
1236 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
1252__STATIC_INLINE
void LL_DAC_SetSampleAndHoldRefreshTime(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t RefreshTime)
1254 MODIFY_REG(DACx->
SHRR,
1256 RefreshTime << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
1270__STATIC_INLINE uint32_t LL_DAC_GetSampleAndHoldRefreshTime(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
1273 >> (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK)
1298__STATIC_INLINE
void LL_DAC_EnableDMAReq(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
1301 DAC_CR_DMAEN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
1316__STATIC_INLINE
void LL_DAC_DisableDMAReq(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
1319 DAC_CR_DMAEN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
1333__STATIC_INLINE uint32_t LL_DAC_IsDMAReqEnabled(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
1335 return ((READ_BIT(DACx->
CR,
1337 == (
DAC_CR_DMAEN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))) ? 1UL : 0UL);
1372__STATIC_INLINE uint32_t LL_DAC_DMA_GetRegAddr(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t Register)
1376 return ((uint32_t)(__DAC_PTR_REG_OFFSET((DACx)->DHR12R1, ((DAC_Channel >> (Register & 0x1FUL))
1377 & DAC_REG_DHR_REGOFFSET_MASK_POSBIT0))));
1401__STATIC_INLINE
void LL_DAC_Enable(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
1404 DAC_CR_EN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
1417__STATIC_INLINE
void LL_DAC_Disable(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
1420 DAC_CR_EN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
1434__STATIC_INLINE uint32_t LL_DAC_IsEnabled(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
1436 return ((READ_BIT(DACx->
CR,
1437 DAC_CR_EN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
1438 == (
DAC_CR_EN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))) ? 1UL : 0UL);
1459__STATIC_INLINE
void LL_DAC_EnableTrigger(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
1462 DAC_CR_TEN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
1475__STATIC_INLINE
void LL_DAC_DisableTrigger(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
1478 DAC_CR_TEN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK));
1492__STATIC_INLINE uint32_t LL_DAC_IsTriggerEnabled(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
1494 return ((READ_BIT(DACx->
CR,
1495 DAC_CR_TEN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))
1496 == (
DAC_CR_TEN1 << (DAC_Channel & DAC_CR_CHX_BITOFFSET_MASK))) ? 1UL : 0UL);
1520__STATIC_INLINE
void LL_DAC_TrigSWConversion(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
1523 (DAC_Channel & DAC_SWTR_CHX_MASK));
1539__STATIC_INLINE
void LL_DAC_ConvertData12RightAligned(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t Data)
1541 __IO uint32_t *preg = __DAC_PTR_REG_OFFSET(DACx->
DHR12R1, (DAC_Channel >> DAC_REG_DHR12RX_REGOFFSET_BITOFFSET_POS)
1542 & DAC_REG_DHR_REGOFFSET_MASK_POSBIT0);
1560__STATIC_INLINE
void LL_DAC_ConvertData12LeftAligned(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t Data)
1562 __IO uint32_t *preg = __DAC_PTR_REG_OFFSET(DACx->
DHR12R1, (DAC_Channel >> DAC_REG_DHR12LX_REGOFFSET_BITOFFSET_POS)
1563 & DAC_REG_DHR_REGOFFSET_MASK_POSBIT0);
1581__STATIC_INLINE
void LL_DAC_ConvertData8RightAligned(
DAC_TypeDef *DACx, uint32_t DAC_Channel, uint32_t Data)
1583 __IO uint32_t *preg = __DAC_PTR_REG_OFFSET(DACx->
DHR12R1, (DAC_Channel >> DAC_REG_DHR8RX_REGOFFSET_BITOFFSET_POS)
1584 & DAC_REG_DHR_REGOFFSET_MASK_POSBIT0);
1601__STATIC_INLINE
void LL_DAC_ConvertDualData12RightAligned(
DAC_TypeDef *DACx, uint32_t DataChannel1,
1602 uint32_t DataChannel2)
1606 ((DataChannel2 << DAC_DHR12RD_DACC2DHR_BITOFFSET_POS) | DataChannel1));
1620__STATIC_INLINE
void LL_DAC_ConvertDualData12LeftAligned(
DAC_TypeDef *DACx, uint32_t DataChannel1,
1621 uint32_t DataChannel2)
1628 ((DataChannel2 << (DAC_DHR12LD_DACC2DHR_BITOFFSET_POS - 4U)) | DataChannel1));
1642__STATIC_INLINE
void LL_DAC_ConvertDualData8RightAligned(
DAC_TypeDef *DACx, uint32_t DataChannel1,
1643 uint32_t DataChannel2)
1647 ((DataChannel2 << DAC_DHR8RD_DACC2DHR_BITOFFSET_POS) | DataChannel1));
1665__STATIC_INLINE uint32_t LL_DAC_RetrieveOutputData(
DAC_TypeDef *DACx, uint32_t DAC_Channel)
1667 __IO uint32_t
const *preg = __DAC_PTR_REG_OFFSET(DACx->
DOR1, (DAC_Channel >> DAC_REG_DORX_REGOFFSET_BITOFFSET_POS)
1668 & DAC_REG_DORX_REGOFFSET_MASK_POSBIT0);
1688__STATIC_INLINE uint32_t LL_DAC_IsActiveFlag_CAL1(
DAC_TypeDef *DACx)
1690 return ((READ_BIT(DACx->
SR, LL_DAC_FLAG_CAL1) == (LL_DAC_FLAG_CAL1)) ? 1UL : 0UL);
1700__STATIC_INLINE uint32_t LL_DAC_IsActiveFlag_CAL2(
DAC_TypeDef *DACx)
1702 return ((READ_BIT(DACx->
SR, LL_DAC_FLAG_CAL2) == (LL_DAC_FLAG_CAL2)) ? 1UL : 0UL);
1712__STATIC_INLINE uint32_t LL_DAC_IsActiveFlag_BWST1(
DAC_TypeDef *DACx)
1714 return ((READ_BIT(DACx->
SR, LL_DAC_FLAG_BWST1) == (LL_DAC_FLAG_BWST1)) ? 1UL : 0UL);
1723__STATIC_INLINE uint32_t LL_DAC_IsActiveFlag_BWST2(
DAC_TypeDef *DACx)
1725 return ((READ_BIT(DACx->
SR, LL_DAC_FLAG_BWST2) == (LL_DAC_FLAG_BWST2)) ? 1UL : 0UL);
1735__STATIC_INLINE uint32_t LL_DAC_IsActiveFlag_DMAUDR1(
DAC_TypeDef *DACx)
1737 return ((READ_BIT(DACx->
SR, LL_DAC_FLAG_DMAUDR1) == (LL_DAC_FLAG_DMAUDR1)) ? 1UL : 0UL);
1747__STATIC_INLINE uint32_t LL_DAC_IsActiveFlag_DMAUDR2(
DAC_TypeDef *DACx)
1749 return ((READ_BIT(DACx->
SR, LL_DAC_FLAG_DMAUDR2) == (LL_DAC_FLAG_DMAUDR2)) ? 1UL : 0UL);
1759__STATIC_INLINE
void LL_DAC_ClearFlag_DMAUDR1(
DAC_TypeDef *DACx)
1761 WRITE_REG(DACx->
SR, LL_DAC_FLAG_DMAUDR1);
1771__STATIC_INLINE
void LL_DAC_ClearFlag_DMAUDR2(
DAC_TypeDef *DACx)
1773 WRITE_REG(DACx->
SR, LL_DAC_FLAG_DMAUDR2);
1792__STATIC_INLINE
void LL_DAC_EnableIT_DMAUDR1(
DAC_TypeDef *DACx)
1794 SET_BIT(DACx->
CR, LL_DAC_IT_DMAUDRIE1);
1804__STATIC_INLINE
void LL_DAC_EnableIT_DMAUDR2(
DAC_TypeDef *DACx)
1806 SET_BIT(DACx->
CR, LL_DAC_IT_DMAUDRIE2);
1816__STATIC_INLINE
void LL_DAC_DisableIT_DMAUDR1(
DAC_TypeDef *DACx)
1818 CLEAR_BIT(DACx->
CR, LL_DAC_IT_DMAUDRIE1);
1828__STATIC_INLINE
void LL_DAC_DisableIT_DMAUDR2(
DAC_TypeDef *DACx)
1830 CLEAR_BIT(DACx->
CR, LL_DAC_IT_DMAUDRIE2);
1840__STATIC_INLINE uint32_t LL_DAC_IsEnabledIT_DMAUDR1(
DAC_TypeDef *DACx)
1842 return ((READ_BIT(DACx->
CR, LL_DAC_IT_DMAUDRIE1) == (LL_DAC_IT_DMAUDRIE1)) ? 1UL : 0UL);
1852__STATIC_INLINE uint32_t LL_DAC_IsEnabledIT_DMAUDR2(
DAC_TypeDef *DACx)
1854 return ((READ_BIT(DACx->
CR, LL_DAC_IT_DMAUDRIE2) == (LL_DAC_IT_DMAUDRIE2)) ? 1UL : 0UL);
1862#if defined(USE_FULL_LL_DRIVER) || defined(__rtems__)
1869ErrorStatus LL_DAC_Init(
DAC_TypeDef *DACx, uint32_t DAC_Channel, LL_DAC_InitTypeDef *DAC_InitStruct);
1870void LL_DAC_StructInit(LL_DAC_InitTypeDef *DAC_InitStruct);
#define __IO
Definition: core_cm4.h:239
#define DAC_SHRR_TREFRESH1
Definition: stm32h723xx.h:6117
#define DAC_MCR_MODE1_1
Definition: stm32h723xx.h:6086
#define DAC_DHR12L1_DACC1DHR
Definition: stm32h723xx.h:5996
#define DAC_DHR12LD_DACC1DHR
Definition: stm32h723xx.h:6029
#define DAC_CCR_OTRIM1
Definition: stm32h723xx.h:6076
#define DAC_CR_MAMP1
Definition: stm32h723xx.h:5924
#define DAC_DHR12RD_DACC2DHR
Definition: stm32h723xx.h:6024
#define DAC_CR_CEN1
Definition: stm32h723xx.h:5938
#define DAC_SHHR_THOLD1
Definition: stm32h723xx.h:6109
#define DAC_DHR12R1_DACC1DHR
Definition: stm32h723xx.h:5991
#define DAC_DOR1_DACC1DOR
Definition: stm32h723xx.h:6045
#define DAC_DHR12LD_DACC2DHR
Definition: stm32h723xx.h:6032
#define DAC_CR_WAVE1
Definition: stm32h723xx.h:5918
#define DAC_CR_DMAEN1
Definition: stm32h723xx.h:5932
#define DAC_CR_TEN1
Definition: stm32h723xx.h:5905
#define DAC_DHR8RD_DACC1DHR
Definition: stm32h723xx.h:6037
#define DAC_SHSR1_TSAMPLE1
Definition: stm32h723xx.h:6099
#define DAC_MCR_MODE1_2
Definition: stm32h723xx.h:6087
#define DAC_CR_EN1
Definition: stm32h723xx.h:5902
#define DAC_DHR12RD_DACC1DHR
Definition: stm32h723xx.h:6021
#define DAC_DHR8R1_DACC1DHR
Definition: stm32h723xx.h:6001
#define DAC_DHR8RD_DACC2DHR
Definition: stm32h723xx.h:6040
#define DAC_MCR_MODE1_0
Definition: stm32h723xx.h:6085
#define DAC_CR_TSEL1
Definition: stm32h723xx.h:5909
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