MG32F10x Standard Peripherals Firmware Library
Functions
ADC_Private_Functions

Functions

void ADC_DeInit (void)
 Deinitializes the ADC peripheral registers to their default reset values. More...
 
void ADC_Init (ADC_InitTypeDef *ADC_InitStruct)
 Initializes the ADC peripheral according to the specified parameters in the ADC_InitStruct. More...
 
void ADC_StructInit (ADC_InitTypeDef *ADC_InitStruct)
 Fills each ADC_InitStruct member with its default value. More...
 
void ADC_Cmd (FunctionalState NewState)
 Enables or disables the ADC peripheral. More...
 
void ADC_DMACmd (FunctionalState NewState)
 Enables or disables the ADC DMA request. More...
 
void ADC_InjectedDMACmd (FunctionalState NewState)
 Enables or disables the ADC injected group DMA request. More...
 
void ADC_ITConfig (uint16_t ADC_IT, FunctionalState NewState)
 Enables or disables the specified ADC interrupts. More...
 
void ADC_ResetCalibration (void)
 Resets the selected ADC calibration registers. More...
 
FlagStatus ADC_GetResetCalibrationStatus (void)
 Gets the selected ADC reset calibration registers status. More...
 
void ADC_StartCalibration (void)
 Starts the selected ADC calibration process. More...
 
FlagStatus ADC_GetCalibrationStatus (void)
 Gets the selected ADC calibration status. More...
 
void ADC_SoftwareStartConvCmd (FunctionalState NewState)
 Enables or disables the selected ADC software start conversion . More...
 
FlagStatus ADC_GetSoftwareStartConvStatus (void)
 Gets the selected ADC Software start conversion Status. More...
 
void ADC_DiscModeChannelCountConfig (uint8_t Number)
 Configures the discontinuous mode for the selected ADC regular group channel. More...
 
void ADC_DiscModeCmd (FunctionalState NewState)
 Enables or disables the discontinuous mode on regular group channel for the ADC. More...
 
void ADC_RegularChannelConfig (uint8_t ADC_Channel, uint8_t Rank, uint8_t ADC_SampleTime)
 Configures for the selected ADC regular channel its corresponding rank in the sequencer and its sample time. More...
 
void ADC_ExternalTrigConvCmd (FunctionalState NewState)
 Enables or disables the ADC conversion through external trigger. More...
 
uint16_t ADC_GetConversionValue (void)
 Returns the last ADC conversion result data for regular channel. More...
 
void ADC_AutoInjectedConvCmd (FunctionalState NewState)
 Enables or disables the selected ADC automatic injected group conversion after regular one. More...
 
void ADC_InjectedDiscModeCmd (FunctionalState NewState)
 Enables or disables the discontinuous mode for injected group channel for the ADC. More...
 
void ADC_ExternalTrigInjectedConvConfig (uint32_t ADC_ExternalTrigInjecConv)
 Configures the ADC external trigger for injected channels conversion. More...
 
void ADC_ExternalTrigInjectedConvCmd (FunctionalState NewState)
 Enables or disables the ADC injected channels conversion through external trigger. More...
 
void ADC_SoftwareStartInjectedConvCmd (FunctionalState NewState)
 Enables or disables the selected ADC start of the injected channels conversion. More...
 
FlagStatus ADC_GetSoftwareStartInjectedConvCmdStatus (void)
 Gets the selected ADC Software start injected conversion Status. More...
 
void ADC_InjectedChannelConfig (uint8_t ADC_Channel, uint8_t Rank, uint8_t ADC_SampleTime)
 Configures for the selected ADC injected channel its corresponding rank in the sequencer and its sample time. More...
 
void ADC_InjectedSequencerLengthConfig (uint8_t Length)
 Configures the sequencer length for injected channels. More...
 
void ADC_SetInjectedOffset (uint8_t ADC_InjectedChannel, uint16_t Offset)
 Set the injected channels conversion value offset. More...
 
uint16_t ADC_GetInjectedConversionValue (uint8_t ADC_InjectedChannel)
 Returns the ADC injected channel conversion result. More...
 
void ADC_AnalogWatchdogCmd (uint32_t ADC_AnalogWatchdog)
 Enables or disables the analog watchdog on single/all regular or injected channels. More...
 
