STM8S/A Standard Peripherals Drivers: ADC1_Public_Functions

STM8S/A

STM8S/A Standard Peripherals Drivers
ADC1_Public_Functions

Functions

void ADC1_AWDChannelConfig (ADC1_Channel_TypeDef Channel, FunctionalState NewState)
 Enables or disables the analog watchdog for the given channel.
void ADC1_ClearFlag (ADC1_Flag_TypeDef Flag)
 Clear the specified ADC1 Flag.
void ADC1_ClearITPendingBit (ADC1_IT_TypeDef ITPendingBit)
 Clear the ADC1 End of Conversion pending bit.
void ADC1_Cmd (FunctionalState NewState)
 Enables or Disables the ADC1 peripheral.
void ADC1_ConversionConfig (ADC1_ConvMode_TypeDef ADC1_ConversionMode, ADC1_Channel_TypeDef ADC1_Channel, ADC1_Align_TypeDef ADC1_Align)
 Configure the ADC1 conversion on selected channel.
void ADC1_DataBufferCmd (FunctionalState NewState)
 Enables or Disables the ADC1 data store into the Data Buffer registers rather than in the Data Register.
void ADC1_DeInit (void)
 Deinitializes the ADC1 peripheral registers to their default reset values.
void ADC1_ExternalTriggerConfig (ADC1_ExtTrig_TypeDef ADC1_ExtTrigger, FunctionalState NewState)
 Configure the ADC1 conversion on external trigger event.
FlagStatus ADC1_GetAWDChannelStatus (ADC1_Channel_TypeDef Channel)
 Checks the specified analog watchdog channel status.
uint16_t ADC1_GetBufferValue (uint8_t Buffer)
 Get one sample of measured signal.
uint16_t ADC1_GetConversionValue (void)
 Get one sample of measured signal.
FlagStatus ADC1_GetFlagStatus (ADC1_Flag_TypeDef Flag)
 Checks the specified ADC1 flag status.
ITStatus ADC1_GetITStatus (ADC1_IT_TypeDef ITPendingBit)
 Returns the specified pending bit status.
void ADC1_Init (ADC1_ConvMode_TypeDef ADC1_ConversionMode, ADC1_Channel_TypeDef ADC1_Channel, ADC1_PresSel_TypeDef ADC1_PrescalerSelection, ADC1_ExtTrig_TypeDef ADC1_ExtTrigger, FunctionalState ADC1_ExtTriggerState, ADC1_Align_TypeDef ADC1_Align, ADC1_SchmittTrigg_TypeDef ADC1_SchmittTriggerChannel, FunctionalState ADC1_SchmittTriggerState)
 Initializes the ADC1 peripheral according to the specified parameters.
void ADC1_ITConfig (ADC1_IT_TypeDef ADC1_IT, FunctionalState NewState)
 Enables or disables the ADC1 interrupt.
void ADC1_PrescalerConfig (ADC1_PresSel_TypeDef ADC1_Prescaler)
 Configure the ADC1 prescaler division factor.
void ADC1_ScanModeCmd (FunctionalState NewState)
 Enables or Disables the ADC1 scan mode.
void ADC1_SchmittTriggerConfig (ADC1_SchmittTrigg_TypeDef ADC1_SchmittTriggerChannel, FunctionalState NewState)
 Enables or disables the ADC1 Schmitt Trigger on a selected channel.
void ADC1_SetHighThreshold (uint16_t Threshold)
 Sets the high threshold of the analog watchdog.
void ADC1_SetLowThreshold (uint16_t Threshold)
 Sets the low threshold of the analog watchdog.
void ADC1_StartConversion (void)
 Start ADC1 conversion.

Function Documentation

void ADC1_AWDChannelConfig ( ADC1_Channel_TypeDef  Channel,
FunctionalState  NewState 
)

Enables or disables the analog watchdog for the given channel.

Parameters:
Channelspecifies the desired Channel. It can be set of the values of ADC1_Channel_TypeDef.
NewStatespecifies the analog watchdog new state. can have one of the values of FunctionalState.
Return values:
None

Definition at line 405 of file stm8s_adc1.c.

References DISABLE, IS_ADC1_CHANNEL_OK, and IS_FUNCTIONALSTATE_OK.

void ADC1_ClearFlag ( ADC1_Flag_TypeDef  Flag)

Clear the specified ADC1 Flag.

Parameters:
Flag,:ADC1 flag. can be one of the values of ADC1_Flag_TypeDef.
Return values:
None

Definition at line 567 of file stm8s_adc1.c.

References IS_ADC1_FLAG_OK.

void ADC1_ClearITPendingBit ( ADC1_IT_TypeDef  ITPendingBit)

Clear the ADC1 End of Conversion pending bit.

Parameters:
ITPendingBit: the IT pending bit to clear. This parameter can be one of the following values:
  • ADC1_IT_AWD : Analog WDG IT status
  • ADC1_IT_AWS0 : Analog channel 0 IT status
  • ADC1_IT_AWS1 : Analog channel 1 IT status
  • ADC1_IT_AWS2 : Analog channel 2 IT status
  • ADC1_IT_AWS3 : Analog channel 3 IT status
  • ADC1_IT_AWS4 : Analog channel 4 IT status
  • ADC1_IT_AWS5 : Analog channel 5 IT status
  • ADC1_IT_AWS6 : Analog channel 6 IT status
  • ADC1_IT_AWS7 : Analog channel 7 IT status
  • ADC1_IT_AWS8 : Analog channel 8 IT status
  • ADC1_IT_AWS9 : Analog channel 9 IT status
  • ADC1_IT_EOC : EOC pending bit
Return values:
None

Definition at line 662 of file stm8s_adc1.c.

References IS_ADC1_ITPENDINGBIT_OK.

void ADC1_Cmd ( FunctionalState  NewState)

Enables or Disables the ADC1 peripheral.

Parameters:
NewState,:specifies the peripheral enabled or disabled state.
Return values:
None

Definition at line 126 of file stm8s_adc1.c.

References DISABLE, and IS_FUNCTIONALSTATE_OK.

void ADC1_ConversionConfig ( ADC1_ConvMode_TypeDef  ADC1_ConversionMode,
ADC1_Channel_TypeDef  ADC1_Channel,
ADC1_Align_TypeDef  ADC1_Align 
)

Configure the ADC1 conversion on selected channel.

Parameters:
ADC1_ConversionModeSpecifies the conversion type. It can be set of the values of ADC1_ConvMode_TypeDef
ADC1_Channelspecifies the ADC1 Channel. It can be set of the values of ADC1_Channel_TypeDef
ADC1_Alignspecifies the converted data alignment. It can be set of the values of ADC1_Align_TypeDef
Return values:
None

Definition at line 286 of file stm8s_adc1.c.

References ADC1_CONVERSIONMODE_CONTINUOUS, IS_ADC1_ALIGN_OK, IS_ADC1_CHANNEL_OK, and IS_ADC1_CONVERSIONMODE_OK.

Referenced by ADC1_Init().

void ADC1_DataBufferCmd ( FunctionalState  NewState)

Enables or Disables the ADC1 data store into the Data Buffer registers rather than in the Data Register.

Parameters:
NewState,:specifies the selected mode enabled or disabled state.
Return values:
None

Definition at line 166 of file stm8s_adc1.c.

References DISABLE, and IS_FUNCTIONALSTATE_OK.

void ADC1_DeInit ( void  )

Deinitializes the ADC1 peripheral registers to their default reset values.

Parameters:
None
Return values:
None

Definition at line 52 of file stm8s_adc1.c.

void ADC1_ExternalTriggerConfig ( ADC1_ExtTrig_TypeDef  ADC1_ExtTrigger,
FunctionalState  NewState 
)

Configure the ADC1 conversion on external trigger event.

Full description:
The selected external trigger event can be enabled or disabled.
Parameters:
ADC1_ExtTriggerto select the External trigger event. can have one of the values of ADC1_ExtTrig_TypeDef.
NewStateto enable/disable the selected external trigger can have one of the values of FunctionalState.
Return values:
None

Definition at line 325 of file stm8s_adc1.c.

