WB32L003 Standard Peripherals Firmware Library

Functions
ADC_Private_Functions
WB32L003_StdPeriph_Driver » ADC

## 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_ITConfig (uint32_t ADC_IT, FunctionalState NewState)
| Enables or disables the specified ADC interrupts. 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...
uint16_t | ADC_GetConversionValue (uint32_t Channel)
| Returns the last ADC conversion result data for regular channel. More...
uint32_t | ADC_GetAccValue (void)
| Gets ADC accumulation conversion result. More...
ITStatus | ADC_GetITStatus (uint16_t ADC_IT)
| Checks whether the specified ADC interrupt is set or not. More...
FlagStatus | ADC_GetFlagStatus (uint16_t ADC_FLAG)
| Checks whether the specified ADC flag is set or not. More...
void | ADC_ClearITPendingBit (uint16_t ADC_IT)
| Clears the ADC pending interrupt bits. More...
void | ADC_ClearFlag (uint16_t ADC_FLAG)
| Clears the ADC pending interrupt flags. More...
FlagStatus | ADC_GetRawFlagStatus (uint16_t ADC_FLAG)
| Checks whether the specified ADC flag is set or not. More...
void | ADC_ThresholdsConfig (uint16_t LowThreshold, uint16_t HighThreshold)
| Configures the high and low thresholds of the analog watchdog. More...
void | ADC_ThresholdsCompareCmd (uint16_t Threshold_Config, FunctionalState NewState)
| Enables or disables the thresholds to compare with the function of analog watchdog. More...

## Detailed Description

## Function Documentation

## ◆ ADC_ClearFlag()

void ADC_ClearFlag | ( | uint16_t | ADC_FLAG | ) |

Clears the ADC pending interrupt flags.

Parameters

  ADC_FLAG | specifies the flag to clear. This parameter can be one of the following values: ADC_INTFLAG： ADC End of Continue Conversion interrupt flag ADC_INTFLAG_RANGE_THRESHOLD：ADC conversion data in defined range interrupt flag ADC_INTFLAG_HIGH_THRESHOLD：ADC conversion data above threshold interrupt flag ADC_INTFLAG_LOW_THERSHOLD：ADC conversion data below threshold interrupt flag ADC_INTFLAG_CHANNEL15: ADC End of channel 15 conversion interrupt flag ADC_INTFLAG_CHANNEL14: ADC End of channel 14 conversion interrupt flag ADC_INTFLAG_CHANNEL13: ADC End of channel 13 conversion interrupt flag ADC_INTFLAG_CHANNEL12: ADC End of channel 12 conversion interrupt flag ADC_INTFLAG_CHANNEL11: ADC End of channel 11 conversion interrupt flag ADC_INTFLAG_CHANNEL10: ADC End of channel 10 conversion interrupt flag ADC_INTFLAG_CHANNEL9: ADC End of channel 9 conversion interrupt flag ADC_INTFLAG_CHANNEL8: ADC End of channel 8 conversion interrupt flag ADC_INTFLAG_CHANNEL7：ADC End of channel7 conversion interrupt flag ADC_INTFLAG_CHANNEL6：ADC End of channel6 conversion interrupt flag ADC_INTFLAG_CHANNEL5：ADC End of channel5 conversion interrupt flag ADC_INTFLAG_CHANNEL4：ADC End of channel4 conversion interrupt flag ADC_INTFLAG_CHANNEL3：ADC End of channel3 conversion interrupt flag ADC_INTFLAG_CHANNEL2：ADC End of channel2 conversion interrupt flag ADC_INTFLAG_CHANNEL1：ADC End of channel1 conversion interrupt flag ADC_INTFLAG_CHANNEL0：ADC End of channel0 conversion interrupt flag

Return values

  None |

## ◆ ADC_ClearITPendingBit()

void ADC_ClearITPendingBit | ( | uint16_t | ADC_IT | ) |

Clears the ADC pending interrupt bits.

