RTEMS 6.1-rc7
Loading...
Searching...
No Matches
Macros

Macros

#define __HAL_ADC_CHANNEL_TO_DECIMAL_NB(__CHANNEL__)    __LL_ADC_CHANNEL_TO_DECIMAL_NB((__CHANNEL__))
 Helper macro to get ADC channel number in decimal format from literals ADC_CHANNEL_x.
 
#define __HAL_ADC_DECIMAL_NB_TO_CHANNEL(__DECIMAL_NB__)    __LL_ADC_DECIMAL_NB_TO_CHANNEL((__DECIMAL_NB__))
 Helper macro to get ADC channel in literal format ADC_CHANNEL_x from number in decimal format.
 
#define __HAL_ADC_IS_CHANNEL_INTERNAL(__CHANNEL__)    __LL_ADC_IS_CHANNEL_INTERNAL((__CHANNEL__))
 Helper macro to determine whether the selected channel corresponds to literal definitions of driver.
 
#define __HAL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL(__CHANNEL__)    __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL((__CHANNEL__))
 Helper macro to convert a channel defined from parameter definition of a ADC internal channel (ADC_CHANNEL_VREFINT, ADC_CHANNEL_TEMPSENSOR, ...), to its equivalent parameter definition of a ADC external channel (ADC_CHANNEL_1, ADC_CHANNEL_2, ...).
 
#define __HAL_ADC_IS_CHANNEL_INTERNAL_AVAILABLE(__ADC_INSTANCE__, __CHANNEL__)    __LL_ADC_IS_CHANNEL_INTERNAL_AVAILABLE((__ADC_INSTANCE__), (__CHANNEL__))
 Helper macro to determine whether the internal channel selected is available on the ADC instance selected.
 
#define __HAL_ADC_MULTI_CONV_DATA_MASTER_SLAVE(__ADC_MULTI_MASTER_SLAVE__, __ADC_MULTI_CONV_DATA__)    __LL_ADC_MULTI_CONV_DATA_MASTER_SLAVE((__ADC_MULTI_MASTER_SLAVE__), (__ADC_MULTI_CONV_DATA__))
 Helper macro to get the ADC multimode conversion data of ADC master or ADC slave from raw value with both ADC conversion data concatenated.
 
#define __HAL_ADC_COMMON_INSTANCE(__ADCx__)    __LL_ADC_COMMON_INSTANCE((__ADCx__))
 Helper macro to select the ADC common instance to which is belonging the selected ADC instance.
 
#define __HAL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE(__ADCXY_COMMON__)    __LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE((__ADCXY_COMMON__))
 Helper macro to check if all ADC instances sharing the same ADC common instance are disabled.
 
#define __HAL_ADC_DIGITAL_SCALE(__ADC_RESOLUTION__)    __LL_ADC_DIGITAL_SCALE((__ADC_RESOLUTION__))
 Helper macro to define the ADC conversion data full-scale digital value corresponding to the selected ADC resolution.
 
#define __HAL_ADC_CONVERT_DATA_RESOLUTION(__DATA__, __ADC_RESOLUTION_CURRENT__, __ADC_RESOLUTION_TARGET__)
 Helper macro to convert the ADC conversion data from a resolution to another resolution.
 
#define __HAL_ADC_CALC_DATA_TO_VOLTAGE(__VREFANALOG_VOLTAGE__, __ADC_DATA__, __ADC_RESOLUTION__)
 Helper macro to calculate the voltage (unit: mVolt) corresponding to a ADC conversion data (unit: digital value).
 
#define __HAL_ADC_CALC_VREFANALOG_VOLTAGE(__VREFINT_ADC_DATA__, __ADC_RESOLUTION__)
 Helper macro to calculate analog reference voltage (Vref+) (unit: mVolt) from ADC conversion data of internal voltage reference VrefInt.
 