References DISABLE, IS_ADC1_EXTTRIG_OK, and IS_FUNCTIONALSTATE_OK.

Referenced by ADC1_Init().

FlagStatus ADC1_GetAWDChannelStatus ( ADC1_Channel_TypeDef  Channel)

Checks the specified analog watchdog channel status.

Parameters:
Channel,:specify the channel of which to check the analog watchdog can be one of the values of ADC1_Channel_TypeDef.
Return values:
FlagStatusStatus of the analog watchdog.

Definition at line 502 of file stm8s_adc1.c.

References IS_ADC1_CHANNEL_OK.

uint16_t ADC1_GetBufferValue ( uint8_t  Buffer)

Get one sample of measured signal.

Parameters:
Bufferspecifies the buffer to read.
Return values:
BufferValue,:value read from the given buffer.
Required preconditions:
ADC1 conversion finished.

Definition at line 466 of file stm8s_adc1.c.

References ADC1_BaseAddress, and IS_ADC1_BUFFER_OK.

uint16_t ADC1_GetConversionValue ( void  )

Get one sample of measured signal.

Parameters:
None
Return values:
ConversionValue,:value of the measured signal.
Required preconditions:
ADC1 conversion finished.

Definition at line 370 of file stm8s_adc1.c.

FlagStatus ADC1_GetFlagStatus ( ADC1_Flag_TypeDef  Flag)

Checks the specified ADC1 flag status.

Parameters:
Flag,:ADC1 flag. can be one of the values of ADC1_Flag_TypeDef.
Return values:
FlagStatusStatus of the ADC1 flag.

Definition at line 527 of file stm8s_adc1.c.

References IS_ADC1_FLAG_OK.

ITStatus ADC1_GetITStatus ( ADC1_IT_TypeDef  ITPendingBit)

Returns the specified pending bit status.

Parameters:
ITPendingBit: the IT pending bit to check. This parameter can be one of the following values:
  • ADC1_IT_AWD : Analog WDG IT status
  • ADC1_IT_AWS0 : Analog channel 0 IT status
  • ADC1_IT_AWS1 : Analog channel 1 IT status
  • ADC1_IT_AWS2 : Analog channel 2 IT status
  • ADC1_IT_AWS3 : Analog channel 3 IT status
  • ADC1_IT_AWS4 : Analog channel 4 IT status
  • ADC1_IT_AWS5 : Analog channel 5 IT status
  • ADC1_IT_AWS6 : Analog channel 6 IT status
  • ADC1_IT_AWS7 : Analog channel 7 IT status
  • ADC1_IT_AWS8 : Analog channel 8 IT status
  • ADC1_IT_AWS9 : Analog channel 9 IT status
  • ADC1_IT_EOC : EOC pending bit
Return values:
ITStatus,:status of the specified pending bit.

Definition at line 616 of file stm8s_adc1.c.

References IS_ADC1_ITPENDINGBIT_OK, and RESET.

void ADC1_Init ( ADC1_ConvMode_TypeDef  ADC1_ConversionMode,
ADC1_Channel_TypeDef  ADC1_Channel,
ADC1_PresSel_TypeDef  ADC1_PrescalerSelection,
ADC1_ExtTrig_TypeDef  ADC1_ExtTrigger,
FunctionalState  ADC1_ExtTriggerState,
ADC1_Align_TypeDef  ADC1_Align,
ADC1_SchmittTrigg_TypeDef  ADC1_SchmittTriggerChannel,
FunctionalState  ADC1_SchmittTriggerState 
)

Initializes the ADC1 peripheral according to the specified parameters.

Parameters:
ADC1_ConversionMode,:specifies the conversion mode can be one of the values of ADC1_ConvMode_TypeDef.
ADC1_Channel,:specifies the channel to convert can be one of the values of ADC1_Channel_TypeDef.
ADC1_PrescalerSelection,:specifies the ADC1 prescaler can be one of the values of ADC1_PresSel_TypeDef.
ADC1_ExtTrigger,:specifies the external trigger can be one of the values of ADC1_ExtTrig_TypeDef.
ADC1_ExtTriggerState,:specifies the external trigger new state can be one of the values of FunctionalState.
ADC1_Align,:specifies the converted data alignment can be one of the values of ADC1_Align_TypeDef.
ADC1_SchmittTriggerChannel,:specifies the schmitt trigger channel can be one of the values of ADC1_SchmittTrigg_TypeDef.
ADC1_SchmittTriggerState,:specifies the schmitt trigger state can be one of the values of FunctionalState.
Return values:
None

