Martin Johnson / STM32F3-Discovery

Dependents:   Space_Invaders_Demo neopixels gpio_test_stm32f3_discovery gpio_test_systimer ... more

Embed: (wiki syntax)

« Back to documentation index

Regular Channels Configuration functions

Regular Channels Configuration functions
[ADC_Private_Functions]

Regular Channels Configuration functions. More...

Functions

void ADC_RegularChannelConfig (ADC_TypeDef *ADCx, 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_RegularChannelSequencerLengthConfig (ADC_TypeDef *ADCx, uint8_t SequencerLength)
 Sets the ADC regular channel sequence lenght.
void ADC_ExternalTriggerConfig (ADC_TypeDef *ADCx, uint16_t ADC_ExternalTrigConvEvent, uint16_t ADC_ExternalTrigEventEdge)
 External Trigger Enable and Polarity Selection for regular channels.
void ADC_StartConversion (ADC_TypeDef *ADCx)
 Enables or disables the selected ADC start conversion .
FlagStatus ADC_GetStartConversionStatus (ADC_TypeDef *ADCx)
 Gets the selected ADC start conversion Status.
void ADC_StopConversion (ADC_TypeDef *ADCx)
 Stops the selected ADC ongoing conversion.
void ADC_DiscModeChannelCountConfig (ADC_TypeDef *ADCx, uint8_t Number)
 Configures the discontinuous mode for the selected ADC regular group channel.
void ADC_DiscModeCmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the discontinuous mode on regular group channel for the specified ADC.
uint16_t ADC_GetConversionValue (ADC_TypeDef *ADCx)
 Returns the last ADCx conversion result data for regular channel.
uint32_t ADC_GetDualModeConversionValue (ADC_TypeDef *ADCx)
 Returns the last ADC1, ADC2, ADC3 and ADC4 regular conversions results data in the selected dual mode.
void ADC_SetChannelOffset1 (ADC_TypeDef *ADCx, uint8_t ADC_Channel, uint16_t Offset)
 Set the ADC channels conversion value offset1.
void ADC_SetChannelOffset2 (ADC_TypeDef *ADCx, uint8_t ADC_Channel, uint16_t Offset)
 Set the ADC channels conversion value offset2.
void ADC_SetChannelOffset3 (ADC_TypeDef *ADCx, uint8_t ADC_Channel, uint16_t Offset)
 Set the ADC channels conversion value offset3.
void ADC_SetChannelOffset4 (ADC_TypeDef *ADCx, uint8_t ADC_Channel, uint16_t Offset)
 Set the ADC channels conversion value offset4.
void ADC_ChannelOffset1Cmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the Offset1.
void ADC_ChannelOffset2Cmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the Offset2.
void ADC_ChannelOffset3Cmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the Offset3.
void ADC_ChannelOffset4Cmd (ADC_TypeDef *ADCx, FunctionalState NewState)
 Enables or disables the Offset4.

Detailed Description

Regular Channels Configuration functions.

 ===============================================================================
                  ##### Channels Configuration functions #####
 ===============================================================================  

  [..] This section provides functions allowing to manage the ADC regular channels.
   
  [..] To configure a regular sequence of channels use:
   (#) ADC_RegularChannelConfig()
       this function allows:
       (++) Configure the rank in the regular group sequencer for each channel
       (++) Configure the sampling time for each channel

   (#) ADC_RegularChannelSequencerLengthConfig() to set the length of the regular sequencer

   [..] The regular trigger is configured using the following functions:
   (#) ADC_SelectExternalTrigger()
   (#) ADC_ExternalTriggerPolarityConfig()

   [..] The start and the stop conversion are controlled by:
   (#) ADC_StartConversion()
   (#) ADC_StopConversion()
    
   [..] 
   (@)Please Note that the following features for regular channels are configured
     using the ADC_Init() function : 
          (++) continuous mode activation
          (++) Resolution  
          (++) Data Alignement 
          (++) Overrun Mode.
     
  [..] Get the conversion data: This subsection provides an important function in 
     the ADC peripheral since it returns the converted data of the current 
     regular channel. When the Conversion value is read, the EOC Flag is 
     automatically cleared.

  [..] To configure the  discontinuous mode, the following functions should be used:
   (#) ADC_DiscModeChannelCountConfig() to configure the number of discontinuous channel to be converted.
   (#) ADC_DiscModeCmd() to enable the discontinuous mode.

  [..] To configure and enable/disable the Channel offset use the functions:
     (++) ADC_SetChannelOffset1()
     (++) ADC_SetChannelOffset2()
     (++) ADC_SetChannelOffset3()
     (++) ADC_SetChannelOffset4()
     (++) ADC_ChannelOffset1Cmd()
     (++) ADC_ChannelOffset2Cmd()
     (++) ADC_ChannelOffset3Cmd()
     (++) ADC_ChannelOffset4Cmd()
  

Function Documentation

void ADC_ChannelOffset1Cmd ( ADC_TypeDef *  ADCx,
FunctionalState  NewState 
)

Enables or disables the Offset1.

Parameters:
ADCx,:where x can be 1, 2, 3 or 4 to select the ADC peripheral.
NewState,:new state of the ADCx offset1. This parameter can be: ENABLE or DISABLE.
Return values:
None

Definition at line 1615 of file stm32f30x_adc.c.

void ADC_ChannelOffset2Cmd ( ADC_TypeDef *  ADCx,
FunctionalState  NewState 
)

Enables or disables the Offset2.

Parameters:
ADCx,:where x can be 1, 2, 3 or 4 to select the ADC peripheral.
NewState,:new state of the ADCx offset2. This parameter can be: ENABLE or DISABLE.
Return values:
None

Definition at line 1640 of file stm32f30x_adc.c.

void ADC_ChannelOffset3Cmd ( ADC_TypeDef *  ADCx,
FunctionalState  NewState 
)

Enables or disables the Offset3.

Parameters:
ADCx,:where x can be 1, 2, 3 or 4 to select the ADC peripheral.
NewState,:new state of the ADCx offset3. This parameter can be: ENABLE or DISABLE.
Return values:
None

Definition at line 1665 of file stm32f30x_adc.c.

void ADC_ChannelOffset4Cmd ( ADC_TypeDef *  ADCx,
FunctionalState  NewState 
)

Enables or disables the Offset4.

Parameters:
ADCx,:where x can be 1, 2, 3 or 4 to select the ADC peripheral.
NewState,:new state of the ADCx offset4. This parameter can be: ENABLE or DISABLE.
Return values:
None

Definition at line 1690 of file stm32f30x_adc.c.

void ADC_DiscModeChannelCountConfig ( ADC_TypeDef *  ADCx,
uint8_t  Number 
)

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

Parameters:
ADCx,:where x can be 1, 2, 3 or 4 to select the ADC peripheral.
Number,:specifies the discontinuous mode regular channel count value. This number must be between 1 and 8.
Return values:
None

Definition at line 1349 of file stm32f30x_adc.c.

void ADC_DiscModeCmd ( ADC_TypeDef *  ADCx,
FunctionalState  NewState 
)

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

Parameters:
ADCx,:where x can be 1, 2, 3 or 4 to select the ADC peripheral.
NewState,:new state of the selected ADC discontinuous mode on regular group channel. This parameter can be: ENABLE or DISABLE.
Return values:
None

Definition at line 1376 of file stm32f30x_adc.c.

void ADC_ExternalTriggerConfig ( ADC_TypeDef *  ADCx,
uint16_t  ADC_ExternalTrigConvEvent,
uint16_t  ADC_ExternalTrigEventEdge 
)

External Trigger Enable and Polarity Selection for regular channels.

Parameters:
ADCx,:where x can be 1, 2, 3 or 4 to select the ADC peripheral.
ADC_ExternalTrigConvEvent,:ADC external Trigger source. This parameter can be one of the following values:

  • ADC_ExternalTrigger_Event0: External trigger event 0
  • ADC_ExternalTrigger_Event1: External trigger event 1
  • ADC_ExternalTrigger_Event2: External trigger event 2
  • ADC_ExternalTrigger_Event3: External trigger event 3
  • ADC_ExternalTrigger_Event4: External trigger event 4
  • ADC_ExternalTrigger_Event5: External trigger event 5
  • ADC_ExternalTrigger_Event6: External trigger event 6
  • ADC_ExternalTrigger_Event7: External trigger event 7
  • ADC_ExternalTrigger_Event8: External trigger event 8
  • ADC_ExternalTrigger_Event9: External trigger event 9
  • ADC_ExternalTrigger_Event10: External trigger event 10
  • ADC_ExternalTrigger_Event11: External trigger event 11
  • ADC_ExternalTrigger_Event12: External trigger event 12
  • ADC_ExternalTrigger_Event13: External trigger event 13
  • ADC_ExternalTrigger_Event14: External trigger event 14
  • ADC_ExternalTrigger_Event15: External trigger event 15
ADC_ExternalTrigEventEdge,:ADC external Trigger Polarity. This parameter can be one of the following values:

  • ADC_ExternalTrigEventEdge_OFF: Hardware trigger detection disabled (conversions can be launched by software)
  • ADC_ExternalTrigEventEdge_RisingEdge: Hardware trigger detection on the rising edge
  • ADC_ExternalTrigEventEdge_FallingEdge: Hardware trigger detection on the falling edge
  • ADC_ExternalTrigEventEdge_BothEdge: Hardware trigger detection on both the rising and falling edges
Return values:
None

Definition at line 1275 of file stm32f30x_adc.c.

uint16_t ADC_GetConversionValue ( ADC_TypeDef *  ADCx )

Returns the last ADCx conversion result data for regular channel.

Parameters:
ADCx,:where x can be 1, 2, 3 or 4 to select the ADC peripheral.
Return values:
TheData conversion value.

Definition at line 1398 of file stm32f30x_adc.c.

uint32_t ADC_GetDualModeConversionValue ( ADC_TypeDef *  ADCx )

Returns the last ADC1, ADC2, ADC3 and ADC4 regular conversions results data in the selected dual mode.

Parameters:
ADCx,:where x can be 1, 2, 3 or 4 to select the ADC peripheral.
Return values:
TheData conversion value.
Note:
In dual mode, the value returned by this function is as following Data[15:0] : these bits contain the regular data of the Master ADC. Data[31:16]: these bits contain the regular data of the Slave ADC.

Definition at line 1415 of file stm32f30x_adc.c.

FlagStatus ADC_GetStartConversionStatus ( ADC_TypeDef *  ADCx )

Gets the selected ADC start conversion Status.

Parameters:
ADCx,:where x can be 1, 2, 3 or 4 to select the ADC peripheral.
Return values:
Thenew state of ADC start conversion (SET or RESET).

Definition at line 1306 of file stm32f30x_adc.c.

void ADC_RegularChannelConfig ( ADC_TypeDef *  ADCx,
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:
ADCx,:where x can be 1, 2, 3 or 4 to select the ADC peripheral.
ADC_Channel,:the ADC channel to configure. This parameter can be one of the following values:

  • 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
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_2Cycles5: Sample time equal to 2.5 cycles
  • ADC_SampleTime_4Cycles5: Sample time equal to 4.5 cycles
  • ADC_SampleTime_7Cycles5: Sample time equal to 7.5 cycles
  • ADC_SampleTime_19Cycles5: Sample time equal to 19.5 cycles
  • ADC_SampleTime_61Cycles5: Sample time equal to 61.5 cycles
  • ADC_SampleTime_181Cycles5: Sample time equal to 181.5 cycles
  • ADC_SampleTime_601Cycles5: Sample time equal to 601.5 cycles
Return values:
None

Definition at line 1128 of file stm32f30x_adc.c.

void ADC_RegularChannelSequencerLengthConfig ( ADC_TypeDef *  ADCx,
uint8_t  SequencerLength 
)

Sets the ADC regular channel sequence lenght.

Parameters:
ADCx,:where x can be 1, 2 or 3 to select the ADC peripheral.
SequenceLength,:The Regular sequence length. This parameter must be between 1 to 16. This parameter can be: ENABLE or DISABLE.
Return values:
None

Definition at line 1235 of file stm32f30x_adc.c.

void ADC_SetChannelOffset1 ( ADC_TypeDef *  ADCx,
uint8_t  ADC_Channel,
uint16_t  Offset 
)

Set the ADC channels conversion value offset1.

Parameters:
ADCx,:where x can be 1, 2, 3 or 4 to select the ADC peripheral.
ADC_Channel,:the ADC channel to configure. This parameter can be one of the following values:

  • 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
Offset,:the offset value for the selected ADC Channel This parameter must be a 12bit value.
Return values:
None

Definition at line 1463 of file stm32f30x_adc.c.

void ADC_SetChannelOffset2 ( ADC_TypeDef *  ADCx,
uint8_t  ADC_Channel,
uint16_t  Offset 
)

Set the ADC channels conversion value offset2.

Parameters:
ADCx,:where x can be 1, 2, 3 or 4 to select the ADC peripheral.
ADC_Channel,:the ADC channel to configure. This parameter can be one of the following values:

  • 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
Offset,:the offset value for the selected ADC Channel This parameter must be a 12bit value.
Return values:
None

Definition at line 1506 of file stm32f30x_adc.c.

void ADC_SetChannelOffset3 ( ADC_TypeDef *  ADCx,
uint8_t  ADC_Channel,
uint16_t  Offset 
)

Set the ADC channels conversion value offset3.

Parameters:
ADCx,:where x can be 1, 2, 3 or 4 to select the ADC peripheral.
ADC_Channel,:the ADC channel to configure. This parameter can be one of the following values:

  • 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
Offset,:the offset value for the selected ADC Channel This parameter must be a 12bit value.
Return values:
None

Definition at line 1549 of file stm32f30x_adc.c.

void ADC_SetChannelOffset4 ( ADC_TypeDef *  ADCx,
uint8_t  ADC_Channel,
uint16_t  Offset 
)

Set the ADC channels conversion value offset4.

Parameters:
ADCx,:where x can be 1, 2, 3 or 4 to select the ADC peripheral.
ADC_Channel,:the ADC channel to configure. This parameter can be one of the following values:

  • 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
Offset,:the offset value for the selected ADC Channel This parameter must be a 12bit value.
Return values:
None

Definition at line 1592 of file stm32f30x_adc.c.

void ADC_StartConversion ( ADC_TypeDef *  ADCx )

Enables or disables the selected ADC start conversion .

Parameters:
ADCx,:where x can be 1, 2, 3 or 4 to select the ADC peripheral.
Return values:
None

Definition at line 1292 of file stm32f30x_adc.c.

void ADC_StopConversion ( ADC_TypeDef *  ADCx )

Stops the selected ADC ongoing conversion.

Parameters:
ADCx,:where x can be 1, 2, 3 or 4 to select the ADC peripheral.
Return values:
None

Definition at line 1331 of file stm32f30x_adc.c.