Hal Drivers for L4

Dependents:   BSP OneHopeOnePrayer FINAL_AUDIO_RECORD AudioDemo

Fork of STM32L4xx_HAL_Driver by Senior Design: Sound Monitor

Embed: (wiki syntax)

« Back to documentation index

Configuration of ADC hierarchical scope: channels

Configuration of ADC hierarchical scope: channels
[ADC Exported Functions]

Functions

__STATIC_INLINE void LL_ADC_SetChannelSamplingTime (ADC_TypeDef *ADCx, uint32_t Channel, uint32_t SamplingTime)
 Set sampling time of the selected ADC channel.
__STATIC_INLINE uint32_t LL_ADC_GetChannelSamplingTime (ADC_TypeDef *ADCx, uint32_t Channel)
 Get sampling time of the selected ADC channel.
__STATIC_INLINE void LL_ADC_SetChannelSingleDiff (ADC_TypeDef *ADCx, uint32_t Channel, uint32_t SingleDiff)
 Set mode single-ended or differential input of the selected ADC channel.
__STATIC_INLINE uint32_t LL_ADC_GetChannelSingleDiff (ADC_TypeDef *ADCx, uint32_t Channel)
 Get mode single-ended or differential input of the selected ADC channel.

Function Documentation

__STATIC_INLINE uint32_t LL_ADC_GetChannelSamplingTime ( ADC_TypeDef *  ADCx,
uint32_t  Channel 
)

Get sampling time of the selected ADC channel.

Unit: ADC clock cycles. On this device, sampling time is on channel scope: independently of channel mapped on ADC group regular or injected.

Note:
Conversion time is the addition of sampling time and processing time. On this STM32 family, ADC processing time is:
  • 12.5 ADC clock cycles at ADC resolution 12 bits
  • 10.5 ADC clock cycles at ADC resolution 10 bits
  • 8.5 ADC clock cycles at ADC resolution 8 bits
  • 6.5 ADC clock cycles at ADC resolution 6 bits SMPR1 SMP0 LL_ADC_GetChannelSamplingTime
    SMPR1 SMP1 LL_ADC_GetChannelSamplingTime
    SMPR1 SMP2 LL_ADC_GetChannelSamplingTime
    SMPR1 SMP3 LL_ADC_GetChannelSamplingTime
    SMPR1 SMP4 LL_ADC_GetChannelSamplingTime
    SMPR1 SMP5 LL_ADC_GetChannelSamplingTime
    SMPR1 SMP6 LL_ADC_GetChannelSamplingTime
    SMPR1 SMP7 LL_ADC_GetChannelSamplingTime
    SMPR1 SMP8 LL_ADC_GetChannelSamplingTime
    SMPR1 SMP9 LL_ADC_GetChannelSamplingTime
    SMPR2 SMP10 LL_ADC_GetChannelSamplingTime
    SMPR2 SMP11 LL_ADC_GetChannelSamplingTime
    SMPR2 SMP12 LL_ADC_GetChannelSamplingTime
    SMPR2 SMP13 LL_ADC_GetChannelSamplingTime
    SMPR2 SMP14 LL_ADC_GetChannelSamplingTime
    SMPR2 SMP15 LL_ADC_GetChannelSamplingTime
    SMPR2 SMP16 LL_ADC_GetChannelSamplingTime
    SMPR2 SMP17 LL_ADC_GetChannelSamplingTime
    SMPR2 SMP18 LL_ADC_GetChannelSamplingTime
Parameters:
ADCxADC instance
ChannelThis parameter can be one of the following values:

  • LL_ADC_CHANNEL_0
  • LL_ADC_CHANNEL_1 (5)
  • LL_ADC_CHANNEL_2 (5)
  • LL_ADC_CHANNEL_3 (5)
  • LL_ADC_CHANNEL_4 (5)
  • LL_ADC_CHANNEL_5 (5)
  • LL_ADC_CHANNEL_6
  • LL_ADC_CHANNEL_7
  • LL_ADC_CHANNEL_8
  • LL_ADC_CHANNEL_9
  • LL_ADC_CHANNEL_10
  • LL_ADC_CHANNEL_11
  • LL_ADC_CHANNEL_12
  • LL_ADC_CHANNEL_13
  • LL_ADC_CHANNEL_14
  • LL_ADC_CHANNEL_15
  • LL_ADC_CHANNEL_16
  • LL_ADC_CHANNEL_17
  • LL_ADC_CHANNEL_18
  • LL_ADC_CHANNEL_VREFINT (1)
  • LL_ADC_CHANNEL_TEMPSENSOR (4)
  • LL_ADC_CHANNEL_VBAT (4)
  • LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)
  • LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)
  • LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)
  • LL_ADC_CHANNEL_DAC1CH2_ADC3 (3) (1) On STM32L4, parameter available only on ADC instance: ADC1. (2) On STM32L4, parameter available only on ADC instance: ADC2. (3) On STM32L4, parameter available only on ADC instance: ADC3. (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3. (5) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)). Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).