void ADC_AnalogWatchdogThresholdsConfig (uint16_t HighThreshold, uint16_t LowThreshold)
 Configures the high and low thresholds of the analog watchdog. More...
 
void ADC_AnalogWatchdogSingleChannelConfig (uint8_t ADC_Channel)
 Configures the analog watchdog guarded single channel. More...
 
void ADC_TempSensorVrefintCmd (FunctionalState NewState)
 Enables or disables the temperature sensor and Vrefint channel. More...
 
FlagStatus ADC_GetFlagStatus (uint8_t ADC_FLAG)
 Checks whether the specified ADC flag is set or not. More...
 
void ADC_ClearFlag (uint8_t ADC_FLAG)
 Clears the ADC's pending flags. More...
 
ITStatus ADC_GetITStatus (uint16_t ADC_IT)
 Checks whether the specified ADC interrupt has occurred or not. More...
 
void ADC_ClearITPendingBit (uint16_t ADC_IT)
 Clears the ADC's interrupt pending bits. More...
 
uint16_t ADC_GetADValue (uint16_t data)
 Adjust the ADC conversion result. More...
 

Detailed Description

Function Documentation

◆ ADC_AnalogWatchdogCmd()

void ADC_AnalogWatchdogCmd ( uint32_t  ADC_AnalogWatchdog)

Enables or disables the analog watchdog on single/all regular or injected channels.

Parameters
ADC_AnalogWatchdogthe ADC analog watchdog configuration. This parameter can be one of the following values:
  • ADC_AnalogWatchdog_SingleRegEnable: Analog watchdog on a single regular channel
  • ADC_AnalogWatchdog_SingleInjecEnable: Analog watchdog on a single injected channel
  • ADC_AnalogWatchdog_SingleRegOrInjecEnable: Analog watchdog on a single regular or injected channel
  • ADC_AnalogWatchdog_AllRegEnable: Analog watchdog on all regular channel
  • ADC_AnalogWatchdog_AllInjecEnable: Analog watchdog on all injected channel
  • ADC_AnalogWatchdog_AllRegAllInjecEnable: Analog watchdog on all regular and injected channels
  • ADC_AnalogWatchdog_None: No channel guarded by the analog watchdog
Return values
None

◆ ADC_AnalogWatchdogSingleChannelConfig()

void ADC_AnalogWatchdogSingleChannelConfig ( uint8_t  ADC_Channel)

Configures the analog watchdog guarded single channel.

Parameters
ADC_Channelthe ADC channel to configure for the analog watchdog. This parameter can be one of the following values:
  • ADC_Channel_0: ADC Channel0 selected
  • ADC_Channel_1: ADC Channel1 selected
  • ADC_Channel_2: ADC Channel2 selected
  • ADC_Channel_3: ADC Channel3 selected
  • ADC_Channel_4: ADC Channel4 selected
  • ADC_Channel_5: ADC Channel5 selected
  • ADC_Channel_6: ADC Channel6 selected
  • ADC_Channel_7: ADC Channel7 selected
  • ADC_Channel_8: ADC Channel8 selected
  • ADC_Channel_9: ADC Channel9 selected
  • ADC_Channel_10: ADC Channel10 selected
  • ADC_Channel_11: ADC Channel11 selected
  • ADC_Channel_12: ADC Channel12 selected
  • ADC_Channel_13: ADC Channel13 selected
  • ADC_Channel_14: ADC Channel14 selected
  • ADC_Channel_15: ADC Channel15 selected
  • ADC_Channel_16: ADC Channel16 selected
  • ADC_Channel_17: ADC Channel17 selected
Return values
None

◆ ADC_AnalogWatchdogThresholdsConfig()

void ADC_AnalogWatchdogThresholdsConfig ( uint16_t  HighThreshold,
uint16_t  LowThreshold 
)

Configures the high and low thresholds of the analog watchdog.

Parameters
HighThresholdthe ADC analog watchdog High threshold value. This parameter must be a 12bit value.
LowThresholdthe ADC analog watchdog Low threshold value. This parameter must be a 12bit value.
Return values
None

◆ ADC_AutoInjectedConvCmd()

void ADC_AutoInjectedConvCmd ( FunctionalState  NewState)

Enables or disables the selected ADC automatic injected group conversion after regular one.

Parameters
NewStatenew state of the selected ADC auto injected conversion This parameter can be: ENABLE or DISABLE.
Return values
None

◆ ADC_ClearFlag()

void ADC_ClearFlag ( uint8_t  ADC_FLAG)

Clears the ADC's pending flags.

Parameters
ADC_FLAGspecifies the flag to clear. This parameter can be any combination of the following values:
  • ADC_FLAG_AWD: Analog watchdog flag
  • ADC_FLAG_EOC: End of conversion flag
  • ADC_FLAG_JEOC: End of injected group conversion flag
  • ADC_FLAG_JSTRT: Start of injected group conversion flag
  • ADC_FLAG_STRT: Start of regular group conversion flag
Return values
None

◆ ADC_ClearITPendingBit()

void ADC_ClearITPendingBit ( uint16_t  ADC_IT)

Clears the ADC's interrupt pending bits.

Parameters
ADC_ITspecifies the ADC interrupt pending bit to clear. This parameter can be any combination of the following values:
  • ADC_IT_EOC: End of conversion interrupt mask
  • ADC_IT_AWD: Analog watchdog interrupt mask
  • ADC_IT_JEOC: End of injected conversion interrupt mask
Return values
None

◆ ADC_Cmd()

void ADC_Cmd ( FunctionalState  NewState)

Enables or disables the ADC peripheral.

Parameters
NewStatenew state of the ADC peripheral. This parameter can be: ENABLE or DISABLE.
Return values
None

◆ ADC_DeInit()

void ADC_DeInit ( void  )

Deinitializes the ADC peripheral registers to their default reset values.

Return values
None

◆ ADC_DiscModeChannelCountConfig()

void ADC_DiscModeChannelCountConfig ( uint8_t  Number)

Configures the discontinuous mode for the selected ADC regular group channel.

Parameters
Numberspecifies the discontinuous mode regular channel count value. This number must be between 1 and 8.
Return values
None

◆ ADC_DiscModeCmd()

void ADC_DiscModeCmd ( FunctionalState  NewState)

Enables or disables the discontinuous mode on regular group channel for the ADC.

Parameters
NewStatenew state of the selected ADC discontinuous mode on regular group channel. This parameter can be: ENABLE or DISABLE.
Return values
None

◆ ADC_DMACmd()

void ADC_DMACmd ( FunctionalState  NewState)

Enables or disables the ADC DMA request.

Parameters
NewStatenew state of the selected ADC DMA transfer. This parameter can be: ENABLE or DISABLE.
Return values
None

◆ ADC_ExternalTrigConvCmd()

void ADC_ExternalTrigConvCmd ( FunctionalState  NewState)

Enables or disables the ADC conversion through external trigger.

Parameters
NewStatenew state of the selected ADC external trigger start of conversion. This parameter can be: ENABLE or DISABLE.
Return values
None

◆ ADC_ExternalTrigInjectedConvCmd()

void ADC_ExternalTrigInjectedConvCmd ( FunctionalState  NewState)

Enables or disables the ADC injected channels conversion through external trigger.

Parameters
NewStatenew state of the selected ADC external trigger start of injected conversion. This parameter can be: ENABLE or DISABLE.
Return values
None

◆ ADC_ExternalTrigInjectedConvConfig()

void ADC_ExternalTrigInjectedConvConfig ( uint32_t  ADC_ExternalTrigInjecConv)

Configures the ADC external trigger for injected channels conversion.

Parameters
ADC_ExternalTrigInjecConvspecifies the ADC trigger to start injected conversion. This parameter can be one of the following values:
  • ADC_ExternalTrigInjecConv_T1_TRGO: Timer1 TRGO event selected
  • ADC_ExternalTrigInjecConv_T1_CC4: Timer1 capture compare4 selected
  • ADC_ExternalTrigInjecConv_T2_TRGO: Timer2 TRGO event selected
  • ADC_ExternalTrigInjecConv_T2_CC1: Timer2 capture compare1 selected
  • ADC_ExternalTrigInjecConv_T3_CC4: Timer3 capture compare4 selected
  • ADC_ExternalTrigInjecConv_T4_TRGO: Timer4 TRGO event selected
  • ADC_ExternalTrigInjecConv_Ext_IT15: External interrupt line 15
  • ADC_ExternalTrigInjecConv_None: Injected conversion started by software and not by external trigger
Return values
None

◆ ADC_GetADValue()

uint16_t ADC_GetADValue ( uint16_t  data)

Adjust the ADC conversion result.

Parameters
datathe ADC conversion result.
Return values
Adjustedresult.

◆ ADC_GetCalibrationStatus()

FlagStatus ADC_GetCalibrationStatus ( void  )

Gets the selected ADC calibration status.

Return values
Thenew state of ADC calibration (SET or RESET).

◆ ADC_GetConversionValue()

uint16_t ADC_GetConversionValue ( void  )

Returns the last ADC conversion result data for regular channel.

Return values
TheData conversion value.

◆ ADC_GetFlagStatus()

FlagStatus ADC_GetFlagStatus ( uint8_t  ADC_FLAG)

Checks whether the specified ADC flag is set or not.

Parameters
ADC_FLAGspecifies the flag to check. This parameter can be one of the following values:
  • ADC_FLAG_AWD: Analog watchdog flag
  • ADC_FLAG_EOC: End of conversion flag
  • ADC_FLAG_JEOC: End of injected group conversion flag
  • ADC_FLAG_JSTRT: Start of injected group conversion flag
  • ADC_FLAG_STRT: Start of regular group conversion flag
Return values
Thenew state of ADC_FLAG (SET or RESET).

◆ ADC_GetInjectedConversionValue()

uint16_t ADC_GetInjectedConversionValue ( uint8_t  ADC_InjectedChannel)

Returns the ADC injected channel conversion result.

Parameters
ADC_InjectedChannelthe converted ADC injected channel. This parameter can be one of the following values:
  • ADC_InjectedChannel_1: Injected Channel1 selected
  • ADC_InjectedChannel_2: Injected Channel2 selected
  • ADC_InjectedChannel_3: Injected Channel3 selected
  • ADC_InjectedChannel_4: Injected Channel4 selected
Return values
TheData conversion value.

◆ ADC_GetITStatus()

ITStatus ADC_GetITStatus ( uint16_t  ADC_IT)

Checks whether the specified ADC interrupt has occurred or not.

Parameters
ADC_ITspecifies the ADC interrupt source to check. This parameter can be one of the following values:
  • ADC_IT_EOC: End of conversion interrupt mask
  • ADC_IT_AWD: Analog watchdog interrupt mask
  • ADC_IT_JEOC: End of injected conversion interrupt mask
  • ADC_IT_OVF: ADC fifo overflow interrupt mask
  • ADC_IT_EMP: ADC fifo empty interrupt mask
Return values
Thenew state of ADC_IT (SET or RESET).

◆ ADC_GetResetCalibrationStatus()

FlagStatus ADC_GetResetCalibrationStatus ( void  )

Gets the selected ADC reset calibration registers status.

Return values
Thenew state of ADC reset calibration registers (SET or RESET).

◆ ADC_GetSoftwareStartConvStatus()

FlagStatus ADC_GetSoftwareStartConvStatus ( void  )

Gets the selected ADC Software start conversion Status.

Return values
Thenew state of ADC software start conversion (SET or RESET).

◆ ADC_GetSoftwareStartInjectedConvCmdStatus()

FlagStatus ADC_GetSoftwareStartInjectedConvCmdStatus ( void  )

Gets the selected ADC Software start injected conversion Status.

Return values
Thenew state of ADC software start injected conversion (SET or RESET).

◆ ADC_Init()

void ADC_Init ( ADC_InitTypeDef ADC_InitStruct)

Initializes the ADC peripheral according to the specified parameters in the ADC_InitStruct.

Parameters
ADC_InitStructpointer to an ADC_InitTypeDef structure that contains the configuration information for the ADC peripheral.
Return values
None

◆ ADC_InjectedChannelConfig()

void ADC_InjectedChannelConfig ( uint8_t  ADC_Channel,
uint8_t  Rank,
uint8_t  ADC_SampleTime 
)

