MG32F10x Standard Peripherals Firmware Library

模块 | 结构体 | 函数
ADC
MG32F10x_StdPeriph_Driver

ADC driver modules 更多...

## 模块
| ADC_Exported_Constants
| ADC_Private_Defines
| ADC_Private_Functions

## 结构体
struct | ADC_InitTypeDef
| ADC Init structure definition 更多...

## 函数
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_DMACmd (FunctionalState NewState)
| Enables or disables the ADC DMA request. 更多...
void | ADC_InjectedDMACmd (FunctionalState NewState)
| Enables or disables the ADC injected group DMA request. 更多...
void | ADC_ITConfig (uint16_t ADC_IT, FunctionalState NewState)
| Enables or disables the specified ADC interrupts. 更多...
void | ADC_ResetCalibration (void)
| Resets the selected ADC calibration registers. 更多...
FlagStatus | ADC_GetResetCalibrationStatus (void)
| Gets the selected ADC reset calibration registers status. 更多...
void | ADC_StartCalibration (void)
| Starts the selected ADC calibration process. 更多...
FlagStatus | ADC_GetCalibrationStatus (void)
| Gets the selected ADC calibration status. 更多...
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. 更多...
void | ADC_DiscModeChannelCountConfig (uint8_t Number)
| Configures the discontinuous mode for the selected ADC regular group channel. 更多...
void | ADC_DiscModeCmd (FunctionalState NewState)
| Enables or disables the discontinuous mode on regular group channel for the ADC 更多...
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. 更多...
void | ADC_ExternalTrigConvCmd (FunctionalState NewState)
| Enables or disables the ADC conversion through external trigger. 更多...
uint16_t | ADC_GetConversionValue (void)
| Returns the last ADC conversion result data for regular channel. 更多...
void | ADC_AutoInjectedConvCmd (FunctionalState NewState)
| Enables or disables the selected ADC automatic injected group conversion after regular one. 更多...
void | ADC_InjectedDiscModeCmd (FunctionalState NewState)
| Enables or disables the discontinuous mode for injected group channel for the ADC 更多...
void | ADC_ExternalTrigInjectedConvConfig (uint32_t ADC_ExternalTrigInjecConv)
| Configures the ADC external trigger for injected channels conversion. 更多...
void | ADC_ExternalTrigInjectedConvCmd (FunctionalState NewState)
| Enables or disables the ADC injected channels conversion through external trigger 更多...
void | ADC_SoftwareStartInjectedConvCmd (FunctionalState NewState)
| Enables or disables the selected ADC start of the injected channels conversion. 更多...
FlagStatus | ADC_GetSoftwareStartInjectedConvCmdStatus (void)
| Gets the selected ADC Software start injected conversion Status. 更多...
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. 更多...
void | ADC_InjectedSequencerLengthConfig (uint8_t Length)
| Configures the sequencer length for injected channels 更多...
void | ADC_SetInjectedOffset (uint8_t ADC_InjectedChannel, uint16_t Offset)
| Set the injected channels conversion value offset 更多...
uint16_t | ADC_GetInjectedConversionValue (uint8_t ADC_InjectedChannel)
| Returns the ADC injected channel conversion result 更多...
void | ADC_AnalogWatchdogCmd (uint32_t ADC_AnalogWatchdog)
| Enables or disables the analog watchdog on single/all regular or injected channels 更多...
void | ADC_AnalogWatchdogThresholdsConfig (uint16_t HighThreshold, uint16_t LowThreshold)
| Configures the high and low thresholds of the analog watchdog. 更多...
void | ADC_AnalogWatchdogSingleChannelConfig (uint8_t ADC_Channel)
| Configures the analog watchdog guarded single channel 更多...
void | ADC_TempSensorVrefintCmd (FunctionalState NewState)
| Enables or disables the temperature sensor and Vrefint channel. 更多...
FlagStatus | ADC_GetFlagStatus (uint8_t ADC_FLAG)
| Checks whether the specified ADC flag is set or not. 更多...
void | ADC_ClearFlag (uint8_t ADC_FLAG)
| Clears the ADC's pending flags. 更多...
ITStatus | ADC_GetITStatus (uint16_t ADC_IT)
| Checks whether the specified ADC interrupt has occurred or not. 更多...
void | ADC_ClearITPendingBit (uint16_t ADC_IT)
| Clears the ADC's interrupt pending bits. 更多...
uint16_t | ADC_GetADValue (uint16_t data)
| Adjust the ADC conversion result. 更多...