#define __HAL_ADC_CALC_TEMPERATURE(__VREFANALOG_VOLTAGE__, __TEMPSENSOR_ADC_DATA__, __ADC_RESOLUTION__)
 Helper macro to calculate the temperature (unit: degree Celsius) from ADC conversion data of internal temperature sensor.
 
#define __HAL_ADC_CALC_TEMPERATURE_TYP_PARAMS(__TEMPSENSOR_TYP_AVGSLOPE__, __TEMPSENSOR_TYP_CALX_V__, __TEMPSENSOR_CALX_TEMP__, __VREFANALOG_VOLTAGE__, __TEMPSENSOR_ADC_DATA__, __ADC_RESOLUTION__)
 Helper macro to calculate the temperature (unit: degree Celsius) from ADC conversion data of internal temperature sensor.
 

Detailed Description

Macro Definition Documentation

◆ __HAL_ADC_CALC_DATA_TO_VOLTAGE

#define __HAL_ADC_CALC_DATA_TO_VOLTAGE (   __VREFANALOG_VOLTAGE__,
  __ADC_DATA__,
  __ADC_RESOLUTION__ 
)
Value:
__LL_ADC_CALC_DATA_TO_VOLTAGE((__VREFANALOG_VOLTAGE__),\
(__ADC_DATA__),\
(__ADC_RESOLUTION__))

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

Note
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)
__ADC_DATA__ADC conversion data (resolution 12 bits) (unit: digital value).
__ADC_RESOLUTION__This parameter can be one of the following values:
Return values
ADCconversion data equivalent voltage value (unit: mVolt)

◆ __HAL_ADC_CALC_TEMPERATURE

#define __HAL_ADC_CALC_TEMPERATURE (   __VREFANALOG_VOLTAGE__,
  __TEMPSENSOR_ADC_DATA__,
  __ADC_RESOLUTION__ 
)
Value:
__LL_ADC_CALC_TEMPERATURE((__VREFANALOG_VOLTAGE__),\
(__TEMPSENSOR_ADC_DATA__),\
(__ADC_RESOLUTION__))

Helper macro to calculate the temperature (unit: degree Celsius) from ADC conversion data of internal temperature sensor.

Note
Computation is using temperature sensor calibration values stored in system memory for each device during production.
Calculation formula: Temperature = ((TS_ADC_DATA - TS_CAL1)
  • (TS_CAL2_TEMP - TS_CAL1_TEMP)) / (TS_CAL2 - TS_CAL1) + TS_CAL1_TEMP with TS_ADC_DATA = temperature sensor raw data measured by ADC Avg_Slope = (TS_CAL2 - TS_CAL1) / (TS_CAL2_TEMP - TS_CAL1_TEMP) TS_CAL1 = equivalent TS_ADC_DATA at temperature TEMP_DEGC_CAL1 (calibrated in factory) TS_CAL2 = equivalent TS_ADC_DATA at temperature TEMP_DEGC_CAL2 (calibrated in factory) Caution: Calculation relevancy under reserve that calibration parameters are correct (address and data). To calculate temperature using temperature sensor datasheet typical values (generic values less, therefore less accurate than calibrated values), use helper macro __LL_ADC_CALC_TEMPERATURE_TYP_PARAMS().
As calculation input, the analog reference voltage (Vref+) must be defined as it impacts the ADC LSB equivalent voltage.
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().
On this STM32 series, calibration data of temperature sensor corresponds to a resolution of 12 bits, this is the recommended ADC resolution to convert voltage of temperature sensor. Otherwise, this macro performs the processing to scale ADC conversion data to 12 bits.
Parameters
__VREFANALOG_VOLTAGE__Analog reference voltage (unit: mV)
__TEMPSENSOR_ADC_DATA__ADC conversion data of internal temperature sensor (unit: digital value).
__ADC_RESOLUTION__ADC resolution at which internal temperature sensor voltage has been measured. This parameter can be one of the following values:
Return values
Temperature(unit: degree Celsius)