Parameters

  ADC_IT | specifies the ADC interrupt sources to clear. This parameter can be any combination of the following values: ADC_IT_CONTINUE: ADC End of Continue Conversion interrupt ADC_IT_RANGE_THRESHOLD: ADC conversion data in defined range interrupt ADC_IT_HIGH_THRESHOLD: ADC conversion data above threshold interrupt ADC_IT_LOW_THRESHOLD: ADC conversion data below threshold interrupt ADC_IT_CHANNEL15: ADC End of channel 15 conversion interrupt ADC_IT_CHANNEL14: ADC End of channel 14 conversion interrupt ADC_IT_CHANNEL13: ADC End of channel 13 conversion interrupt ADC_IT_CHANNEL12: ADC End of channel 12 conversion interrupt ADC_IT_CHANNEL11: ADC End of channel 11 conversion interrupt ADC_IT_CHANNEL10: ADC End of channel 10 conversion interrupt ADC_IT_CHANNEL9: ADC End of channel 9 conversion interrupt ADC_IT_CHANNEL8: ADC End of channel 8 conversion interrupt ADC_IT_CHANNEL7: ADC End of channel 7 conversion interrupt ADC_IT_CHANNEL6: ADC End of channel 6 conversion interrupt ADC_IT_CHANNEL5: ADC End of channel 5 conversion interrupt ADC_IT_CHANNEL4: ADC End of channel 4 conversion interrupt ADC_IT_CHANNEL3: ADC End of channel 3 conversion interrupt ADC_IT_CHANNEL2: ADC End of channel 2 conversion interrupt ADC_IT_CHANNEL1: ADC End of channel 1 conversion interrupt ADC_IT_CHANNEL0: ADC End of channel 0 conversion interrupt

Return values

  None |

## ◆ ADC_Cmd()

void ADC_Cmd | ( | FunctionalState | NewState | ) |

Enables or disables the ADC peripheral.

Parameters

  NewState | The new 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.

Parameters

  None |

Return values

  None |

## ◆ ADC_GetAccValue()

uint32_t ADC_GetAccValue | ( | void |  | ) |

Gets ADC accumulation conversion result.

Note
  This function is only valid when RACC_EN is set.

Parameters

  None |

Return values

  ADC | accumulation conversion data

## ◆ ADC_GetConversionValue()

uint16_t ADC_GetConversionValue | ( | uint32_t | Channel | ) |

Returns the last ADC conversion result data for regular channel.

Parameters

  Channel | Selected channel to get ADC conversion value. This parameter can be one of the following values: ADC_SINGLE_CHANNEL_0: ADC channel 0 in single mode ADC_SINGLE_CHANNEL_1: ADC channel 1 in single mode ADC_SINGLE_CHANNEL_2: ADC channel 2 in single mode ADC_SINGLE_CHANNEL_3: ADC channel 3 in single mode ADC_SINGLE_CHANNEL_4: ADC channel 4 in single mode ADC_SINGLE_CHANNEL_5: ADC channel 5 in single mode ADC_SINGLE_CHANNEL_6: ADC channel 6 in single mode ADC_SINGLE_CHANNEL_7: ADC channel 7 in single mode ADC_SINGLE_CHANNEL_8: ADC channel 8 in single mode ADC_SINGLE_CHANNEL_9: ADC channel 9 in single mode ADC_SINGLE_CHANNEL_10: ADC channel 10 in single mode ADC_SINGLE_CHANNEL_11: ADC channel 11 in single mode ADC_SINGLE_CHANNEL_12: ADC channel 12 in single mode ADC_SINGLE_CHANNEL_13: ADC channel 13 in single mode ADC_SINGLE_CHANNEL_14: ADC channel 14 in single mode ADC_SINGLE_CHANNEL_15: ADC channel 15 in single mode ADC_CONTINUE_CHANNEL_0: ADC channel 0 in continue mode ADC_CONTINUE_CHANNEL_1: ADC channel 1 in continue mode ADC_CONTINUE_CHANNEL_2: ADC channel 2 in continue mode ADC_CONTINUE_CHANNEL_3: ADC channel 3 in continue mode ADC_CONTINUE_CHANNEL_4: ADC channel 4 in continue mode ADC_CONTINUE_CHANNEL_5: ADC channel 5 in continue mode ADC_CONTINUE_CHANNEL_6: ADC channel 6 in continue mode ADC_CONTINUE_CHANNEL_7: ADC channel 7 in continue mode ADC_CONTINUE_CHANNEL_8: ADC channel 8 in continue mode ADC_CONTINUE_CHANNEL_9: ADC channel 9 in continue mode ADC_CONTINUE_CHANNEL_10: ADC channel 10 in continue mode ADC_CONTINUE_CHANNEL_11: ADC channel 11 in continue mode ADC_CONTINUE_CHANNEL_12: ADC channel 12 in continue mode ADC_CONTINUE_CHANNEL_13: ADC channel 13 in continue mode ADC_CONTINUE_CHANNEL_14: ADC channel 14 in continue mode ADC_CONTINUE_CHANNEL_15: ADC channel 15 in continue mode