## 详细描述

ADC driver modules

## 函数说明

## ◆ ADC_AnalogWatchdogCmd()

void ADC_AnalogWatchdogCmd | ( | uint32_t | ADC_AnalogWatchdog | ) |

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

参数

  ADC_AnalogWatchdog | the 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

返回值

  None |

## ◆ ADC_AnalogWatchdogSingleChannelConfig()

void ADC_AnalogWatchdogSingleChannelConfig | ( | uint8_t | ADC_Channel | ) |

Configures the analog watchdog guarded single channel

参数

  ADC_Channel | the 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

返回值

  None |

## ◆ ADC_AnalogWatchdogThresholdsConfig()

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

Configures the high and low thresholds of the analog watchdog.

参数

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

返回值

  None |

## ◆ ADC_AutoInjectedConvCmd()

void ADC_AutoInjectedConvCmd | ( | FunctionalState | NewState | ) |

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

参数

  NewState | new state of the selected ADC auto injected conversion This parameter can be: ENABLE or DISABLE.

返回值

  None |

## ◆ ADC_ClearFlag()

void ADC_ClearFlag | ( | uint8_t | ADC_FLAG | ) |

Clears the ADC's pending flags.

参数

  ADC_FLAG | specifies 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

返回值

  None |

## ◆ ADC_ClearITPendingBit()

void ADC_ClearITPendingBit | ( | uint16_t | ADC_IT | ) |

Clears the ADC's interrupt pending bits.

参数

  ADC_IT | specifies 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

返回值

  None |

## ◆ ADC_Cmd()

void ADC_Cmd | ( | FunctionalState | NewState | ) |

Enables or disables the ADC peripheral.

参数

  NewState | 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 |

## ◆ ADC_DiscModeChannelCountConfig()

void ADC_DiscModeChannelCountConfig | ( | uint8_t | Number | ) |

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

参数

  Number | specifies the discontinuous mode regular channel count value. This number must be between 1 and 8.

返回值

  None |

## ◆ ADC_DiscModeCmd()

void ADC_DiscModeCmd | ( | FunctionalState | NewState | ) |

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

参数

  NewState | new state of the selected ADC discontinuous mode on regular group channel. This parameter can be: ENABLE or DISABLE.

返回值

  None |

## ◆ ADC_DMACmd()

void ADC_DMACmd | ( | FunctionalState | NewState | ) |

Enables or disables the ADC DMA request.

参数

  NewState | new state of the selected ADC DMA transfer. This parameter can be: ENABLE or DISABLE.

返回值

  None |

## ◆ ADC_ExternalTrigConvCmd()

void ADC_ExternalTrigConvCmd | ( | FunctionalState | NewState | ) |

Enables or disables the ADC conversion through external trigger.

参数

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

返回值

  None |

## ◆ ADC_ExternalTrigInjectedConvCmd()

void ADC_ExternalTrigInjectedConvCmd | ( | FunctionalState | NewState | ) |

Enables or disables the ADC injected channels conversion through external trigger

参数

  NewState | new state of the selected ADC external trigger start of injected conversion. This parameter can be: ENABLE or DISABLE.

返回值

  None |

## ◆ ADC_ExternalTrigInjectedConvConfig()

void ADC_ExternalTrigInjectedConvConfig | ( | uint32_t | ADC_ExternalTrigInjecConv | ) |

Configures the ADC external trigger for injected channels conversion.

参数

  ADC_ExternalTrigInjecConv | specifies 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

返回值

  None |

## ◆ ADC_GetADValue()

uint16_t ADC_GetADValue | ( | uint16_t | data | ) |

Adjust the ADC conversion result.

参数

  data | the ADC conversion result.

返回值

  Adjusted | result.

## ◆ ADC_GetCalibrationStatus()

FlagStatus ADC_GetCalibrationStatus | ( | void |  | ) |

Gets the selected ADC calibration status.

返回值

  The | new state of ADC calibration (SET or RESET).

## ◆ ADC_GetConversionValue()

uint16_t ADC_GetConversionValue | ( | void |  | ) |

Returns the last ADC conversion result data for regular channel.

返回值

  The | Data conversion value.

## ◆ ADC_GetFlagStatus()

FlagStatus ADC_GetFlagStatus | ( | uint8_t | ADC_FLAG | ) |

