/**
  @page NVIC_IRQ_Mask NVIC IRQ Channels Mask example
  
  @verbatim
  ******************** (C) COPYRIGHT 2012 STMicroelectronics *******************
  * @file    NVIC/IRQ_Mask/readme.txt 
  * @author  MCD Application Team
  * @version V1.1.0
  * @date    13-April-2012
  * @brief   Description of the NVIC IRQ Channels Mask example.
  ******************************************************************************
  *
  * 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 demontrates the use of the Nested Vectored Interrupt Controller (NVIC)
IRQ Channels configuration and how to mask/activate different IRQs: 

- Configuration of 3 TIM (TIM2..TIM4) timers to generate an interrupt on each 
  counter update event.

- The three timers are linked to their correspondant Update IRQ channel.

- Assignment of a ascendant IRQ priority for each IRQ channel :
     - TIM2 has a preemption priority of 0
     - TIM3 has a preemption priority of 1
     - TIM4 has a preemption priority of 2
- In each interrupt routine: 
   - TIM2 toggles a LED1 each 1s 
   - TIM3 toggles a LED2 each 2s 
   - TIM4 toggles a LED3 each 3s 

- The KEY and SEL buttons are used to boost the execution priority as follows:

  - The KEY button is used in GPIO mode and at each KEY button press, the execution 
    priority is raised to 0 and turn LED4 ON. This prevents all exceptions with 
    configurable priority from activating, other than through the HardFault fault 
    escalation mechanism. As consequence, all LEDs stop toggling as TIM2, TIM3 
    and TIM4 IRQs are prevented from activation. 
    
    Pressing again the KEY button will release the priority boosting, turn LED4 
    OFF and will allow all exceptions with configurable priority to be activated 
    and TIM2, TIM3 and TIM4 can be generated again and the LEDs restart toggling.
    
    This execution priority is made using the CMSIS functions "__disable_irq()" 
    and "__enable_irq()". 
    These two functions are managing the Cortex-M3 PRIMASK special register.

  - The TAMPER button is used in EXTI mode and at each TAMPER button press, the
    execution priority is masked to 0x40 using the BASEPRI register. 
    A non-zero value will act as a priority mask, affecting the execution priority 
    when the priority defined by BASEPRI is the same or higher than the current 
    executing priority. 
    As consequence, LED2 and LED3 stop toggling as TIM3 and TIM4 IRQs are 
    prevented from activation. 
    Pressing again the TAMPER button will configure the BASEPRI register to 0, 
    thus it has no effect on the current priority and TIM3 and TIM4 can be 
    generated again and LED2 and LED3 restart toggling.
    
    This execution priority is made using the CMSIS functions "__set_BASEPRI()". 
    This function is managing the Cortex-M3 BASEPRI special register.
    Setting the BASEPRI register has no effect when the execution priority is
    raised to 0 using the "__disable_irq()" function.

@note These mechanisms only affect the group priority. They have no effect on 
      the sub-priority. The sub-priority is only used to sort pending exception 
      priorities, and does not affect active exceptions.

   
@par Directory contents 

  - NVIC/IRQ_Mask/stm32f2xx_conf.h    Library Configuration file
  - NVIC/IRQ_Mask/stm32f2xx_it.c       Interrupt handlers
  - NVIC/IRQ_Mask/stm32f2xx_it.h      Interrupt handlers header file
  - NVIC/IRQ_Mask/main.c              Main program
  - NVIC/IRQ_Mask/system_stm32f2xx.c  STM32F2xx system source 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" 
      provided with the AN3362 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 STM32F2xx Devices.
  
  - 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, LED2, LED3 and LED4 connected respectively to PG.06, PG.08, PI.09
      and PC.07 pins
    - Use the KEY push-button connected to pin PG15 (EXTI Line15)
    - Use the TAMPER push-button connected to pin PC13 (EXTI Line13)

      
@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 
 - Rebuild all files and load your image into target memory
 - Run the example

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


