/**
  @page PWR_CurrentConsumption PWR Current Consumption example
  
  @verbatim
  ******************** (C) COPYRIGHT 2011 STMicroelectronics *******************
  * @file    PWR/CurrentConsumption/readme.txt 
  * @author  MCD Application Team
  * @version V1.0.0
  * @date    18-April-2011
  * @brief   Description of the PWR Current Consumption example.
  ******************************************************************************
  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  ******************************************************************************
   @endverbatim

@par Example Description 

This example shows how to configure the STM32F2xx system to measure different
Low Power modes current consumption. The Low Power modes are:
  - Sleep Mode
  - STOP mode with RTC
  - STANDBY mode without RTC and BKPSRAM
  - STANDBY mode with RTC
  - STANDBY mode with RTC and BKPSRAM
  
To run this example, user has to follow the following steps:
 1. Select the Low power modes to be measured by uncommenting the corresponding
    line inside the stm32f2xx_lp_modes.h file.
    @code
       /*#define SLEEP_MODE*/
       /*#define STOP_MODE*/
       /*#define STANDBY_MODE*/
       #define STANDBY_RTC_MODE
       /*#define STANDBY_RTC_BKPSRAM_MODE*/
    @endcode       

 2. Use an external amperemeter to measure the IDD current. 

 3. This example can not be used in DEBUG mode as the JTAG IOs are disabled to
    reduce power consumption.

Here below a detailed description of the example code:

  @verbatim

 1. After reset, the program waits for Key button connected to the PG.15 to be 
    pressed to enter the selected low power mode.
     - When the RTC is not used in the low power mode configuration, press
       again the Key button to exit the low power mode.
     - When the RTC is used, the wakeup from low power mode is automatically 
       generated by the RTC (after 4s).

 2. Low power modes description:

    - Sleep Mode
    ============  
            - System Running at PLL (120MHz)
            - Flash 3 wait state
            - Prefetch and Cache enabled
            - Code running from Internal FLASH
            - All peripherals disabled.
            - Wakeup using EXTI Line (Key Button PG.15)

    - STOP Mode
    ===========
            - RTC Clocked by LSE or LSI
            - Regulator in LP mode
            - HSI, HSE OFF and LSI if not used as RTC Clock source
            - No IWDG
            - FLASH in deep power down mode
            - Automatic Wakeup using RTC clocked by LSE/LSI (after ~20s)

    - STANDBY Mode
    ==============
            - Backup SRAM and RTC OFF
            - IWDG and LSI OFF
            - Wakeup using WakeUp Pin (PA.00)
                        
    - STANDBY Mode with RTC clocked by LSE/LSI 
    ==========================================
            - RTC Clocked by LSE or LSI
            - IWDG OFF and LSI OFF  if not used as RTC Clock source
            - Backup SRAM OFF
            - Automatic Wakeup using RTC clocked by LSE/LSI (after ~20s)

    - STANDBY Mode with RTC clocked by LSE/LSI and BKPSRAM
    ======================================================
            - RTC Clocked by LSE or LSI
            - Backup SRAM ON
            - IWDG OFF
            - Automatic Wakeup using RTC clocked by LSE/LSI (after ~20s)

   @endverbatim


@par Directory contents 

  - PWR/CurrentConsumption/stm32f2xx_conf.h              Library Configuration file
  - PWR/CurrentConsumption/stm32f2xx_it.c                Interrupt handlers
  - PWR/CurrentConsumption/stm32f2xx_it.h                Interrupt handlers header file
  - PWR/CurrentConsumption/main.c                        Main program
  - PWR/CurrentConsumption/system_stm32f2xx.c            STM32F2xx system source file
  - PWR/CurrentConsumption/stm32f2xx_lp_modes.c          STM32F2xx Low Power Modes source file
  - PWR/CurrentConsumption/stm32f2xx_lp_modes.h          STM32F2xx Low Power Modes header file

@note The "system_stm32f2xx.c" is generated by an automatic clock configuration 
      tool and can be easily customized to your own configuration. 
      To select different clock setup, use the "STM32F2xx_Clock_Configuration_V1.0.0.xls" tool.


@par Hardware and Software environment

  - This example runs on STM32F2xx Devices revision B and revision Y
  
  - This example has been tested with STM322xG-EVAL RevB and can be easily tailored
    to any other development board.

  - STM322xG-EVAL Set-up
    - Use LED1 connected  to PG.06 pin.
    - Use Key Button connected to PG.15 pin.
    - Connect an amperemeter to JP32 to measure the IDD current

      
@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\STM32F2xx_StdPeriph_Template
 - Open your preferred toolchain 
 - Add the file stm32f2xx_lp_modes.c to the project source list
 - Rebuild all files and load your image into target memory
 - Run the example

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