Checks whether the specified ADC flag is set or not.

参数

  ADC_FLAG | specifies 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

返回值

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

## ◆ ADC_GetInjectedConversionValue()

uint16_t ADC_GetInjectedConversionValue | ( | uint8_t | ADC_InjectedChannel | ) |

Returns the ADC injected channel conversion result

参数

  ADC_InjectedChannel | the 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

返回值

  The | Data conversion value.

## ◆ ADC_GetITStatus()

ITStatus ADC_GetITStatus | ( | uint16_t | ADC_IT | ) |

Checks whether the specified ADC interrupt has occurred or not.

参数

  ADC_IT | specifies 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

返回值

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

## ◆ ADC_GetResetCalibrationStatus()

FlagStatus ADC_GetResetCalibrationStatus | ( | void |  | ) |

Gets the selected ADC reset calibration registers status.

返回值

  The | new state of ADC reset calibration registers (SET or RESET).

## ◆ ADC_GetSoftwareStartConvStatus()

FlagStatus ADC_GetSoftwareStartConvStatus | ( | void |  | ) |

Gets the selected ADC Software start conversion Status.

返回值

  The | new state of ADC software start conversion (SET or RESET).

## ◆ ADC_GetSoftwareStartInjectedConvCmdStatus()

FlagStatus ADC_GetSoftwareStartInjectedConvCmdStatus | ( | void |  | ) |

Gets the selected ADC Software start injected conversion Status.

返回值

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

参数

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

返回值

  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.

参数

  ADC_Channel | the 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
  Rank | The rank in the injected group sequencer. This parameter must be between 1 and 4.
  ADC_SampleTime | The 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

返回值

  None |

## ◆ ADC_InjectedDiscModeCmd()

void ADC_InjectedDiscModeCmd | ( | FunctionalState | NewState | ) |

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

参数

  NewState | new state of the selected ADC discontinuous mode on injected group channel. This parameter can be: ENABLE or DISABLE.

返回值

  None |

## ◆ ADC_InjectedDMACmd()

void ADC_InjectedDMACmd | ( | FunctionalState | NewState | ) |

Enables or disables the ADC injected group DMA request.

参数

  NewState | new state of the selected ADC injected group DMA transfer. This parameter can be: ENABLE or DISABLE.

返回值

  None |

## ◆ ADC_InjectedSequencerLengthConfig()

void ADC_InjectedSequencerLengthConfig | ( | uint8_t | Length | ) |

Configures the sequencer length for injected channels

参数

  Length | The sequencer length. This parameter must be a number between 1 to 4.

返回值

  None |

## ◆ ADC_ITConfig()

void ADC_ITConfig | ( | uint16_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_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
  NewState | new state of the specified ADC interrupts. This parameter can be: ENABLE or DISABLE.

返回值

  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.

参数

  ADC_Channel | the 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
  Rank | The rank in the regular group sequencer. This parameter must be between 1 to 16.
  ADC_SampleTime | The 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

返回值

  None |

## ◆ ADC_ResetCalibration()

void ADC_ResetCalibration | ( | void |  | ) |

Resets the selected ADC calibration registers.

返回值

  None |

## ◆ ADC_SetInjectedOffset()

void ADC_SetInjectedOffset | ( | uint8_t | ADC_InjectedChannel,
|  | uint16_t | Offset
| ) |  |

Set the injected channels conversion value offset

参数

  ADC_InjectedChannel | the 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
  Offset | the offset value for the selected ADC injected channel This parameter must be a 12bit value.

返回值

  None |

## ◆ ADC_SoftwareStartConvCmd()

void ADC_SoftwareStartConvCmd | ( | FunctionalState | NewState | ) |

Enables or disables the selected ADC software start conversion .

参数

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

返回值

  None |

## ◆ ADC_SoftwareStartInjectedConvCmd()

void ADC_SoftwareStartInjectedConvCmd | ( | FunctionalState | NewState | ) |

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

参数

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

返回值

  None |

## ◆ ADC_StartCalibration()

void ADC_StartCalibration | ( | void |  | ) |

Starts the selected ADC calibration process.

返回值

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

void ADC_TempSensorVrefintCmd | ( | FunctionalState | NewState | ) |

Enables or disables the temperature sensor and Vrefint channel.

参数

  NewState | new state of the temperature sensor. This parameter can be: ENABLE or DISABLE.

返回值

  None |