STM32F37 Standard Peripheral bibliotheek  1.0
ST Microelectronics bibliotheek documentatie voor de STM32F37 Standard Peripheral Library
 All Data Structures Files Functions Variables Enumerations Enumerator Groups
stm32f37x_sdadc.c File Reference

This file provides firmware functions to manage the following functionalities of the Sigma-Delta Analog to Digital Convertor (SDADC) peripherals: More...

#include "stm32f37x_sdadc.h"
#include "stm32f37x_rcc.h"

Macros

#define CR2_CLEAR_MASK   ((uint32_t)0xFE30FFFF)
 

Functions

void SDADC_DeInit (SDADC_TypeDef *SDADCx)
 Deinitializes SDADCx peripheral registers to their default reset values. More...
 
void SDADC_Init (SDADC_TypeDef *SDADCx, SDADC_InitTypeDef *SDADC_InitStruct)
 Initializes the SDADCx peripheral according to the specified parameters in the SDADC_InitStruct. More...
 
void SDADC_StructInit (SDADC_InitTypeDef *SDADC_InitStruct)
 Fills each SDADC_InitStruct member with its default value. More...
 
void SDADC_AINInit (SDADC_TypeDef *SDADCx, uint32_t SDADC_Conf, SDADC_AINStructTypeDef *SDADC_AINStruct)
 Configures the analog input mode. More...
 
void SDADC_AINStructInit (SDADC_AINStructTypeDef *SDADC_AINStruct)
 Fills each SDADC_AINStruct member with its default value. More...
 
void SDADC_ChannelConfig (SDADC_TypeDef *SDADCx, uint32_t SDADC_Channel, uint32_t SDADC_Conf)
 Configures the SDADCx channel. More...
 
void SDADC_Cmd (SDADC_TypeDef *SDADCx, FunctionalState NewState)
 Enables or disables the specified SDADC peripheral. More...
 
void SDADC_InitModeCmd (SDADC_TypeDef *SDADCx, FunctionalState NewState)
 Enables or disables the initialization mode for specified SDADC peripheral. More...
 
void SDADC_FastConversionCmd (SDADC_TypeDef *SDADCx, FunctionalState NewState)
 Enables or disables the fast conversion mode for the SDADC. More...
 
void SDADC_VREFSelect (uint32_t SDADC_VREF)
 Selects the reference voltage. More...
 
void SDADC_CalibrationSequenceConfig (SDADC_TypeDef *SDADCx, uint32_t SDADC_CalibrationSequence)
 Configures the calibration sequence. More...
 
void SDADC_StartCalibration (SDADC_TypeDef *SDADCx)
 Launches a request to start the calibration sequence. More...
 
void SDADC_ChannelSelect (SDADC_TypeDef *SDADCx, uint32_t SDADC_Channel)
 Selects the SDADC channel to be used for regular conversion. More...
 
void SDADC_ContinuousModeCmd (SDADC_TypeDef *SDADCx, FunctionalState NewState)
 Enables or disables the SDADC continuous conversion mode. When enabled, the regular channel is converted repeatedly after each conversion request. When disabled, the regular channel is converted once for each conversion request. More...
 
void SDADC_SoftwareStartConv (SDADC_TypeDef *SDADCx)
 Enables the selected SDADC software start conversion of the regular channels. More...
 
int16_t SDADC_GetConversionValue (SDADC_TypeDef *SDADCx)
 Returns the last SDADC conversion result data for regular channel. More...
 
void SDADC_RegularSynchroSDADC1 (SDADC_TypeDef *SDADCx, FunctionalState NewState)
 Launches SDADC2/SDADC3 regular conversion synchronously with SDADC1. More...
 
uint32_t SDADC_GetConversionSDADC12Value (void)
 Returns the last conversion result data for regular channel of SDADC1 and SDADC2. RSYNC bit of the SDADC2 should be already set. More...
 
uint32_t SDADC_GetConversionSDADC13Value (void)
 Returns the last conversion result data for regular channel of SDADC1 and SDADC3. RSYNC bit of the SDADC3 should be already set. More...
 
void SDADC_SoftwareStartInjectedConv (SDADC_TypeDef *SDADCx)
 Enables the selected SDADC software start conversion of the injected channels. More...
 
void SDADC_InjectedChannelSelect (SDADC_TypeDef *SDADCx, uint32_t SDADC_Channel)
 Selects the SDADC injected channel(s). More...
 
void SDADC_DelayStartInjectedConvCmd (SDADC_TypeDef *SDADCx, FunctionalState NewState)
 Enables or disables delayed start of injected conversions. More...
 
void SDADC_InjectedContinuousModeCmd (SDADC_TypeDef *SDADCx, FunctionalState NewState)
 Enables or disables the continuous mode for injected channels for the specified SDADC. More...
 
void SDADC_ExternalTrigInjectedConvConfig (SDADC_TypeDef *SDADCx, uint32_t SDADC_ExternalTrigInjecConv)
 Configures the SDADCx external trigger for injected channels conversion. More...
 
void SDADC_ExternalTrigInjectedConvEdgeConfig (SDADC_TypeDef *SDADCx, uint32_t SDADC_ExternalTrigInjecConvEdge)
 Configures the SDADCx external trigger edge for injected channels conversion. More...
 
uint32_t SDADC_GetInjectedChannel (SDADC_TypeDef *SDADCx)
 Returns the injected channel most recently converted for the specified SDADC. More...
 
int16_t SDADC_GetInjectedConversionValue (SDADC_TypeDef *SDADCx, uint32_t *SDADC_Channel)
 Returns the SDADC injected channel conversion result. More...
 
