Mercurial > ~darius > hgwebdir.cgi > stm32temp
comparison libs/STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Examples/IWDG/IWDG_Reset/stm32f10x_it.c @ 0:c59513fd84fb
Initial commit of STM32 test code.
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Mon, 03 Oct 2011 21:19:15 +1030 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c59513fd84fb |
---|---|
1 /** | |
2 ****************************************************************************** | |
3 * @file IWDG/IWDG_Reset/stm32f10x_it.c | |
4 * @author MCD Application Team | |
5 * @version V3.5.0 | |
6 * @date 08-April-2011 | |
7 * @brief Main Interrupt Service Routines. | |
8 * This file provides template for all exceptions handler and peripherals | |
9 * interrupt service routine. | |
10 ****************************************************************************** | |
11 * @attention | |
12 * | |
13 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS | |
14 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE | |
15 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY | |
16 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING | |
17 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE | |
18 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. | |
19 * | |
20 * <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2> | |
21 ****************************************************************************** | |
22 */ | |
23 | |
24 /* Includes ------------------------------------------------------------------*/ | |
25 #include "stm32f10x_it.h" | |
26 #include "stm32_eval.h" | |
27 | |
28 /** @addtogroup STM32F10x_StdPeriph_Examples | |
29 * @{ | |
30 */ | |
31 | |
32 /** @addtogroup IWDG_Reset | |
33 * @{ | |
34 */ | |
35 | |
36 /* Private typedef -----------------------------------------------------------*/ | |
37 /* Private define ------------------------------------------------------------*/ | |
38 /* Private macro -------------------------------------------------------------*/ | |
39 /* Private variables ---------------------------------------------------------*/ | |
40 extern __IO uint32_t TimingDelay; | |
41 __IO uint16_t IC1ReadValue1 = 0, IC1ReadValue2 = 0; | |
42 __IO uint16_t CaptureNumber = 0; | |
43 __IO uint32_t Capture = 0; | |
44 extern uint32_t LsiFreq; | |
45 | |
46 /* Private function prototypes -----------------------------------------------*/ | |
47 /* Private functions ---------------------------------------------------------*/ | |
48 | |
49 /******************************************************************************/ | |
50 /* Cortex-M3 Processor Exceptions Handlers */ | |
51 /******************************************************************************/ | |
52 | |
53 /** | |
54 * @brief This function handles NMI exception. | |
55 * @param None | |
56 * @retval None | |
57 */ | |
58 void NMI_Handler(void) | |
59 { | |
60 } | |
61 | |
62 /** | |
63 * @brief This function handles Hard Fault exception. | |
64 * @param None | |
65 * @retval None | |
66 */ | |
67 void HardFault_Handler(void) | |
68 { | |
69 /* Go to infinite loop when Hard Fault exception occurs */ | |
70 while (1) | |
71 {} | |
72 } | |
73 | |
74 /** | |
75 * @brief This function handles Memory Manage exception. | |
76 * @param None | |
77 * @retval None | |
78 */ | |
79 void MemManage_Handler(void) | |
80 { | |
81 /* Go to infinite loop when Memory Manage exception occurs */ | |
82 while (1) | |
83 {} | |
84 } | |
85 | |
86 /** | |
87 * @brief This function handles Bus Fault exception. | |
88 * @param None | |
89 * @retval None | |
90 */ | |
91 void BusFault_Handler(void) | |
92 { | |
93 /* Go to infinite loop when Bus Fault exception occurs */ | |
94 while (1) | |
95 {} | |
96 } | |
97 | |
98 /** | |
99 * @brief This function handles Usage Fault exception. | |
100 * @param None | |
101 * @retval None | |
102 */ | |
103 void UsageFault_Handler(void) | |
104 { | |
105 /* Go to infinite loop when Usage Fault exception occurs */ | |
106 while (1) | |
107 {} | |
108 } | |
109 | |
110 /** | |
111 * @brief This function handles Debug Monitor exception. | |
112 * @param None | |
113 * @retval None | |
114 */ | |
115 void DebugMon_Handler(void) | |
116 { | |
117 } | |
118 | |
119 /** | |
120 * @brief This function handles SVCall exception. | |
121 * @param None | |
122 * @retval None | |
123 */ | |
124 void SVC_Handler(void) | |
125 { | |
126 } | |
127 | |
128 /** | |
129 * @brief This function handles PendSV_Handler exception. | |
130 * @param None | |
131 * @retval None | |
132 */ | |
133 void PendSV_Handler(void) | |
134 { | |
135 } | |
136 | |
137 /** | |
138 * @brief This function handles SysTick Handler. | |
139 * @param None | |
140 * @retval None | |
141 */ | |
142 void SysTick_Handler(void) | |
143 { | |
144 TimingDelay--; | |
145 } | |
146 | |
147 /******************************************************************************/ | |
148 /* STM32F10x Peripherals Interrupt Handlers */ | |
149 /******************************************************************************/ | |
150 | |
151 /** | |
152 * @brief This function handles External lines 9 to 5 interrupt request. | |
153 * @param None | |
154 * @retval None | |
155 */ | |
156 void EXTI9_5_IRQHandler(void) | |
157 { | |
158 if (EXTI_GetITStatus(KEY_BUTTON_EXTI_LINE) != RESET) | |
159 { | |
160 /* Clear the Key Button EXTI Line Pending Bit */ | |
161 EXTI_ClearITPendingBit(KEY_BUTTON_EXTI_LINE); | |
162 | |
163 /* As the following address is invalid (not mapped), a Hardfault exception | |
164 will be generated with an infinite loop and when the IWDG counter reaches 0 | |
165 the IWDG reset occurs */ | |
166 *(__IO uint32_t *) 0x000000FF = 0xFF; | |
167 } | |
168 } | |
169 | |
170 /** | |
171 * @brief This function handles TIM5 global interrupt request. | |
172 * @param None | |
173 * @retval None | |
174 */ | |
175 void TIM5_IRQHandler(void) | |
176 { | |
177 if (TIM_GetITStatus(TIM5, TIM_IT_CC4) != RESET) | |
178 { | |
179 if(CaptureNumber == 0) | |
180 { | |
181 /* Get the Input Capture value */ | |
182 IC1ReadValue1 = TIM_GetCapture4(TIM5); | |
183 } | |
184 else if(CaptureNumber == 1) | |
185 { | |
186 /* Get the Input Capture value */ | |
187 IC1ReadValue2 = TIM_GetCapture4(TIM5); | |
188 | |
189 /* Capture computation */ | |
190 if (IC1ReadValue2 > IC1ReadValue1) | |
191 { | |
192 Capture = (IC1ReadValue2 - IC1ReadValue1); | |
193 } | |
194 else | |
195 { | |
196 Capture = ((0xFFFF - IC1ReadValue1) + IC1ReadValue2); | |
197 } | |
198 /* Frequency computation */ | |
199 LsiFreq = (uint32_t) SystemCoreClock / Capture; | |
200 LsiFreq *= 8; | |
201 } | |
202 | |
203 CaptureNumber++; | |
204 | |
205 /* Clear TIM5 Capture compare interrupt pending bit */ | |
206 TIM_ClearITPendingBit(TIM5, TIM_IT_CC4); | |
207 } | |
208 } | |
209 | |
210 /******************************************************************************/ | |
211 /* STM32F10x Peripherals Interrupt Handlers */ | |
212 /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */ | |
213 /* available peripheral interrupt handler's name please refer to the startup */ | |
214 /* file (startup_stm32f10x_xx.s). */ | |
215 /******************************************************************************/ | |
216 | |
217 /** | |
218 * @brief This function handles PPP interrupt request. | |
219 * @param None | |
220 * @retval None | |
221 */ | |
222 /*void PPP_IRQHandler(void) | |
223 { | |
224 }*/ | |
225 | |
226 /** | |
227 * @} | |
228 */ | |
229 /** | |
230 * @} | |
231 */ | |
232 | |
233 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ |