/**
  @page SDADC_TempMeasurement SDADC Temperature measurement using PT100
  
  @verbatim
  ******************** (C) COPYRIGHT 2012 STMicroelectronics *******************
  * @file    SDADC/SDADC_TempMeasurement/readme.txt 
  * @author  MCD Application Team
  * @version V1.0.0
  * @date    20-September-2012
  * @brief   SDADC Temperature measurement using PT100 sensor Example Description.
  ******************************************************************************
  *
  * 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.
  *
  ******************************************************************************
  @endverbatim

@par Example Description 

This example aims to show how to use the 16-bit resolution Sigma-Delta
Analog-to-Digital converter to perform accurate temperature measurement using
the PT100 sensor connected to PE7 in the STM32373C-EVAL evaluation board.

 - The SDADC is configured in single ended offset. The input range is from 0V to VREF/(2*gain).
   In this example, the SDADC internal gain is set to 8 so the range is from 0V to VREF/16.
   The external reference VREF (set to 3.3V on STM32373C-EVAL) is used as reference for SDADC
   using JP17 so the measurement ranges between 0V and VREF/16 = 0,20625V.
   The conversion is performed in continuous mode with interrupt enabled on end
   of regular conversion.
   A PT-100 sensor is connected to SDADC1 channel 3P (PE7) through a reference
   resistor 1K8 labeled R33 on STM32373C-EVAL evaluation board.
   The temperature is computed using the formula below:
   Rpt100 = 100 + 0.385 * T ==> T = (Rpt100 - 100) / 0.385
   Vpt100 = Rpt100 * Ipt100 = Rpt100 * VDD_ANA / 2 * Rref ==> Rpt100 = Vpt100 * 1800 * 2 / VDD_ANA 
   ==> T = ((Vpt100 * 1800 * 2 / VDD_ANA) - 100) / 0.385
         =  ((SDADC_Sample * 1800 * 2 / 65535) - 100) / 0.385  
   with:
      - Rpt100 is the resistance of the PT100 sensor
      - Vpt100 is the voltage measured on PT100 sensor
      - Ipt100 is the current crossing the PT100 sensor
      - VDD_ANA is the analog voltage
      - Rref is the reference resistor 1K8 labeled R33 on STM32373C-EVAL
      - SDADC_Sample is the digital value read from SDADC data register
        
 - The temperature measurement is performed in two steps:
   1. Temperature sensor calibration: this phase is performed with JP18
       fitted in 2-3(REF)position. A 100 Ohm resistor is connected to PE7 which is
       connected to VREF through the reference resistor.
       The SDADC converter measures the analog voltage applied on PE7 and then
       computes the correction coefficient.
       The PT100 is not connected in this phase.
   2. The temperature measurement: this phase is performed with JP18
       fitted in 1-2(PT100) position. The PT100 sensor is connected to PE7 which is
       connected to VREF through the reference resistor.
       The SDADC converter measures the analog voltage applied on PE7 and then
       computes the temperature which is given by the following formula:
      TemperaturePT100 = (((((CoeffCorrection * (AvrgRegularConvData/SDADC_GAIN) * REFERENCE_RESISTOR * 2) / SDADCRESOL) - RESISTANCE_ZERODEGRE) / RESISTANCE_COEFFICIENT);
      with:
       - AvrgRegularConvData is the average value of 256 samples
       - SDADC_GAIN is the internal SDADC gain. In this example it is set to 8
       - CoeffCorrection is the correction coefficient computed in phase 1.
       - REFERENCE_RESISTOR is the reference resistor 1K8 labeled R33 on STM32373C-EVAL
       - SDADCRESOL is the sigma delta converter: 2e16-1
       - RESISTANCE_ZERODEGRE is the resistance of PT100 at 0 degree C
       - RESISTANCE_COEFFICIENT is the coefficient of PT100 sensor

 - The measured temperature is displayed on the LCD mounted on STM32373C-EVAL. 


@par Directory contents 

  - SDADC/SDADC_TempMeasurement/stm32f37x_conf.h    Library Configuration file
  - SDADC/SDADC_TempMeasurement/stm32f37x_it.c      Interrupt handlers
  - SDADC/SDADC_TempMeasurement/stm32f37x_it.h      Interrupt handlers header file
  - SDADC/SDADC_TempMeasurement/main.c              Main program
  - SDADC/SDADC_TempMeasurement/main.h              Main header
  - SDADC/SDADC_TempMeasurement/system_stm32f37x.c  STM32F37x system source file
  
@note The "system_stm32f37x.c" is generated by an automatic clock configuration 
      system and can be easily customized to your own configuration. 
      To select different clock setup, use the "STM32F37x_Clock_Configuration_V1.0.0.xls" 
      provided with the AN4132 package available on <a href="http://www.st.com/internet/mcu/family/141.jsp">  ST Microcontrollers </a>
         
@par Hardware and Software environment

  - This example runs on STM32F37x Devices.
  
  - This example has been tested with STMicroelectronics STM32373C-EVAL  rev. B
    (STM32F37x) evaluation board and can be easily tailored to any other supported
    device and development board.

  - STM32373C-EVAL Set-up
    - Make sure that jumper JP16 and JP17 are fitted.
    - Make sure that the jumper JP12 and JP13 are fitted in 3V3 position.
    - Follow example instructions on jumper JP18 position 

@par How to use it ? 

In order to make the program work, you must do the following :
 - Copy all source files from this example folder to the template folder under
   Project\STM32F37x_StdPeriph_Templates
 - Open your preferred toolchain 
 - Rebuild all files and load your image into target memory
 - Run the example

 * <h3><center>&copy; COPYRIGHT STMicroelectronics</center></h3>
 */