Return values:
Returnedvalue can be one of the following values:

  • LL_ADC_SAMPLINGTIME_2CYCLES_5
  • LL_ADC_SAMPLINGTIME_6CYCLES_5
  • LL_ADC_SAMPLINGTIME_12CYCLES_5
  • LL_ADC_SAMPLINGTIME_24CYCLES_5
  • LL_ADC_SAMPLINGTIME_47CYCLES_5
  • LL_ADC_SAMPLINGTIME_92CYCLES_5
  • LL_ADC_SAMPLINGTIME_247CYCLES_5
  • LL_ADC_SAMPLINGTIME_640CYCLES_5

Definition at line 4035 of file stm32l4xx_ll_adc.h.

__STATIC_INLINE uint32_t LL_ADC_GetChannelSingleDiff ( ADC_TypeDef *  ADCx,
uint32_t  Channel 
)

Get mode single-ended or differential input of the selected ADC channel.

Note:
When configuring a channel 'i' in differential mode, the channel 'i+1' is not usable separately. Therefore, to ensure a channel is configured in single-ended mode, the configuration of channel itself and the channel 'i-1' must be read back (to ensure that the selected channel channel has not been configured in differential mode by the previous channel).
Refer to Reference Manual to ensure the selected channel is available in differential mode. For example, internal channels (VrefInt, TempSensor, ...) are not available in differential mode.
When configuring a channel 'i' in differential mode, the channel 'i+1' is not usable separately.
On STM32L4, channels 15, 16, 17, 18 of ADC1, ADC2, ADC3 (if available) are internally fixed to single-ended inputs configuration.
One or several values can be selected. In this case, the value returned is null if all channels are in single ended-mode. Example: (LL_ADC_CHANNEL_4 | LL_ADC_CHANNEL_12 | ...) DIFSEL DIFSEL LL_ADC_GetChannelSamplingTime
Parameters:
ADCxADC instance
ChannelThis parameter can be a combination of the following values:

  • LL_ADC_CHANNEL_0
  • LL_ADC_CHANNEL_1
  • LL_ADC_CHANNEL_2
  • LL_ADC_CHANNEL_3
  • LL_ADC_CHANNEL_4
  • LL_ADC_CHANNEL_5
  • LL_ADC_CHANNEL_6
  • LL_ADC_CHANNEL_7
  • LL_ADC_CHANNEL_8
  • LL_ADC_CHANNEL_9
  • LL_ADC_CHANNEL_10
  • LL_ADC_CHANNEL_11
  • LL_ADC_CHANNEL_12
  • LL_ADC_CHANNEL_13
  • LL_ADC_CHANNEL_14
Return values:
0,:channel in single-ended mode, else: channel in differential mode

Definition at line 4139 of file stm32l4xx_ll_adc.h.

__STATIC_INLINE void LL_ADC_SetChannelSamplingTime ( ADC_TypeDef *  ADCx,
uint32_t  Channel,
uint32_t  SamplingTime 
)

Set sampling time of the selected ADC channel.

Unit: ADC clock cycles. On this device, sampling time is on channel scope: independently of channel mapped on ADC group regular or injected.

Note:
In case of internal channel (VrefInt, TempSensor, ...) to be converted: sampling time constraints must be respected (sampling time can be adjusted in function of ADC clock frequency and sampling time setting). Refer to device datasheet for timings values (parameters TS_vrefint, TS_temp, ...).
Conversion time is the addition of sampling time and processing time. On this STM32 family, ADC processing time is:
  • 12.5 ADC clock cycles at ADC resolution 12 bits
  • 10.5 ADC clock cycles at ADC resolution 10 bits
  • 8.5 ADC clock cycles at ADC resolution 8 bits
  • 6.5 ADC clock cycles at ADC resolution 6 bits