◆ __HAL_ADC_CALC_TEMPERATURE_TYP_PARAMS

#define __HAL_ADC_CALC_TEMPERATURE_TYP_PARAMS (   __TEMPSENSOR_TYP_AVGSLOPE__,
  __TEMPSENSOR_TYP_CALX_V__,
  __TEMPSENSOR_CALX_TEMP__,
  __VREFANALOG_VOLTAGE__,
  __TEMPSENSOR_ADC_DATA__,
  __ADC_RESOLUTION__ 
)
Value:
__LL_ADC_CALC_TEMPERATURE_TYP_PARAMS((__TEMPSENSOR_TYP_AVGSLOPE__),\
(__TEMPSENSOR_TYP_CALX_V__),\
(__TEMPSENSOR_CALX_TEMP__),\
(__VREFANALOG_VOLTAGE__),\
(__TEMPSENSOR_ADC_DATA__),\
(__ADC_RESOLUTION__))

Helper macro to calculate the temperature (unit: degree Celsius) from ADC conversion data of internal temperature sensor.

Note
Computation is using temperature sensor typical values (refer to device datasheet).
Calculation formula: Temperature = (TS_TYP_CALx_VOLT(uV) - TS_ADC_DATA * Conversion_uV) / Avg_Slope + CALx_TEMP with TS_ADC_DATA = temperature sensor raw data measured by ADC (unit: digital value) Avg_Slope = temperature sensor slope (unit: uV/Degree Celsius) TS_TYP_CALx_VOLT = temperature sensor digital value at temperature CALx_TEMP (unit: mV) Caution: Calculation relevancy under reserve the temperature sensor of the current device has characteristics in line with datasheet typical values. If temperature sensor calibration values are available on on this device (presence of macro __LL_ADC_CALC_TEMPERATURE()), temperature calculation will be more accurate using helper macro __LL_ADC_CALC_TEMPERATURE().
As calculation input, the analog reference voltage (Vref+) must be defined as it impacts the ADC LSB equivalent voltage.
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().
ADC measurement data must correspond to a resolution of 12bits (full scale digital value 4095). If not the case, the data must be preliminarily rescaled to an equivalent resolution of 12 bits.
Parameters
__TEMPSENSOR_TYP_AVGSLOPE__Device datasheet data: Temperature sensor slope typical value (unit: uV/DegCelsius). On STM32H7, refer to device datasheet parameter "Avg_Slope".
__TEMPSENSOR_TYP_CALX_V__Device datasheet data: Temperature sensor voltage typical value (at temperature and Vref+ defined in parameters below) (unit: mV). On STM32H7, refer to device datasheet parameter "V30" (corresponding to TS_CAL1).
__TEMPSENSOR_CALX_TEMP__Device datasheet data: Temperature at which temperature sensor voltage (see parameter above) is corresponding (unit: mV)
__VREFANALOG_VOLTAGE__Analog voltage reference (Vref+) voltage (unit: mV)
__TEMPSENSOR_ADC_DATA__ADC conversion data of internal temperature sensor (unit: digital value).
__ADC_RESOLUTION__ADC resolution at which internal temperature sensor voltage has been measured. This parameter can be one of the following values:
Return values
Temperature(unit: degree Celsius)

◆ __HAL_ADC_CALC_VREFANALOG_VOLTAGE

#define __HAL_ADC_CALC_VREFANALOG_VOLTAGE (   __VREFINT_ADC_DATA__,
  __ADC_RESOLUTION__ 
)
Value:
__LL_ADC_CALC_VREFANALOG_VOLTAGE((__VREFINT_ADC_DATA__),\
(__ADC_RESOLUTION__))

Helper macro to calculate analog reference voltage (Vref+) (unit: mVolt) from ADC conversion data of internal voltage reference VrefInt.