Configures for the selected ADC injected channel its corresponding rank in the sequencer and its sample time.

Parameters
ADC_Channelthe ADC channel to configure. This parameter can be one of the following values:
  • ADC_Channel_0: ADC Channel0 selected
  • ADC_Channel_1: ADC Channel1 selected
  • ADC_Channel_2: ADC Channel2 selected
  • ADC_Channel_3: ADC Channel3 selected
  • ADC_Channel_4: ADC Channel4 selected
  • ADC_Channel_5: ADC Channel5 selected
  • ADC_Channel_6: ADC Channel6 selected
  • ADC_Channel_7: ADC Channel7 selected
  • ADC_Channel_8: ADC Channel8 selected
  • ADC_Channel_9: ADC Channel9 selected
  • ADC_Channel_10: ADC Channel10 selected
  • ADC_Channel_11: ADC Channel11 selected
  • ADC_Channel_12: ADC Channel12 selected
  • ADC_Channel_13: ADC Channel13 selected
  • ADC_Channel_14: ADC Channel14 selected
  • ADC_Channel_15: ADC Channel15 selected
  • ADC_Channel_16: ADC Channel16 selected
  • ADC_Channel_17: ADC Channel17 selected
RankThe rank in the injected group sequencer. This parameter must be between 1 and 4.
ADC_SampleTimeThe sample time value to be set for the selected channel. This parameter can be one of the following values:
  • ADC_SampleTime_1Cycles5: Sample time equal to 1.5 cycles
  • ADC_SampleTime_7Cycles5: Sample time equal to 7.5 cycles
  • ADC_SampleTime_13Cycles5: Sample time equal to 13.5 cycles
  • ADC_SampleTime_28Cycles5: Sample time equal to 28.5 cycles
  • ADC_SampleTime_41Cycles5: Sample time equal to 41.5 cycles
  • ADC_SampleTime_55Cycles5: Sample time equal to 55.5 cycles
  • ADC_SampleTime_71Cycles5: Sample time equal to 71.5 cycles
  • ADC_SampleTime_239Cycles5: Sample time equal to 239.5 cycles
Return values
None

◆ ADC_InjectedDiscModeCmd()

void ADC_InjectedDiscModeCmd ( FunctionalState  NewState)

Enables or disables the discontinuous mode for injected group channel for the ADC.

Parameters
NewStatenew state of the selected ADC discontinuous mode on injected group channel. This parameter can be: ENABLE or DISABLE.
Return values
None

◆ ADC_InjectedDMACmd()

void ADC_InjectedDMACmd ( FunctionalState  NewState)

Enables or disables the ADC injected group DMA request.

Parameters
NewStatenew state of the selected ADC injected group DMA transfer. This parameter can be: ENABLE or DISABLE.
Return values
None

◆ ADC_InjectedSequencerLengthConfig()

void ADC_InjectedSequencerLengthConfig ( uint8_t  Length)

Configures the sequencer length for injected channels.

Parameters
LengthThe sequencer length. This parameter must be a number between 1 to 4.
Return values
None

◆ ADC_ITConfig()

void ADC_ITConfig ( uint16_t  ADC_IT,
FunctionalState  NewState 
)

Enables or disables the specified ADC interrupts.

Parameters
ADC_ITspecifies the ADC interrupt sources to be enabled or disabled. This parameter can be any combination of the following values:
  • ADC_IT_EOC: End of conversion interrupt mask
  • ADC_IT_AWD: Analog watchdog interrupt mask
  • ADC_IT_JEOC: End of injected conversion interrupt mask
  • ADC_IT_OVF: ADC fifo overflow interrupt mask
  • ADC_IT_EMP: ADC fifo empty interrupt mask
NewStatenew state of the specified ADC interrupts. This parameter can be: ENABLE or DISABLE.
Return values
None

◆ ADC_RegularChannelConfig()

void ADC_RegularChannelConfig ( uint8_t  ADC_Channel,
uint8_t  Rank,
uint8_t  ADC_SampleTime 
)

Configures for the selected ADC regular channel its corresponding rank in the sequencer and its sample time.

