STM8L15x Standard Peripherals Drivers: Channels Configuration functions

STM8L15x/16x Standard Peripherals Drivers

STM8L15x Standard Peripherals Drivers

Channels Configuration functions

Channels Configuration functions. More...

Functions

void ADC_ChannelCmd (ADC_TypeDef *ADCx, ADC_Channel_TypeDef ADC_Channels, FunctionalState NewState)
 Enables or disables the selected ADC channel(s).
uint16_t ADC_GetConversionValue (ADC_TypeDef *ADCx)
 Returns the last ADC converted data.
void ADC_SamplingTimeConfig (ADC_TypeDef *ADCx, ADC_Group_TypeDef ADC_GroupChannels, ADC_SamplingTime_TypeDef ADC_SamplingTime)
 Configures the sampling time for the selected ADC channel group.
void ADC_SchmittTriggerConfig (ADC_TypeDef *ADCx, ADC_Channel_TypeDef ADC_Channels, FunctionalState NewState)
 Configures the status of the Schmitt Trigger for the selected ADC channel(s).

Detailed Description

Channels Configuration functions.

 ===============================================================================
                      Channels Configuration functions
 ===============================================================================  
  This section provides functions allowing to:
   - Enable or disable the ADC channel using ADC_ChannelCmd() function,
   - Configure the channels sampling times using ADC_SamplingTimeConfig() 
     function.
     Note: there are 2 sampling times configuration values : 
            - 1st Group value : for channels 0..23  
            - 2nd Group value : for channels 24..27 (depending on the MCU 
              package density) and Temperature Sensor and Vrefint channels. 
   - Configure the channels Schmitt Trigger for each channel using 
     ADC_SchmittTriggerConfig() function.
   - Get the current ADC conversion value.
   
 

Function Documentation

void ADC_ChannelCmd ( ADC_TypeDef ADCx,
ADC_Channel_TypeDef  ADC_Channels,
FunctionalState  NewState 
)

Enables or disables the selected ADC channel(s).

Parameters:
ADCxwhere x can be 1 to select the specified ADC peripheral.
ADC_Channels,:specifies the ADC channels to be initialized This parameter can be one of the following values:
  • ADC_Channel_0: Channel 0
  • ADC_Channel_1: Channel 1
  • ADC_Channel_2: Channel 2
  • ADC_Channel_3: Channel 3
  • ADC_Channel_4: Channel 4
  • ADC_Channel_5: Channel 5
  • ADC_Channel_6: Channel 6
  • ADC_Channel_7: Channel 7
  • ADC_Channel_8: Channel 8
  • ADC_Channel_9: Channel 9
  • ADC_Channel_10: Channel 10
  • ADC_Channel_11: Channel 11
  • ADC_Channel_12: Channel 12
  • ADC_Channel_13: Channel 13
  • ADC_Channel_14: Channel 14
  • ADC_Channel_15: Channel 15
  • ADC_Channel_16: Channel 16
  • ADC_Channel_17: Channel 17
  • ADC_Channel_18: Channel 18
  • ADC_Channel_19: Channel 19
  • ADC_Channel_20: Channel 20
  • ADC_Channel_21: Channel 21
  • ADC_Channel_22: Channel 22
  • ADC_Channel_23: Channel 23
  • ADC_Channel_24: Channel 24
  • ADC_Channel_25: Channel 25
  • ADC_Channel_26: Channel 26
  • ADC_Channel_27: Channel 27
  • ADC_Channel_Vrefint: Vrefint Channel
  • ADC_Channel_TempSensor: Temperature sensor Channel
  • ADC_Channel_00To07: select from channel00 to channel07
  • ADC_Channel_08To15: select from channel08 to channel15
  • ADC_Channel_16To23: select from channel16 to channel23
  • ADC_Channel_24To27: select from channel24 to channel27
NewState: new state of the specified ADC channel(s). This parameter can be: ENABLE or DISABLE.
Return values:
None

Definition at line 577 of file stm8l15x_adc.c.

References DISABLE, IS_FUNCTIONAL_STATE, and ADC_struct::SQR.

uint16_t ADC_GetConversionValue ( ADC_TypeDef ADCx)

Returns the last ADC converted data.

Parameters:
ADCxwhere x can be 1 to select the specified ADC peripheral.
Return values:
TheData conversion value.

Definition at line 711 of file stm8l15x_adc.c.

