STM32F439xx HAL User Manual
Defines
DAC helper macro
DAC Exported Macros

Defines

#define __LL_DAC_CHANNEL_TO_DECIMAL_NB(__CHANNEL__)   ((__CHANNEL__) & DAC_SWTR_CHX_MASK)
 Helper macro to get DAC channel number in decimal format from literals LL_DAC_CHANNEL_x.
#define __LL_DAC_DECIMAL_NB_TO_CHANNEL(__DECIMAL_NB__)
 Helper macro to get DAC channel in literal format LL_DAC_CHANNEL_x from number in decimal format.
#define __LL_DAC_DIGITAL_SCALE(__DAC_RESOLUTION__)   ((0x00000FFFU) >> ((__DAC_RESOLUTION__) << 1U))
 Helper macro to define the DAC conversion data full-scale digital value corresponding to the selected DAC resolution.
#define __LL_DAC_CALC_VOLTAGE_TO_DATA(__VREFANALOG_VOLTAGE__, __DAC_VOLTAGE__, __DAC_RESOLUTION__)
 Helper macro to calculate the DAC conversion data (unit: digital value) corresponding to a voltage (unit: mVolt).

Define Documentation

#define __LL_DAC_CALC_VOLTAGE_TO_DATA (   __VREFANALOG_VOLTAGE__,
  __DAC_VOLTAGE__,
  __DAC_RESOLUTION__ 
)
Value:
((__DAC_VOLTAGE__) * __LL_DAC_DIGITAL_SCALE(__DAC_RESOLUTION__)              \
   / (__VREFANALOG_VOLTAGE__)                                                  \
  )

Helper macro to calculate the DAC conversion data (unit: digital value) corresponding to a voltage (unit: mVolt).

Note:
This helper macro is intended to provide input data in voltage rather than digital value, to be used with LL DAC functions such as LL_DAC_ConvertData12RightAligned().
Analog reference voltage (Vref+) must be either known from user board environment or can be calculated using ADC measurement and ADC helper macro __LL_ADC_CALC_VREFANALOG_VOLTAGE().
Parameters:
__VREFANALOG_VOLTAGE__Analog reference voltage (unit mV)
__DAC_VOLTAGE__Voltage to be generated by DAC channel (unit: mVolt).
__DAC_RESOLUTION__This parameter can be one of the following values:
Return values:
DACconversion data (unit: digital value)

Definition at line 502 of file stm32f4xx_ll_dac.h.

#define __LL_DAC_CHANNEL_TO_DECIMAL_NB (   __CHANNEL__)    ((__CHANNEL__) & DAC_SWTR_CHX_MASK)

Helper macro to get DAC channel number in decimal format from literals LL_DAC_CHANNEL_x.

Example: __LL_DAC_CHANNEL_TO_DECIMAL_NB(LL_DAC_CHANNEL_1) will return decimal number "1".

Note:
The input can be a value from functions where a channel number is returned.
Parameters:
__CHANNEL__This parameter can be one of the following values: (1) On this STM32 serie, parameter not available on all devices. Refer to device datasheet for channels availability.
Return values:
1...2(value "2" depending on DAC channel 2 availability)

Definition at line 421 of file stm32f4xx_ll_dac.h.

#define __LL_DAC_DECIMAL_NB_TO_CHANNEL (   __DECIMAL_NB__)
Value:
(((__DECIMAL_NB__) == 1U)                                                     \
    ? (                                                                        \
       LL_DAC_CHANNEL_1                                                        \
      )                                                                        \
      :                                                                        \
      (((__DECIMAL_NB__) == 2U)                                                 \
        ? (                                                                    \
           LL_DAC_CHANNEL_2                                                    \
          )                                                                    \
          :                                                                    \
          (                                                                    \
           0                                                                   \
          )                                                                    \
      )                                                                        \
  )

Helper macro to get DAC channel in literal format LL_DAC_CHANNEL_x from number in decimal format.

Example: __LL_DAC_DECIMAL_NB_TO_CHANNEL(1) will return a data equivalent to "LL_DAC_CHANNEL_1".

Note:
If the input parameter does not correspond to a DAC channel, this macro returns value '0'.
Parameters:
__DECIMAL_NB__1...2 (value "2" depending on DAC channel 2 availability)
Return values:
Returnedvalue can be one of the following values: (1) On this STM32 serie, parameter not available on all devices. Refer to device datasheet for channels availability.

Definition at line 441 of file stm32f4xx_ll_dac.h.

#define __LL_DAC_DIGITAL_SCALE (   __DAC_RESOLUTION__)    ((0x00000FFFU) >> ((__DAC_RESOLUTION__) << 1U))

Helper macro to define the DAC conversion data full-scale digital value corresponding to the selected DAC resolution.

Note:
DAC conversion data full-scale corresponds to voltage range determined by analog voltage references Vref+ and Vref- (refer to reference manual).
Parameters:
__DAC_RESOLUTION__This parameter can be one of the following values:
Return values:
ADCconversion data equivalent voltage value (unit: mVolt)

Definition at line 481 of file stm32f4xx_ll_dac.h.