/**
  @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    19-September-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 STM32F4xx 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 stm32f4xx_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.

@note  On the STM32F4-Discovery board, an extra power consumption (~500uA) is added
       due to the resistor R31 connected to BOOT0 pin and due to resistors (R34 and R32)
       connected to BOOT1 pin. So, to reach the correct power consumption values
       the resistor R31 must be removed and the solder bridge SB19 must be not soldered.


Here below a detailed description of the example code:

  @verbatim

 1. After reset, the program waits for User button connected to the PA.00 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 User 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 (168MHz)
            - Flash 3 wait state
            - Code running from Internal FLASH
            - All peripherals disabled.
            - Wakeup using EXTI Line (User Button PA.00)

    - STOP Mode
    ===========
            - RTC Clocked by 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 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 LSI 
    ==========================================
            - RTC Clocked by LSI
            - IWDG OFF and LSI OFF  if not used as RTC Clock source
            - Backup SRAM OFF
            - Automatic Wakeup using RTC clocked by LSI (after ~20s)

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

   @endverbatim


@par Directory contents 

  - PWR_CurrentConsumption/stm32f4xx_conf.h              Library Configuration file
  - PWR_CurrentConsumption/stm32f4xx_it.c                Interrupt handlers
  - PWR_CurrentConsumption/stm32f4xx_it.h                Interrupt handlers header file
  - PWR_CurrentConsumption/main.c                        Main program
  - PWR_CurrentConsumption/system_stm32f4xx.c            STM32F4xx system source file
  - PWR_CurrentConsumption/stm32f4xx_lp_modes.c          STM32F4xx Low Power Modes source file
  - PWR_CurrentConsumption/stm32f4xx_lp_modes.h          STM32F4xx Low Power Modes header file


@par Hardware and Software environment

  - This example runs on STM32F4xx Devices revision A 
  
  - This example has been tested with STM32F4-Discovery (MB997) RevA and can be
    easily tailored to any other development board

  - STM32F4-Discovery Set-up
    - Use LED4 connected  to PD.12 pin.
    - Use User Button connected to PA.00 pin.
    - Connect an amperemeter to JP1 to measure the IDD current
    - On the STM32F4-Discovery board, an extra power concumption (~500uA) is added
      due to the resistor R31 connected to BOOT0 pin. This resistor must be removed
      to reach correct power consumption values. 

      
@par How to use it ? 

In order to make the program work, you must do the following :

 + EWARM
    - Open the PWR_CurrentConsumption.eww workspace 
    - Rebuild all files: Project->Rebuild all
    - Load project image: Project->Debug
    - Run program: Debug->Go(F5)

 + MDK-ARM
    - Open the PWR_CurrentConsumption.uvproj project
    - Rebuild all files: Project->Rebuild all target files
    - Load project image: Debug->Start/Stop Debug Session
    - Run program: Debug->Run (F5)    

 + TASKING
    - Open TASKING toolchain.
    - Click on File->Import, select General->'Existing Projects into Workspace' 
      and then click "Next". 
    - Browse to  TASKING workspace directory and select the project "PWR_CurrentConsumption"   
    - Rebuild all project files: Select the project in the "Project explorer" 
      window then click on Project->build project menu.
    - Run program: Select the project in the "Project explorer" window then click 
      Run->Debug (F11)

 + TrueSTUDIO
    - Open the TrueSTUDIO toolchain.
    - Click on File->Switch Workspace->Other and browse to TrueSTUDIO workspace 
      directory.
    - Click on File->Import, select General->'Existing Projects into Workspace' 
      and then click "Next". 
    - Browse to the TrueSTUDIO workspace directory and select the project "PWR_CurrentConsumption" 
    - Rebuild all project files: Select the project in the "Project explorer" 
      window then click on Project->build project menu.
    - Run program: Select the project in the "Project explorer" window then click 
      Run->Debug (F11)

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