Note
Computation is using VrefInt calibration value stored in system memory for each device during production.
This voltage depends on user board environment: voltage level connected to pin Vref+. On devices with small package, the pin Vref+ is not present and internally bonded to pin Vdda.
On this STM32 series, calibration data of internal voltage reference VrefInt corresponds to a resolution of 12 bits, this is the recommended ADC resolution to convert voltage of internal voltage reference VrefInt. Otherwise, this macro performs the processing to scale ADC conversion data to 12 bits.
Parameters
__VREFINT_ADC_DATA__ADC conversion data (resolution 12 bits) of internal voltage reference VrefInt (unit: digital value).
__ADC_RESOLUTION__This parameter can be one of the following values:
Return values
Analogreference voltage (unit: mV)

◆ __HAL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL

#define __HAL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL (   __CHANNEL__)     __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL((__CHANNEL__))

Helper macro to convert a channel defined from parameter definition of a ADC internal channel (ADC_CHANNEL_VREFINT, ADC_CHANNEL_TEMPSENSOR, ...), to its equivalent parameter definition of a ADC external channel (ADC_CHANNEL_1, ADC_CHANNEL_2, ...).

Note
The channel parameter can be, additionally to a value defined from parameter definition of a ADC internal channel (ADC_CHANNEL_VREFINT, ADC_CHANNEL_TEMPSENSOR, ...), a value defined from parameter definition of ADC external channel (ADC_CHANNEL_1, ADC_CHANNEL_2, ...) or a value from functions where a channel number is returned from ADC registers.
Parameters
__CHANNEL__This parameter can be one of the following values: (1) On STM32H7, parameter available only on ADC instance: ADC3.
(2) On STM32H7, parameter available only on ADC instance: ADC2.
(3) On STM32H7, fast channel (0.125 us for 14-bit resolution (ADC conversion rate up to 8 Ms/s)). Other channels are slow channels (conversion rate: refer to reference manual).
Return values
Returnedvalue can be one of the following values:
  • ADC_CHANNEL_0
  • ADC_CHANNEL_1
  • ADC_CHANNEL_2
  • ADC_CHANNEL_3
  • ADC_CHANNEL_4
  • ADC_CHANNEL_5
  • ADC_CHANNEL_6
  • ADC_CHANNEL_7
  • ADC_CHANNEL_8
  • ADC_CHANNEL_9
  • ADC_CHANNEL_10
  • ADC_CHANNEL_11
  • ADC_CHANNEL_12
  • ADC_CHANNEL_13
  • ADC_CHANNEL_14
  • ADC_CHANNEL_15
  • ADC_CHANNEL_16
  • ADC_CHANNEL_17
  • ADC_CHANNEL_18

◆ __HAL_ADC_CHANNEL_TO_DECIMAL_NB

#define __HAL_ADC_CHANNEL_TO_DECIMAL_NB (   __CHANNEL__)     __LL_ADC_CHANNEL_TO_DECIMAL_NB((__CHANNEL__))

Helper macro to get ADC channel number in decimal format from literals ADC_CHANNEL_x.

Note
Example: __HAL_ADC_CHANNEL_TO_DECIMAL_NB(ADC_CHANNEL_4) will return decimal number "4".
The input can be a value from functions where a channel number is returned, either defined with number or with bitfield (only one bit must be set).
Parameters
__CHANNEL__This parameter can be one of the following values: (1) On STM32H7, parameter available only on ADC instance: ADC3.
(2) On STM32H7, parameter available only on ADC instance: ADC2.
(3) On STM32H7, fast channel (0.125 us for 14-bit resolution (ADC conversion rate up to 8 Ms/s)). Other channels are slow channels (conversion rate: refer to reference manual).
Return values
Valuebetween Min_Data=0 and Max_Data=18

◆ __HAL_ADC_COMMON_INSTANCE

#define __HAL_ADC_COMMON_INSTANCE (   __ADCx__)     __LL_ADC_COMMON_INSTANCE((__ADCx__))