Parameters
ADC_Channelthe ADC channel to configure. This parameter can be one of the following values:
  • ADC_Channel_0: ADC Channel0 selected
  • ADC_Channel_1: ADC Channel1 selected
  • ADC_Channel_2: ADC Channel2 selected
  • ADC_Channel_3: ADC Channel3 selected
  • ADC_Channel_4: ADC Channel4 selected
  • ADC_Channel_5: ADC Channel5 selected
  • ADC_Channel_6: ADC Channel6 selected
  • ADC_Channel_7: ADC Channel7 selected
  • ADC_Channel_8: ADC Channel8 selected
  • ADC_Channel_9: ADC Channel9 selected
  • ADC_Channel_10: ADC Channel10 selected
  • ADC_Channel_11: ADC Channel11 selected
  • ADC_Channel_12: ADC Channel12 selected
  • ADC_Channel_13: ADC Channel13 selected
  • ADC_Channel_14: ADC Channel14 selected
  • ADC_Channel_15: ADC Channel15 selected
  • ADC_Channel_16: ADC Channel16 selected
  • ADC_Channel_17: ADC Channel17 selected
RankThe rank in the regular group sequencer. This parameter must be between 1 to 16.
ADC_SampleTimeThe sample time value to be set for the selected channel. This parameter can be one of the following values:
  • ADC_SampleTime_1Cycles5: Sample time equal to 1.5 cycles
  • ADC_SampleTime_7Cycles5: Sample time equal to 7.5 cycles
  • ADC_SampleTime_13Cycles5: Sample time equal to 13.5 cycles
  • ADC_SampleTime_28Cycles5: Sample time equal to 28.5 cycles
  • ADC_SampleTime_41Cycles5: Sample time equal to 41.5 cycles
  • ADC_SampleTime_55Cycles5: Sample time equal to 55.5 cycles
  • ADC_SampleTime_71Cycles5: Sample time equal to 71.5 cycles
  • ADC_SampleTime_239Cycles5: Sample time equal to 239.5 cycles
Return values
None

◆ ADC_ResetCalibration()

void ADC_ResetCalibration ( void  )

Resets the selected ADC calibration registers.

Return values
None

◆ ADC_SetInjectedOffset()

void ADC_SetInjectedOffset ( uint8_t  ADC_InjectedChannel,
uint16_t  Offset 
)

Set the injected channels conversion value offset.

Parameters
ADC_InjectedChannelthe ADC injected channel to set its offset. This parameter can be one of the following values:
  • ADC_InjectedChannel_1: Injected Channel1 selected
  • ADC_InjectedChannel_2: Injected Channel2 selected
  • ADC_InjectedChannel_3: Injected Channel3 selected
  • ADC_InjectedChannel_4: Injected Channel4 selected
Offsetthe offset value for the selected ADC injected channel This parameter must be a 12bit value.
Return values
None

◆ ADC_SoftwareStartConvCmd()

void ADC_SoftwareStartConvCmd ( FunctionalState  NewState)

Enables or disables the selected ADC software start conversion .

Parameters
NewStatenew state of the selected ADC software start conversion. This parameter can be: ENABLE or DISABLE.
Return values
None

◆ ADC_SoftwareStartInjectedConvCmd()

void ADC_SoftwareStartInjectedConvCmd ( FunctionalState  NewState)

Enables or disables the selected ADC start of the injected channels conversion.

Parameters
NewStatenew state of the selected ADC software start injected conversion. This parameter can be: ENABLE or DISABLE.
Return values
None

◆ ADC_StartCalibration()

void ADC_StartCalibration ( void  )

Starts the selected ADC calibration process.

Return values
None

◆ ADC_StructInit()

void ADC_StructInit ( ADC_InitTypeDef ADC_InitStruct)

Fills each ADC_InitStruct member with its default value.

Parameters
ADC_InitStruct: pointer to an ADC_InitTypeDef structure which will be initialized.
Return values
None

◆ ADC_TempSensorVrefintCmd()

void ADC_TempSensorVrefintCmd ( FunctionalState  NewState)

Enables or disables the temperature sensor and Vrefint channel.

Parameters
NewStatenew state of the temperature sensor. This parameter can be: ENABLE or DISABLE.
Return values
None