STM32F0xx Standard Peripherals Firmware Library
|
STM32F0xx_StdPeriph_Examples/IWDG/IWDG_Reset/stm32f0xx_it.c
Go to the documentation of this file.
00001 /** 00002 ****************************************************************************** 00003 * @file IWDG/IWDG_Reset/stm32f0xx_it.c 00004 * @author MCD Application Team 00005 * @version V1.4.0 00006 * @date 24-July-2014 00007 * @brief Main Interrupt Service Routines. 00008 * This file provides template for all exceptions handler and 00009 * peripherals interrupt service routine. 00010 ****************************************************************************** 00011 * @attention 00012 * 00013 * <h2><center>© COPYRIGHT 2014 STMicroelectronics</center></h2> 00014 * 00015 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 00016 * You may not use this file except in compliance with the License. 00017 * You may obtain a copy of the License at: 00018 * 00019 * http://www.st.com/software_license_agreement_liberty_v2 00020 * 00021 * Unless required by applicable law or agreed to in writing, software 00022 * distributed under the License is distributed on an "AS IS" BASIS, 00023 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00024 * See the License for the specific language governing permissions and 00025 * limitations under the License. 00026 * 00027 ****************************************************************************** 00028 */ 00029 00030 /* Includes ------------------------------------------------------------------*/ 00031 #include "stm32f0xx_it.h" 00032 00033 /** @addtogroup STM32F0xx_StdPeriph_Examples 00034 * @{ 00035 */ 00036 00037 /* Private typedef -----------------------------------------------------------*/ 00038 /* Private define ------------------------------------------------------------*/ 00039 /* Private macro -------------------------------------------------------------*/ 00040 /* Private variables ---------------------------------------------------------*/ 00041 extern __IO uint32_t TimingDelay; 00042 __IO uint16_t IC1ReadValue1 = 0, IC1ReadValue2 = 0; 00043 __IO uint16_t CaptureNumber = 0; 00044 __IO uint32_t Capture = 0; 00045 extern uint32_t LsiFreq; 00046 /* Private function prototypes -----------------------------------------------*/ 00047 /* Private functions ---------------------------------------------------------*/ 00048 00049 /******************************************************************************/ 00050 /* Cortex-M0 Processor Exceptions Handlers */ 00051 /******************************************************************************/ 00052 00053 /** 00054 * @brief This function handles NMI exception. 00055 * @param None 00056 * @retval None 00057 */ 00058 void NMI_Handler(void) 00059 { 00060 } 00061 00062 /** 00063 * @brief This function handles Hard Fault exception. 00064 * @param None 00065 * @retval None 00066 */ 00067 void HardFault_Handler(void) 00068 { 00069 /* Go to infinite loop when Hard Fault exception occurs */ 00070 while (1) 00071 { 00072 } 00073 } 00074 00075 /** 00076 * @brief This function handles SVCall exception. 00077 * @param None 00078 * @retval None 00079 */ 00080 void SVC_Handler(void) 00081 { 00082 } 00083 00084 /** 00085 * @brief This function handles PendSVC exception. 00086 * @param None 00087 * @retval None 00088 */ 00089 void PendSV_Handler(void) 00090 { 00091 } 00092 00093 /** 00094 * @brief This function handles SysTick Handler. 00095 * @param None 00096 * @retval None 00097 */ 00098 void SysTick_Handler(void) 00099 { 00100 TimingDelay_Decrement(); 00101 } 00102 00103 /******************************************************************************/ 00104 /* STM32F0xx Peripherals Interrupt Handlers */ 00105 /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */ 00106 /* available peripheral interrupt handler's name please refer to the startup */ 00107 /* file (startup_stm32f0xx.s). */ 00108 /******************************************************************************/ 00109 /** 00110 * @brief This function handles External line 4 to 15 interrupt request. 00111 * @param None 00112 * @retval None 00113 */ 00114 void EXTI4_15_IRQHandler(void) 00115 { 00116 if (EXTI_GetITStatus(TAMPER_BUTTON_EXTI_LINE) != RESET) 00117 { 00118 /* Clear the TAMPER Button EXTI Line Pending Bit */ 00119 EXTI_ClearITPendingBit(TAMPER_BUTTON_EXTI_LINE); 00120 00121 /* As the following address is invalid (not mapped), a Hardfault exception 00122 will be generated with an infinite loop and when the IWDG counter reaches 0 00123 the IWDG reset occurs */ 00124 *(__IO uint32_t *) 0x00040001 = 0xFF; 00125 } 00126 } 00127 00128 #ifdef LSI_TIM_MEASURE 00129 /** 00130 * @brief This function handles TIM14 global interrupt request. 00131 * @param None 00132 * @retval None 00133 */ 00134 void TIM14_IRQHandler(void) 00135 { 00136 if (TIM_GetITStatus(TIM14, TIM_IT_CC1) != RESET) 00137 { 00138 if(CaptureNumber == 0) 00139 { 00140 /* Get the Input Capture value */ 00141 IC1ReadValue1 = TIM_GetCapture1(TIM14); 00142 } 00143 else if(CaptureNumber == 1) 00144 { 00145 /* Get the Input Capture value */ 00146 IC1ReadValue2 = TIM_GetCapture1(TIM14); 00147 00148 /* Capture computation */ 00149 if (IC1ReadValue2 > IC1ReadValue1) 00150 { 00151 Capture = (IC1ReadValue2 - IC1ReadValue1); 00152 } 00153 else 00154 { 00155 Capture = ((0xFFFF - IC1ReadValue1) + IC1ReadValue2); 00156 } 00157 /* Frequency computation */ 00158 LsiFreq = (uint32_t) SystemCoreClock / Capture; 00159 LsiFreq *= 8; 00160 } 00161 00162 CaptureNumber++; 00163 00164 /* Clear TIM14 Capture compare interrupt pending bit */ 00165 TIM_ClearITPendingBit(TIM14, TIM_IT_CC1); 00166 } 00167 } 00168 #endif /* LSI_TIM_MEASURE */ 00169 /** 00170 * @brief This function handles PPP interrupt request. 00171 * @param None 00172 * @retval None 00173 */ 00174 /*void PPP_IRQHandler(void) 00175 { 00176 }*/ 00177 00178 /** 00179 * @} 00180 */ 00181 00182 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/