Helper macro to select the ADC common instance to which is belonging the selected ADC instance.

Note
ADC common register instance can be used for:
  • Set parameters common to several ADC instances
  • Multimode (for devices with several ADC instances) Refer to functions having argument "ADCxy_COMMON" as parameter.
Parameters
__ADCx__ADC instance
Return values
ADCcommon register instance

◆ __HAL_ADC_CONVERT_DATA_RESOLUTION

#define __HAL_ADC_CONVERT_DATA_RESOLUTION (   __DATA__,
  __ADC_RESOLUTION_CURRENT__,
  __ADC_RESOLUTION_TARGET__ 
)
Value:
__LL_ADC_CONVERT_DATA_RESOLUTION((__DATA__),\
(__ADC_RESOLUTION_CURRENT__),\
(__ADC_RESOLUTION_TARGET__))

Helper macro to convert the ADC conversion data from a resolution to another resolution.

Parameters
__DATA__ADC conversion data to be converted
__ADC_RESOLUTION_CURRENT__Resolution of to the data to be converted This parameter can be one of the following values:
__ADC_RESOLUTION_TARGET__Resolution of the data after conversion This parameter can be one of the following values:
Return values
ADCconversion data to the requested resolution

◆ __HAL_ADC_DECIMAL_NB_TO_CHANNEL

#define __HAL_ADC_DECIMAL_NB_TO_CHANNEL (   __DECIMAL_NB__)     __LL_ADC_DECIMAL_NB_TO_CHANNEL((__DECIMAL_NB__))

Helper macro to get ADC channel in literal format ADC_CHANNEL_x from number in decimal format.

Note
Example: __HAL_ADC_DECIMAL_NB_TO_CHANNEL(4) will return a data equivalent to "ADC_CHANNEL_4".
Parameters
__DECIMAL_NB__Value between Min_Data=0 and Max_Data=18
Return values
Returnedvalue can be one of the following values: (1) On STM32H7, parameter available only on ADC instance: ADC3.
(2) On STM32H7, parameter available only on ADC instance: ADC2.
(3) On STM32H7, fast channel (0.125 us for 14-bit resolution (ADC conversion rate up to 8 Ms/s)). Other channels are slow channels (conversion rate: refer to reference manual).
(1, 2) For ADC channel read back from ADC register, comparison with internal channel parameter to be done using helper macro __LL_ADC_CHANNEL_INTERNAL_TO_EXTERNAL().

◆ __HAL_ADC_DIGITAL_SCALE

#define __HAL_ADC_DIGITAL_SCALE (   __ADC_RESOLUTION__)     __LL_ADC_DIGITAL_SCALE((__ADC_RESOLUTION__))

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

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

◆ __HAL_ADC_IS_CHANNEL_INTERNAL

#define __HAL_ADC_IS_CHANNEL_INTERNAL (   __CHANNEL__)     __LL_ADC_IS_CHANNEL_INTERNAL((__CHANNEL__))

Helper macro to determine whether the selected channel corresponds to literal definitions of driver.

Note
The different literal definitions of ADC channels are:
  • ADC internal channel: ADC_CHANNEL_VREFINT, ADC_CHANNEL_TEMPSENSOR, ...
  • ADC external channel (channel connected to a GPIO pin): ADC_CHANNEL_1, ADC_CHANNEL_2, ...
The channel parameter must be a value defined from literal definition of a ADC internal channel (ADC_CHANNEL_VREFINT, ADC_CHANNEL_TEMPSENSOR, ...), ADC external channel (ADC_CHANNEL_1, ADC_CHANNEL_2, ...), must not be a value from functions where a channel number is returned from ADC registers, because internal and external channels share the same channel number in ADC registers. The differentiation is made only with parameters definitions of driver.
Parameters
__CHANNEL__This parameter can be one of the following values: (1) On STM32H7, parameter available only on ADC instance: ADC3.
(2) On STM32H7, parameter available only on ADC instance: ADC2.
(3) On STM32H7, fast channel (0.125 us for 14-bit resolution (ADC conversion rate up to 8 Ms/s)). Other channels are slow channels (conversion rate: refer to reference manual).
Return values
Value"0" if the channel corresponds to a parameter definition of a ADC external channel (channel connected to a GPIO pin). Value "1" if the channel corresponds to a parameter definition of a ADC internal channel.