References ADC_struct::DRH, and ADC_struct::DRL.

void ADC_SamplingTimeConfig ( ADC_TypeDef ADCx,
ADC_Group_TypeDef  ADC_GroupChannels,
ADC_SamplingTime_TypeDef  ADC_SamplingTime 
)

Configures the sampling time for the selected ADC channel group.

Parameters:
ADCxwhere x can be 1 to select the specified ADC peripheral.
ADC_GroupChannels: ADC channel group to configure. This parameter can be one of the following values:
  • ADC_Group_SlowChannels: Slow Channels group
  • ADC_Group_FastChannels: Fast Channels group
Note:
The channels of 1st ADC Group can be channels 0..23
The channels of 2nd ADC Group can be channels 24..27 (depending on the MCU package density) and Temperature Sensor and Vrefint channels.
Parameters:
ADC_SamplingTime: Specifies the sample time value This parameter can be one of the following values:
  • ADC_SamplingTime_4Cycles: Sampling Time Cycles is 4
  • ADC_SamplingTime_9Cycles: Sampling Time Cycles is 9
  • ADC_SamplingTime_16Cycles: Sampling Time Cycles is 16
  • ADC_SamplingTime_24Cycles: Sampling Time Cycles is 24
  • ADC_SamplingTime_48Cycles: Sampling Time Cycles is 48
  • ADC_SamplingTime_96Cycles: Sampling Time Cycles is 96
  • ADC_SamplingTime_192Cycles: Sampling Time Cycles is 192
  • ADC_SamplingTime_384Cycles: Sampling Time Cycles is 384
Return values:
None

Definition at line 619 of file stm8l15x_adc.c.

References ADC_CR2_SMPT1, ADC_CR3_SMPT2, ADC_Group_SlowChannels, ADC_struct::CR2, ADC_struct::CR3, IS_ADC_GROUP, and IS_ADC_SAMPLING_TIME_CYCLES.

void ADC_SchmittTriggerConfig ( ADC_TypeDef ADCx,
ADC_Channel_TypeDef  ADC_Channels,
FunctionalState  NewState 
)

Configures the status of the Schmitt Trigger for the selected ADC channel(s).

Parameters:
ADCxwhere x can be 1 to select the specified ADC peripheral.
ADC_Channels,:specifies the ADC channels to be initialized, This parameter can be one of the following values:
  • ADC_Channel_0: Channel 0
  • ADC_Channel_1: Channel 1
  • ADC_Channel_2: Channel 2
  • ADC_Channel_3: Channel 3
  • ADC_Channel_4: Channel 4
  • ADC_Channel_5: Channel 5
  • ADC_Channel_6: Channel 6
  • ADC_Channel_7: Channel 7
  • ADC_Channel_8: Channel 8
  • ADC_Channel_9: Channel 9
  • ADC_Channel_10: Channel 10
  • ADC_Channel_11: Channel 11
  • ADC_Channel_12: Channel 12
  • ADC_Channel_13: Channel 13
  • ADC_Channel_14: Channel 14
  • ADC_Channel_15: Channel 15
  • ADC_Channel_16: Channel 16
  • ADC_Channel_17: Channel 17
  • ADC_Channel_18: Channel 18
  • ADC_Channel_19: Channel 19
  • ADC_Channel_20: Channel 20
  • ADC_Channel_21: Channel 21
  • ADC_Channel_22: Channel 22
  • ADC_Channel_23: Channel 23
  • ADC_Channel_24: Channel 24
  • ADC_Channel_25: Channel 25
  • ADC_Channel_26: Channel 26
  • ADC_Channel_27: Channel 27
  • ADC_Channel_Vrefint: Vrefint Channel
  • ADC_Channel_TempSensor: Temperature sensor Channel
  • ADC_Channel_00To07: select from channel00 to channel07
  • ADC_Channel_08To15: select from channel08 to channel15
  • ADC_Channel_16To23: select from channel16 to channel23
  • ADC_Channel_24To27: select from channel24 to channel27
NewState: new state of the Schmitt Trigger This parameter can be: ENABLE or DISABLE.
Return values:
None

Definition at line 685 of file stm8l15x_adc.c.

References DISABLE, IS_FUNCTIONAL_STATE, and ADC_struct::TRIGR.

STM8S Firmware Library: Overview

 

 

 

For complete documentation on STM8L15x 8-bit microcontrollers platform visit www.st.com