Channels Configuration functions.
More...
Channels Configuration functions.
===============================================================================
##### Channels Configuration functions #####
===============================================================================
[..] This section provides functions allowing to manage the ADC channels,
it is composed of 3 sub sections :
(#) Configuration and management functions for ADC channels: This subsection
provides functions allowing to configure the ADC channels :
(++) Select the ADC channels
(++) Activate ADC Calibration
(++) Activate the Overrun Mode.
(++) Activate the Discontinuous Mode
(++) Activate the Continuous Mode.
(++) Configure the sampling time for each channel
(++) Select the conversion Trigger and Edge for ADC channels
(++) Select the scan direction.
-@@- Please Note that the following features for ADC channels are configurated
using the ADC_Init() function :
(+@@) Activate the Continuous Mode (can be also activated by ADC_OverrunModeCmd().
(+@@) Select the conversion Trigger and Edge for ADC channels
(+@@) Select the scan direction.
(#) Control the ADC peripheral : This subsection permits to command the ADC:
(++) Stop or discard an on-going conversion (ADSTP command)
(++) Start the ADC conversion .
(#) Get the conversion data: This subsection provides an important function in
the ADC peripheral since it returns the converted data of the current
ADC channel. When the Conversion value is read, the EOC Flag is
automatically cleared.
void ADC_ChannelConfig |
( |
ADC_TypeDef * |
ADCx, |
|
|
uint32_t |
ADC_Channel, |
|
|
uint32_t |
ADC_SampleTime |
|
) |
| |
Configures for the selected ADC and its sampling time.
- Parameters
-
ADCx,: | where x can be 1 to select the ADC peripheral. |
ADC_Channel,: | the ADC channel to configure. This parameter can be any combination 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
- ADC_Channel_18: ADC Channel18 selected
|
ADC_SampleTime,: | The sample time value to be set for the selected channel. This parameter can be one of the following values:
- ADC_SampleTime_1_5Cycles: Sample time equal to 1.5 cycles
- ADC_SampleTime_7_5Cycles: Sample time equal to 7.5 cycles
- ADC_SampleTime_13_5Cycles: Sample time equal to 13.5 cycles
- ADC_SampleTime_28_5Cycles: Sample time equal to 28.5 cycles
- ADC_SampleTime_41_5Cycles: Sample time equal to 41.5 cycles
- ADC_SampleTime_55_5Cycles: Sample time equal to 55.5 cycles
- ADC_SampleTime_71_5Cycles: Sample time equal to 71.5 cycles
- ADC_SampleTime_239_5Cycles: Sample time equal to 239.5 cycles
|
- Return values
-
void ADC_ContinuousModeCmd |
( |
ADC_TypeDef * |
ADCx, |
|
|
FunctionalState |
NewState |
|
) |
| |
Enable the Continuous mode for the selected ADCx channels.
- Parameters
-
ADCx,: | where x can be 1 to select the ADC1 peripheral. |
NewState,: | new state of the Continuous mode. This parameter can be: ENABLE or DISABLE. |
- Note
- It is not possible to have both discontinuous mode and continuous mode enabled. In this case (If DISCEN and CONT are Set), the ADC behaves as if continuous mode was disabled
- Return values
-
void ADC_DiscModeCmd |
( |
ADC_TypeDef * |
ADCx, |
|
|
FunctionalState |
NewState |
|
) |
| |
Enable the discontinuous mode for the selected ADC channels.
- Parameters
-
ADCx,: | where x can be 1 to select the ADC1 peripheral. |
NewState,: | new state of the discontinuous mode. This parameter can be: ENABLE or DISABLE. |
- Note
- It is not possible to have both discontinuous mode and continuous mode enabled. In this case (If DISCEN and CONT are Set), the ADC behaves as if continuous mode was disabled
- Return values
-
uint32_t ADC_GetCalibrationFactor |
( |
ADC_TypeDef * |
ADCx | ) |
|
Active the Calibration operation for the selected ADC.
- Note
- The Calibration can be initiated only when ADC is still in the reset configuration (ADEN must be equal to 0).
- Parameters
-
ADCx,: | where x can be 1 to select the ADC1 peripheral. |
- Return values
-
uint16_t ADC_GetConversionValue |
( |
ADC_TypeDef * |
ADCx | ) |
|
Returns the last ADCx conversion result data for ADC channel.
- Parameters
-
ADCx,: | where x can be 1 to select the ADC1 peripheral. |
- Return values
-
The | Data conversion value. |
void ADC_OverrunModeCmd |
( |
ADC_TypeDef * |
ADCx, |
|
|
FunctionalState |
NewState |
|
) |
| |
Enable the Overrun mode for the selected ADC channels.
- Parameters
-
ADCx,: | where x can be 1 to select the ADC1 peripheral. |
NewState,: | new state of the Overrun mode. This parameter can be: ENABLE or DISABLE. |
- Return values
-
void ADC_StartOfConversion |
( |
ADC_TypeDef * |
ADCx | ) |
|
Start Conversion for the selected ADC channels.
- Note
- In continuous mode, ADSTART is not cleared by hardware with the assertion of EOSEQ because the sequence is automatic relaunched
- Parameters
-
ADCx,: | where x can be 1 to select the ADC1 peripheral. |
- Return values
-
void ADC_StopOfConversion |
( |
ADC_TypeDef * |
ADCx | ) |
|
Stop the on going conversions for the selected ADC.
- Note
- When ADSTP is set, any on going conversion is aborted, and the ADC data register is not updated with current conversion.
- Parameters
-
ADCx,: | where x can be 1 to select the ADC1 peripheral. |
- Return values
-