◆ __HAL_ADC_IS_CHANNEL_INTERNAL_AVAILABLE

#define __HAL_ADC_IS_CHANNEL_INTERNAL_AVAILABLE (   __ADC_INSTANCE__,
  __CHANNEL__ 
)     __LL_ADC_IS_CHANNEL_INTERNAL_AVAILABLE((__ADC_INSTANCE__), (__CHANNEL__))

Helper macro to determine whether the internal channel selected is available on the ADC instance selected.

Note
The channel parameter must be a value defined from parameter definition of a ADC internal channel (ADC_CHANNEL_VREFINT, ADC_CHANNEL_TEMPSENSOR, ...), must not be a value defined from parameter definition of ADC external channel (ADC_CHANNEL_1, ADC_CHANNEL_2, ...) or a value from functions where a channel number is returned from ADC registers, because internal and external channels share the same channel number in ADC registers. The differentiation is made only with parameters definitions of driver.
Parameters
__ADC_INSTANCE__ADC instance
__CHANNEL__This parameter can be one of the following values: (1) On STM32H7, parameter available only on ADC instance: ADC3.
(2) On STM32H7, parameter available only on ADC instance: ADC2.
Return values
Value"0" if the internal channel selected is not available on the ADC instance selected. Value "1" if the internal channel selected is available on the ADC instance selected.

◆ __HAL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE

#define __HAL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE (   __ADCXY_COMMON__)     __LL_ADC_IS_ENABLED_ALL_COMMON_INSTANCE((__ADCXY_COMMON__))

Helper macro to check if all ADC instances sharing the same ADC common instance are disabled.

Note
This check is required by functions with setting conditioned to ADC state: All ADC instances of the ADC common group must be disabled. Refer to functions having argument "ADCxy_COMMON" as parameter.
On devices with only 1 ADC common instance, parameter of this macro is useless and can be ignored (parameter kept for compatibility with devices featuring several ADC common instances).
Parameters
__ADCXY_COMMON__ADC common instance (can be set directly from CMSIS definition or by using helper macro __LL_ADC_COMMON_INSTANCE() )
Return values
Value"0" if all ADC instances sharing the same ADC common instance are disabled. Value "1" if at least one ADC instance sharing the same ADC common instance is enabled.

◆ __HAL_ADC_MULTI_CONV_DATA_MASTER_SLAVE

#define __HAL_ADC_MULTI_CONV_DATA_MASTER_SLAVE (   __ADC_MULTI_MASTER_SLAVE__,
  __ADC_MULTI_CONV_DATA__ 
)     __LL_ADC_MULTI_CONV_DATA_MASTER_SLAVE((__ADC_MULTI_MASTER_SLAVE__), (__ADC_MULTI_CONV_DATA__))

Helper macro to get the ADC multimode conversion data of ADC master or ADC slave from raw value with both ADC conversion data concatenated.

Note
This macro is intended to be used when multimode transfer by DMA is enabled: refer to function LL_ADC_SetMultiDMATransfer(). In this case the transferred data need to processed with this macro to separate the conversion data of ADC master and ADC slave.
Parameters
__ADC_MULTI_MASTER_SLAVE__This parameter can be one of the following values:
  • LL_ADC_MULTI_MASTER
  • LL_ADC_MULTI_SLAVE
__ADC_MULTI_CONV_DATA__Value between Min_Data=0x000 and Max_Data=0xFFF
Return values
Valuebetween Min_Data=0x000 and Max_Data=0xFFF