MG32L003 Standard Peripherals Firmware Library

函数
ADC_Private_Functions
MG32L003_StdPeriph_Driver » ADC

## 函数
void | ADC_DeInit (void)
| Deinitializes the ADC peripheral registers to their default reset values. 更多...
void | ADC_Init (ADC_InitTypeDef *ADC_InitStruct)
| Initializes the ADC peripheral according to the specified parameters in the ADC_InitStruct. 更多...
void | ADC_StructInit (ADC_InitTypeDef *ADC_InitStruct)
| Fills each ADC_InitStruct member with its default value. 更多...
void | ADC_Cmd (FunctionalState NewState)
| Enables or disables the ADC peripheral. 更多...
void | ADC_ITConfig (uint32_t ADC_IT, FunctionalState NewState)
| Enables or disables the specified ADC interrupts. 更多...
void | ADC_SoftwareStartConvCmd (FunctionalState NewState)
| Enables or disables the selected ADC software start conversion. 更多...
FlagStatus | ADC_GetSoftwareStartConvStatus (void)
| Gets the selected ADC Software start conversion Status. 更多...
uint16_t | ADC_GetConversionValue (uint32_t Channel)
| Returns the last ADC conversion result data for regular channel. 更多...
uint32_t | ADC_GetAccValue (void)
| Gets ADC accumulation conversion result. 更多...
ITStatus | ADC_GetITStatus (uint16_t ADC_IT)
| Checks whether the specified ADC interrupt is set or not. 更多...
FlagStatus | ADC_GetFlagStatus (uint16_t ADC_FLAG)
| Checks whether the specified ADC flag is set or not. 更多...
void | ADC_ClearITPendingBit (uint16_t ADC_IT)
| Clears the ADC pending interrupt bits. 更多...
void | ADC_ClearFlag (uint16_t ADC_FLAG)
| Clears the ADC pending interrupt flags. 更多...
FlagStatus | ADC_GetRawFlagStatus (uint16_t ADC_FLAG)
| Checks whether the specified ADC flag is set or not. 更多...
void | ADC_ThresholdsConfig (uint16_t LowThreshold, uint16_t HighThreshold)
| Configures the high and low thresholds of the analog watchdog. 更多...
void | ADC_ThresholdsCompareCmd (uint16_t Threshold_Config, FunctionalState NewState)
| Enables or disables the thresholds to compare with the function of analog watchdog. 更多...

## 详细描述

## 函数说明

## ◆ ADC_ClearFlag()

void ADC_ClearFlag | ( | uint16_t | ADC_FLAG | ) |

Clears the ADC pending interrupt flags.

参数

  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

返回值

  None |

## ◆ ADC_ClearITPendingBit()

void ADC_ClearITPendingBit | ( | uint16_t | ADC_IT | ) |

Clears the ADC pending interrupt bits.

参数

  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

返回值

  None |

## ◆ ADC_Cmd()

void ADC_Cmd | ( | FunctionalState | NewState | ) |

Enables or disables the ADC peripheral.

参数

  NewState | The new state of the ADC peripheral. This parameter can be: ENABLE or DISABLE.

返回值

  None |

## ◆ ADC_DeInit()

void ADC_DeInit | ( | void |  | ) |

Deinitializes the ADC peripheral registers to their default reset values.

参数

  None |

返回值

  None |

## ◆ ADC_GetAccValue()

uint32_t ADC_GetAccValue | ( | void |  | ) |

Gets ADC accumulation conversion result.

注解
  This function is only valid when RACC_EN is set.

参数

  None |

返回值

  ADC | accumulation conversion data

## ◆ ADC_GetConversionValue()

uint16_t ADC_GetConversionValue | ( | uint32_t | Channel | ) |

Returns the last ADC conversion result data for regular channel.

参数

  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

返回值

  The | Data conversion value.

## ◆ ADC_GetFlagStatus()

FlagStatus ADC_GetFlagStatus | ( | uint16_t | ADC_FLAG | ) |

Checks whether the specified ADC flag is set or not.

参数

  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

返回值

  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.

参数

  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

返回值

  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.

参数

  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

返回值

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

## ◆ ADC_GetSoftwareStartConvStatus()

FlagStatus ADC_GetSoftwareStartConvStatus | ( | void |  | ) |

Gets the selected ADC Software start conversion Status.

参数

  None |

返回值

  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.

参数

  ADC_InitStruct | pointer to an ADC_InitTypeDef structure that contains the configuration information for the ADC peripheral.

返回值

  None |

## ◆ ADC_ITConfig()

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

Enables or disables the specified ADC interrupts.

参数

  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.

返回值

  None |

## ◆ ADC_SoftwareStartConvCmd()

void ADC_SoftwareStartConvCmd | ( | FunctionalState | NewState | ) |

Enables or disables the selected ADC software start conversion.

参数

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

返回值

  None |

## ◆ ADC_StructInit()

void ADC_StructInit | ( | ADC_InitTypeDef * | ADC_InitStruct | ) |

Fills each ADC_InitStruct member with its default value.

参数

  ADC_InitStruct | : pointer to an ADC_InitTypeDef structure which will be initialized.

返回值

  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.

参数

  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.

返回值

  None |

## ◆ ADC_ThresholdsConfig()

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

Configures the high and low thresholds of the analog watchdog.

参数

  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.

返回值

  None |