Return values

  The | Data conversion value.

## ◆ ADC_GetFlagStatus()

FlagStatus ADC_GetFlagStatus | ( | uint16_t | ADC_FLAG | ) |

Checks whether the specified ADC flag is set or not.

Parameters

  ADC_FLAG | specifies the flag to check. This parameter can be any combination of the following values: ADC_INTFLAG：ADC End of Continue Conversion interrupt flag ADC_INTFLAG_RANGE_THRESHOLD：ADC conversion data in defined range interrupt flag ADC_INTFLAG_HIGH_THRESHOLD：ADC conversion data above threshold interrupt flag ADC_INTFLAG_LOW_THERSHOLD：ADC conversion data below threshold interrupt flag ADC_INTFLAG_CHANNEL15: ADC End of channel 15 conversion interrupt flag ADC_INTFLAG_CHANNEL14: ADC End of channel 14 conversion interrupt flag ADC_INTFLAG_CHANNEL13: ADC End of channel 13 conversion interrupt flag ADC_INTFLAG_CHANNEL12: ADC End of channel 12 conversion interrupt flag ADC_INTFLAG_CHANNEL11: ADC End of channel 11 conversion interrupt flag ADC_INTFLAG_CHANNEL10: ADC End of channel 10 conversion interrupt flag ADC_INTFLAG_CHANNEL9: ADC End of channel 9 conversion interrupt flag ADC_INTFLAG_CHANNEL8: ADC End of channel 8 conversion interrupt flag ADC_INTFLAG_CHANNEL7：ADC End of channel7 conversion interrupt flag ADC_INTFLAG_CHANNEL6：ADC End of channel6 conversion interrupt flag ADC_INTFLAG_CHANNEL5：ADC End of channel5 conversion interrupt flag ADC_INTFLAG_CHANNEL4：ADC End of channel4 conversion interrupt flag ADC_INTFLAG_CHANNEL3：ADC End of channel3 conversion interrupt flag ADC_INTFLAG_CHANNEL2：ADC End of channel2 conversion interrupt flag ADC_INTFLAG_CHANNEL1：ADC End of channel1 conversion interrupt flag ADC_INTFLAG_CHANNEL0：ADC End of channel0 conversion interrupt flag

Return values

  The | new state of ADC_FLAG (SET or RESET).

## ◆ ADC_GetITStatus()

ITStatus ADC_GetITStatus | ( | uint16_t | ADC_IT | ) |

Checks whether the specified ADC interrupt is set or not.