Definition at line 88 of file stm8s_adc1.c.

References ADC1_ConversionConfig(), ADC1_ExternalTriggerConfig(), ADC1_PrescalerConfig(), ADC1_SchmittTriggerConfig(), IS_ADC1_ALIGN_OK, IS_ADC1_CHANNEL_OK, IS_ADC1_CONVERSIONMODE_OK, IS_ADC1_EXTTRIG_OK, IS_ADC1_PRESSEL_OK, IS_ADC1_SCHMITTTRIG_OK, and IS_FUNCTIONALSTATE_OK.

void ADC1_ITConfig ( ADC1_IT_TypeDef  ADC1_IT,
FunctionalState  NewState 
)

Enables or disables the ADC1 interrupt.

Parameters:
ADC1_ITspecifies the name of the interrupt to enable or disable. This parameter can be one of the following values:
  • ADC1_IT_AWDITEN : Analog WDG interrupt enable
  • ADC1_IT_EOCITEN : EOC iterrupt enable
NewStatespecifies the state of the interrupt to apply.
Return values:
None

Definition at line 190 of file stm8s_adc1.c.

References DISABLE, IS_ADC1_IT_OK, and IS_FUNCTIONALSTATE_OK.

void ADC1_PrescalerConfig ( ADC1_PresSel_TypeDef  ADC1_Prescaler)

Configure the ADC1 prescaler division factor.

Parameters:
ADC1_Prescaler,:the selected precaler. It can be one of the values of ADC1_PresSel_TypeDef.
Return values:
None

Definition at line 214 of file stm8s_adc1.c.

References IS_ADC1_PRESSEL_OK.

Referenced by ADC1_Init().

void ADC1_ScanModeCmd ( FunctionalState  NewState)

Enables or Disables the ADC1 scan mode.

Parameters:
NewState,:specifies the selected mode enabled or disabled state.
Return values:
None

Definition at line 146 of file stm8s_adc1.c.

References DISABLE, and IS_FUNCTIONALSTATE_OK.

void ADC1_SchmittTriggerConfig ( ADC1_SchmittTrigg_TypeDef  ADC1_SchmittTriggerChannel,
FunctionalState  NewState 
)

Enables or disables the ADC1 Schmitt Trigger on a selected channel.

Parameters:
ADC1_SchmittTriggerChannelspecifies the desired Channel. It can be set of the values of ADC1_SchmittTrigg_TypeDef.
NewStatespecifies Channel new status. can have one of the values of FunctionalState.
Return values:
None

Definition at line 233 of file stm8s_adc1.c.

References ADC1_SCHMITTTRIG_ALL, ADC1_SCHMITTTRIG_CHANNEL8, DISABLE, IS_ADC1_SCHMITTTRIG_OK, and IS_FUNCTIONALSTATE_OK.

Referenced by ADC1_Init().

void ADC1_SetHighThreshold ( uint16_t  Threshold)

Sets the high threshold of the analog watchdog.

Parameters:
Thresholdspecifies the high threshold value. this value depends on the reference voltage range.
Return values:
None

Definition at line 441 of file stm8s_adc1.c.

void ADC1_SetLowThreshold ( uint16_t  Threshold)

Sets the low threshold of the analog watchdog.

Parameters:
Thresholdspecifies the low threshold value. this value depends on the reference voltage range.
Return values:
None

Definition at line 453 of file stm8s_adc1.c.

void ADC1_StartConversion ( void  )

Start ADC1 conversion.

Full description:
This function triggers the start of conversion, after ADC1 configuration.
Parameters:
None
Return values:
None
Required preconditions:
Enable the ADC1 peripheral before calling this function

Definition at line 358 of file stm8s_adc1.c.

STM8 Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM8 8-bit Microcontrollers platform visit www.st.com