On this STM32 family, setting of this feature is conditioned to ADC state: ADC must be disabled or enabled without conversion on going on either groups regular or injected. SMPR1 SMP0 LL_ADC_SetChannelSamplingTime
SMPR1 SMP1 LL_ADC_SetChannelSamplingTime
SMPR1 SMP2 LL_ADC_SetChannelSamplingTime
SMPR1 SMP3 LL_ADC_SetChannelSamplingTime
SMPR1 SMP4 LL_ADC_SetChannelSamplingTime
SMPR1 SMP5 LL_ADC_SetChannelSamplingTime
SMPR1 SMP6 LL_ADC_SetChannelSamplingTime
SMPR1 SMP7 LL_ADC_SetChannelSamplingTime
SMPR1 SMP8 LL_ADC_SetChannelSamplingTime
SMPR1 SMP9 LL_ADC_SetChannelSamplingTime
SMPR2 SMP10 LL_ADC_SetChannelSamplingTime
SMPR2 SMP11 LL_ADC_SetChannelSamplingTime
SMPR2 SMP12 LL_ADC_SetChannelSamplingTime
SMPR2 SMP13 LL_ADC_SetChannelSamplingTime
SMPR2 SMP14 LL_ADC_SetChannelSamplingTime
SMPR2 SMP15 LL_ADC_SetChannelSamplingTime
SMPR2 SMP16 LL_ADC_SetChannelSamplingTime
SMPR2 SMP17 LL_ADC_SetChannelSamplingTime
SMPR2 SMP18 LL_ADC_SetChannelSamplingTime
Parameters:
ADCxADC instance
ChannelThis parameter can be one of the following values:

  • LL_ADC_CHANNEL_0
  • LL_ADC_CHANNEL_1 (5)
  • LL_ADC_CHANNEL_2 (5)
  • LL_ADC_CHANNEL_3 (5)
  • LL_ADC_CHANNEL_4 (5)
  • LL_ADC_CHANNEL_5 (5)
  • LL_ADC_CHANNEL_6
  • LL_ADC_CHANNEL_7
  • LL_ADC_CHANNEL_8
  • LL_ADC_CHANNEL_9
  • LL_ADC_CHANNEL_10
  • LL_ADC_CHANNEL_11
  • LL_ADC_CHANNEL_12
  • LL_ADC_CHANNEL_13
  • LL_ADC_CHANNEL_14
  • LL_ADC_CHANNEL_15
  • LL_ADC_CHANNEL_16
  • LL_ADC_CHANNEL_17
  • LL_ADC_CHANNEL_18
  • LL_ADC_CHANNEL_VREFINT (1)
  • LL_ADC_CHANNEL_TEMPSENSOR (4)
  • LL_ADC_CHANNEL_VBAT (4)
  • LL_ADC_CHANNEL_DAC1CH1_ADC2 (2)
  • LL_ADC_CHANNEL_DAC1CH2_ADC2 (2)
  • LL_ADC_CHANNEL_DAC1CH1_ADC3 (3)
  • LL_ADC_CHANNEL_DAC1CH2_ADC3 (3) (1) On STM32L4, parameter available only on ADC instance: ADC1. (2) On STM32L4, parameter available only on ADC instance: ADC2. (3) On STM32L4, parameter available only on ADC instance: ADC3. (4) On STM32L4, parameter available only on ADC instances: ADC1, ADC3. (5) On STM32L4, fast channel (0.188 us for 12-bit resolution (ADC conversion rate up to 5.33 Ms/s)). Other channels are slow channels (0.238 us for 12-bit resolution (ADC conversion rate up to 4.21 Ms/s)).
SamplingTimeThis parameter can be one of the following values:

  • LL_ADC_SAMPLINGTIME_2CYCLES_5
  • LL_ADC_SAMPLINGTIME_6CYCLES_5
  • LL_ADC_SAMPLINGTIME_12CYCLES_5
  • LL_ADC_SAMPLINGTIME_24CYCLES_5
  • LL_ADC_SAMPLINGTIME_47CYCLES_5
  • LL_ADC_SAMPLINGTIME_92CYCLES_5
  • LL_ADC_SAMPLINGTIME_247CYCLES_5
  • LL_ADC_SAMPLINGTIME_640CYCLES_5
Return values:
None

Definition at line 3948 of file stm32l4xx_ll_adc.h.

__STATIC_INLINE void LL_ADC_SetChannelSingleDiff ( ADC_TypeDef *  ADCx,
uint32_t  Channel,
uint32_t  SingleDiff 
)

Set mode single-ended or differential input of the selected ADC channel.

Channel ending is on channel scope: independently of channel mapped on ADC group regular or injected. In differential mode: Differential measurement is carried out between the selected channel 'i' (positive input) and channel 'i+1' (negative input). Only channel 'i' has to be configured, channel 'i+1' is configured automatically.

Note:
Refer to Reference Manual to ensure the selected channel is available in differential mode. For example, internal channels (VrefInt, TempSensor, ...) are not available in differential mode.
When configuring a channel 'i' in differential mode, the channel 'i+1' is not usable separately.
On STM32L4, channels 15, 16, 17, 18 of ADC1, ADC2, ADC3 (if available) are internally fixed to single-ended inputs configuration.
On this STM32 family, setting of this feature is conditioned to ADC state: ADC must be ADC disabled.
One or several values can be selected. Example: (LL_ADC_CHANNEL_4 | LL_ADC_CHANNEL_12 | ...) DIFSEL DIFSEL LL_ADC_GetChannelSamplingTime
Parameters:
ADCxADC instance
ChannelThis parameter can be one of the following values:

  • LL_ADC_CHANNEL_1
  • LL_ADC_CHANNEL_2
  • LL_ADC_CHANNEL_3
  • LL_ADC_CHANNEL_4
  • LL_ADC_CHANNEL_5
  • LL_ADC_CHANNEL_6
  • LL_ADC_CHANNEL_7
  • LL_ADC_CHANNEL_8
  • LL_ADC_CHANNEL_9
  • LL_ADC_CHANNEL_10
  • LL_ADC_CHANNEL_11
  • LL_ADC_CHANNEL_12
  • LL_ADC_CHANNEL_13
  • LL_ADC_CHANNEL_14
SingleDiffThis parameter can be a combination of the following values:

  • LL_ADC_SINGLE_ENDED
  • LL_ADC_DIFFERENTIAL_ENDED
Return values:
None

Definition at line 4089 of file stm32l4xx_ll_adc.h.