void SDADC_InjectedSynchroSDADC1 (SDADC_TypeDef *SDADCx, FunctionalState NewState)
 Launches injected conversion synchronously with SDADC1. More...
 
uint32_t SDADC_GetInjectedConversionSDADC12Value (void)
 Returns the last conversion result data for injected channel of SDADC1 and SDADC2. JSYNC bit of the SDADC2 should be already set. More...
 
uint32_t SDADC_GetInjectedConversionSDADC13Value (void)
 Returns the last conversion result data for injected channel of SDADC1 and SDADC3. JSYNC bit of the SDADC3 should be already set. More...
 
void SDADC_PowerDownCmd (SDADC_TypeDef *SDADCx, FunctionalState NewState)
 Enables or disables the SDADC power down mode when idle. More...
 
void SDADC_StandbyCmd (SDADC_TypeDef *SDADCx, FunctionalState NewState)
 Enables or disables the SDADC standby mode when idle. More...
 
void SDADC_SlowClockCmd (SDADC_TypeDef *SDADCx, FunctionalState NewState)
 Enables or disables the SDADC in slow clock mode. More...
 
void SDADC_DMAConfig (SDADC_TypeDef *SDADCx, uint32_t SDADC_DMATransfer, FunctionalState NewState)
 Configures the DMA transfer for regular/injected conversions. More...
 
void SDADC_ITConfig (SDADC_TypeDef *SDADCx, uint32_t SDADC_IT, FunctionalState NewState)
 Enables or disables the specified SDADC interrupts. More...
 
FlagStatus SDADC_GetFlagStatus (SDADC_TypeDef *SDADCx, uint32_t SDADC_FLAG)
 Checks whether the specified SDADC flag is set or not. More...
 
void SDADC_ClearFlag (SDADC_TypeDef *SDADCx, uint32_t SDADC_FLAG)
 Clears the SDADCx pending flags. More...
 
ITStatus SDADC_GetITStatus (SDADC_TypeDef *SDADCx, uint32_t SDADC_IT)
 Checks whether the specified SDADC interrupt has occurred or not. More...
 
void SDADC_ClearITPendingBit (SDADC_TypeDef *SDADCx, uint32_t SDADC_IT)
 Clears the SDADCx interrupt pending bits. More...
 

Detailed Description

This file provides firmware functions to manage the following functionalities of the Sigma-Delta Analog to Digital Convertor (SDADC) peripherals:

Author
MCD Application Team
Version
V1.0.0
Date
20-September-2012
  • Initialization and Configuration
  • Regular Channels Configuration
  • Injected channels Configuration
  • Power saving
  • Regular/Injected Channels DMA Configuration
  • Interrupts and flags management
================================================================================
                      ##### How to use this driver #####
================================================================================
    [..]
    (#) Enable the SDADC analog interface by calling
        PWR_SDADCAnalogCmd(PWR_SDADCAnalog_x, Enable);
    (#) Enable the SDADC APB clock to get write access to SDADC registers using
        RCC_APB1PeriphClockCmd() function
        e.g.  To enable access to SDADC1 registers use
        RCC_APB1PeriphClockCmd(RCC_APB1Periph_SDADC1, ENABLE);
    (#) The SDADCs are clocked by APB1.
        In order to get the SDADC running at the typical frequency (6 MHz
        in fast mode), use SDADC prescaler by calling RCC_SDADCCLKConfig() function
        e.g. if APB1 is clocked at 72MHz, to get the SDADC running at 6MHz
        configure the SDADC prescaler at 12 by calling 
        RCC_SDADCCLKConfig(RCC_SDADCCLK_SYSCLK_Div12);
    (#) If required, perform the following configurations:
        (++) Select the reference voltage using SDADC_VREFSelect() function
        (++) Enable the power-down and standby modes using SDADC_PowerDownCmd()
             and SDADC_StandbyCmd() functions respectively
        (++) Enable the slow clock mode (SDADC running at 1.5 MHz) using
             RCC_SDADCCLKConfig() and SDADC_SlowClockCmd() function
             -@@- These configurations are allowed only when the SDADC is disabled.

    (#) Enable the SDADC peripheral using SDADC_Cmd() function.
    (#) Enter initialization mode using SDADC_InitModeCmd() function
        then wait for INITRDY flag to be set to confirm that the SDADC
        is in initialization mode.
    (#) Configure the analog inputs: gain, single ended mode, offset value and
        commmon mode using SDADC_AINInit().
        There are three possible configuration: SDADC_Conf_0, SDADC_Conf_1 and SDADC_Conf_2
    (#) Associate the selected configuration to the channel using SDADC_ChannelConfig()
    (#) For Regular channels group configuration
        (++) use SDADC_Init() function to select the SDADC channel to be used
             for regular conversion, the continuous mode...
             -@@- Only software trigger or synchro with SDADC1 are possible
                  for regular conversion
    (#) For Injected channels group configuration
        (++) Select the SDADC channel to be used for injected conversion 
             using SDADC_InjectedChannelSelect()
        (++) Select the external trigger SDADC_ExternalTrigInjectedConvConfig()
             and the edge (rising, falling or both) using
             SDADC_ExternalTrigInjectedConvEdgeConfig()
             -@@- Software trigger and synchro with SDADC1 are possible
    (#)  Exit initialization mode using SDADC_InitModeCmd() function

  *  
Attention
<h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2>

Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
You may not use this file except in compliance with the License.
You may obtain a copy of the License at:

       http://www.st.com/software_license_agreement_liberty_v2

Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an "AS IS" BASIS, 
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.