Parameters

  ADC_IT | specifies the ADC interrupt sources to check. This parameter can be any combination of the following values: ADC_IT_CONTINUE: ADC End of Continue Conversion interrupt ADC_IT_RANGE_THRESHOLD: ADC conversion data in defined range interrupt ADC_IT_HIGH_THRESHOLD: ADC conversion data above threshold interrupt ADC_IT_LOW_THRESHOLD: ADC conversion data below threshold interrupt ADC_IT_CHANNEL15: ADC End of channel 15 conversion interrupt ADC_IT_CHANNEL14: ADC End of channel 14 conversion interrupt ADC_IT_CHANNEL13: ADC End of channel 13 conversion interrupt ADC_IT_CHANNEL12: ADC End of channel 12 conversion interrupt ADC_IT_CHANNEL11: ADC End of channel 11 conversion interrupt ADC_IT_CHANNEL10: ADC End of channel 10 conversion interrupt ADC_IT_CHANNEL9: ADC End of channel 9 conversion interrupt ADC_IT_CHANNEL8: ADC End of channel 8 conversion interrupt ADC_IT_CHANNEL7: ADC End of channel 7 conversion interrupt ADC_IT_CHANNEL6: ADC End of channel 6 conversion interrupt ADC_IT_CHANNEL5: ADC End of channel 5 conversion interrupt ADC_IT_CHANNEL4: ADC End of channel 4 conversion interrupt ADC_IT_CHANNEL3: ADC End of channel 3 conversion interrupt ADC_IT_CHANNEL2: ADC End of channel 2 conversion interrupt ADC_IT_CHANNEL1: ADC End of channel 1 conversion interrupt ADC_IT_CHANNEL0: ADC End of channel 0 conversion interrupt

Return values

  The | new state of ADC_FLAG (SET or RESET).

## ◆ ADC_GetRawFlagStatus()

FlagStatus ADC_GetRawFlagStatus | ( | uint16_t | ADC_FLAG | ) |

Checks whether the specified ADC flag is set or not.

Parameters

  ADC_FLAG | specifies the flag to check. This parameter can be any combination of the following values: ADC_INTFLAG： ADC End of Continue Conversion interrupt flag ADC_INTFLAG_RANGE_THRESHOLD：ADC conversion data in defined range interrupt flag ADC_INTFLAG_HIGH_THRESHOLD：ADC conversion data above threshold interrupt flag ADC_INTFLAG_LOW_THERSHOLD：ADC conversion data below threshold interrupt flag ADC_INTFLAG_CHANNEL15: ADC End of channel 15 conversion interrupt flag ADC_INTFLAG_CHANNEL14: ADC End of channel 14 conversion interrupt flag ADC_INTFLAG_CHANNEL13: ADC End of channel 13 conversion interrupt flag ADC_INTFLAG_CHANNEL12: ADC End of channel 12 conversion interrupt flag ADC_INTFLAG_CHANNEL11: ADC End of channel 11 conversion interrupt flag ADC_INTFLAG_CHANNEL10: ADC End of channel 10 conversion interrupt flag ADC_INTFLAG_CHANNEL9: ADC End of channel 9 conversion interrupt flag ADC_INTFLAG_CHANNEL8: ADC End of channel 8 conversion interrupt flag ADC_INTFLAG_CHANNEL7：ADC End of channel7 conversion interrupt flag ADC_INTFLAG_CHANNEL6：ADC End of channel6 conversion interrupt flag ADC_INTFLAG_CHANNEL5：ADC End of channel5 conversion interrupt flag ADC_INTFLAG_CHANNEL4：ADC End of channel4 conversion interrupt flag ADC_INTFLAG_CHANNEL3：ADC End of channel3 conversion interrupt flag ADC_INTFLAG_CHANNEL2：ADC End of channel2 conversion interrupt flag ADC_INTFLAG_CHANNEL1：ADC End of channel1 conversion interrupt flag ADC_INTFLAG_CHANNEL0：ADC End of channel0 conversion interrupt flag

Return values

  The | new state of ADC_FLAG (SET or RESET).

