Initialization and Configuration functions.
More...
Initialization and Configuration functions.
===============================================================================
##### Initialization and Configuration functions #####
===============================================================================
[..] This section provides functions allowing to:
(+) Configure the SDADC analog inputs (gain, offset, single ended...)
(+) Select the SDADC regular conversion channels
(+) Enter/Exit the SDADC initialization mode
(+) SDADC fast conversion conversion mode configuration
(+) Select the reference voltage
(+) Enable/disable the SDADC peripheral
(+) Configure and start the SDADC calibration
Configures the analog input mode.
- Note
- This function can be used only if the SDADC is disabled or the INITRDY flag is set. Otherwise the configuration can't be modified.
- Parameters
-
SDADCx,: | where x can be 1, 2 or 3 to select the SDADC peripheral. |
SDADC_AINStruct,: | pointer to an SDADC_AINStructTypeDef structure that contains the analog inputs configuration information for the specified SDADC peripheral. |
- Return values
-
Fills each SDADC_AINStruct member with its default value.
- Parameters
-
- Return values
-
void SDADC_CalibrationSequenceConfig |
( |
SDADC_TypeDef * |
SDADCx, |
|
|
uint32_t |
SDADC_CalibrationSequence |
|
) |
| |
Configures the calibration sequence.
- Note
- After calling SDADC_CalibrationSequenceConfig(), use SDADC_StartCalibration() to start the calibration process.
- Parameters
-
SDADCx,: | where x can be 1, 2 or 3 to select the SDADC peripheral. |
SDADC_CalibrationSequence,: | Number of calibration sequence to be performed. This parameter can be one of the following values:
- SDADC_CalibrationSequence_1: One calibration sequence will be performed to calculate OFFSET0[11:0] (offset that corresponds to conf0)
- SDADC_CalibrationSequence_2: Two calibration sequences will be performed to calculate OFFSET0[11:0] and OFFSET1[11:0] (offsets that correspond to conf0 and conf1)
- SDADC_CalibrationSequence_3: Three calibration sequences will be performed to calculate OFFSET0[11:0], OFFSET1[11:0], and OFFSET2[11:0] (offsets that correspond to conf0, conf1 and conf2)
|
- Return values
-
void SDADC_ChannelConfig |
( |
SDADC_TypeDef * |
SDADCx, |
|
|
uint32_t |
SDADC_Channel, |
|
|
uint32_t |
SDADC_Conf |
|
) |
| |
Configures the SDADCx channel.
- Note
- SDADC channel configuration can be modified only if the SDADC is disabled or the INITRDY flag is set. Otherwise the configuration can't be modified.
- Parameters
-
SDADCx,: | where x can be 1, 2 or 3 to select the SDADC peripheral. |
SDADC_Channel,: | The SDADC injected channel. This parameter can be one of the following values:
- SDADC_Channel_0: SDADC Channel 0 selected
- SDADC_Channel_1: SDADC Channel 1 selected
- SDADC_Channel_2: SDADC Channel 2 selected
- SDADC_Channel_3: SDADC Channel 3 selected
- SDADC_Channel_4: SDADC Channel 4 selected
- SDADC_Channel_5: SDADC Channel 5 selected
- SDADC_Channel_6: SDADC Channel 6 selected
- SDADC_Channel_7: SDADC Channel 7 selected
- SDADC_Channel_8: SDADC Channel 8 selected
|
SDADC_Conf,: | The SDADC input configuration. This parameter can be one of the following values:
- SDADC_Conf_0: SDADC Conf 0 selected
- SDADC_Conf_1: SDADC Conf 1 selected
- SDADC_Conf_2: SDADC Conf 2 selected
|
- Note
- The SDADC configuration (Conf 0, Conf 1, Conf 2) should be performed using SDADC_AINInit()
- Return values
-
void SDADC_Cmd |
( |
SDADC_TypeDef * |
SDADCx, |
|
|
FunctionalState |
NewState |
|
) |
| |
Enables or disables the specified SDADC peripheral.
- Note
- When disabled, power down mode is entered, the flags and the data are cleared.
- Parameters
-
SDADCx,: | where x can be 1, 2 or 3 to select the SDADC peripheral. |
NewState,: | new state of the SDADCx peripheral. This parameter can be: ENABLE or DISABLE. |
- Return values
-
void SDADC_DeInit |
( |
SDADC_TypeDef * |
SDADCx | ) |
|
Deinitializes SDADCx peripheral registers to their default reset values.
- Parameters
-
SDADCx,: | where x can be 1, 2 or 3 to select the SDADC peripheral. |
- Return values
-
void SDADC_FastConversionCmd |
( |
SDADC_TypeDef * |
SDADCx, |
|
|
FunctionalState |
NewState |
|
) |
| |
Enables or disables the fast conversion mode for the SDADC.
- Note
- When converting a single channel in continuous mode, having enabled fast mode causes each conversion (except for the first) to execute 3 times faster (taking 120 SDADC cycles rather than 360). Fast conversion mode has no meaning for conversions which are not continuous.
-
fast conversion mode can be modified only if the SDADC is disabled or the INITRDY flag is set. Otherwise the configuration can't be modified.
- Parameters
-
SDADCx,: | where x can be 1, 2 or 3 to select the SDADC peripheral. |
NewState,: | new state of the selected SDADC fast conversion mode This parameter can be: ENABLE or DISABLE. |
- Return values
-
Initializes the SDADCx peripheral according to the specified parameters in the SDADC_InitStruct.
- Note
- SDADC_FastConversionMode can be modified only if the SDADC is disabled or the INITRDY flag is set. Otherwise the configuration can't be modified.
-
Channel selection and continuous mode configuration affect only the regular channel.
-
Fast conversion mode is regardless of regular/injected conversion mode.
- Parameters
-
SDADCx,: | where x can be 1, 2 or 3 to select the SDADC peripheral. |
SDADC_InitStruct,: | pointer to an SDADC_InitTypeDef structure that contains the configuration information for the specified SDADC peripheral. |
- Return values
-
void SDADC_InitModeCmd |
( |
SDADC_TypeDef * |
SDADCx, |
|
|
FunctionalState |
NewState |
|
) |
| |
Enables or disables the initialization mode for specified SDADC peripheral.
- Note
- Initialization mode should be enabled before setting the analog input configuration, the fast conversion mode, the external trigger...
- Parameters
-
SDADCx,: | where x can be 1, 2 or 3 to select the SDADC peripheral. |
NewState,: | new state of the SDADCx peripheral. This parameter can be: ENABLE or DISABLE. When enabled, the SDADCx is in initialization mode and the SDADCx can be configured (except: power down mode, standby mode, slow clock and VREF selection). When disabled, the SDADCx isn't in initialization mode and limited configurations are allowed (regular channel selection, software trigger) |
- Return values
-
void SDADC_StartCalibration |
( |
SDADC_TypeDef * |
SDADCx | ) |
|
Launches a request to start the calibration sequence.
- Note
- use SDADC_CalibrationSequenceConfig() function to configure the calibration sequence then call SDADC_StartCalibration() to start the calibration process.
- Parameters
-
SDADCx,: | where x can be 1, 2 or 3 to select the SDADC peripheral. |
- Return values
-
Fills each SDADC_InitStruct member with its default value.
- Parameters
-
SDADC_InitStruct,: | pointer to an SDADC_InitTypeDef structure which will be initialized. |
- Return values
-
void SDADC_VREFSelect |
( |
uint32_t |
SDADC_VREF | ) |
|
Selects the reference voltage.
- Note
- The reference voltage is common to the all SDADCs (SDADC1, SDADC2 and SDADC3). The reference voltage selection is available only in SDADC1 and therefore to select the VREF for SDADC2/SDADC3, SDADC1 clock must be already enabled.
-
The reference voltage selection can be performed only when the SDADC is disabled.
- Parameters
-
SDADC_VREF,: | Reference voltage selection. This parameter can be one of the following values:
- SDADC_VREF_Ext: The reference voltage is forced externally using VREF pin
- SDADC_VREF_VREFINT1: The reference voltage is forced internally to 1.22V VREFINT
- SDADC_VREF_VREFINT2: The reference voltage is forced internally to 1.8V VREFINT
- SDADC_VREF_VDDA: The reference voltage is forced internally to VDDA
|
- Return values
-