## ◆ ADC_GetSoftwareStartConvStatus()

FlagStatus ADC_GetSoftwareStartConvStatus | ( | void |  | ) |

Gets the selected ADC Software start conversion Status.

Parameters

  None |

Return values

  The | new state of ADC software start 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_InitStruct | pointer to an ADC_InitTypeDef structure that contains the configuration information for the ADC peripheral.

Return values

  None |

## ◆ ADC_ITConfig()

void ADC_ITConfig | ( | uint32_t | ADC_IT,
|  | FunctionalState | NewState
| ) |  |

Enables or disables the specified ADC interrupts.

Parameters

  ADC_IT | specifies the ADC interrupt sources to be enabled or disabled. This parameter can be any combination of the following values: ADC_IT_CONTINUE: ADC End of Continue Conversion interrupt ADC_IT_RANGE_THRESHOLD: ADC conversion data in defined range interrupt ADC_IT_HIGH_THRESHOLD: ADC conversion data above threshold interrupt ADC_IT_LOW_THRESHOLD: ADC conversion data below threshold interrupt ADC_IT_CHANNEL15: ADC End of channel 15 conversion interrupt ADC_IT_CHANNEL14: ADC End of channel 14 conversion interrupt ADC_IT_CHANNEL13: ADC End of channel 13 conversion interrupt ADC_IT_CHANNEL12: ADC End of channel 12 conversion interrupt ADC_IT_CHANNEL11: ADC End of channel 11 conversion interrupt ADC_IT_CHANNEL10: ADC End of channel 10 conversion interrupt ADC_IT_CHANNEL9: ADC End of channel 9 conversion interrupt ADC_IT_CHANNEL8: ADC End of channel 8 conversion interrupt ADC_IT_CHANNEL7: ADC End of channel 7 conversion interrupt ADC_IT_CHANNEL6: ADC End of channel 6 conversion interrupt ADC_IT_CHANNEL5: ADC End of channel 5 conversion interrupt ADC_IT_CHANNEL4: ADC End of channel 4 conversion interrupt ADC_IT_CHANNEL3: ADC End of channel 3 conversion interrupt ADC_IT_CHANNEL2: ADC End of channel 2 conversion interrupt ADC_IT_CHANNEL1: ADC End of channel 1 conversion interrupt ADC_IT_CHANNEL0: ADC End of channel 0 conversion interrupt
  NewState | The new state of the specified ADC interrupts. This parameter can be: ENABLE or DISABLE.

Return values

  None |

## ◆ ADC_SoftwareStartConvCmd()

void ADC_SoftwareStartConvCmd | ( | FunctionalState | NewState | ) |

Enables or disables the selected ADC software start conversion.

Parameters

  NewState | The new state of the selected ADC software start conversion. This parameter can be: ENABLE or DISABLE.

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_ThresholdsCompareCmd()

void ADC_ThresholdsCompareCmd | ( | uint16_t | Threshold_Config,
|  | FunctionalState | NewState
| ) |  |

Enables or disables the thresholds to compare with the function of analog watchdog.

Parameters

  Threshold_Config | the ADC analog watchdog threshold configuration. This parameter can be any combination of the following values: ADC_High_Threshold_Compare: ADC high threshold compare ADC_Low_Threshold_Compare: ADC low threshold compare ADC_Range_Threshold_Compare: ADC range threshold compare
  NewState | The new state of the selected ADC software starts conversion. This parameter can be: ENABLE or DISABLE.

Return values

  None |

## ◆ ADC_ThresholdsConfig()

void ADC_ThresholdsConfig | ( | uint16_t | LowThreshold,
|  | uint16_t | HighThreshold
| ) |  |

Configures the high and low thresholds of the analog watchdog.

Parameters

  LowThreshold | the ADC analog watchdog Low threshold value. This parameter must be a 12bit value.
  HighThreshold | the ADC analog watchdog High threshold value. This parameter must be a 12bit value.

Return values

  None |