Mercurial > ~darius > hgwebdir.cgi > stm32temp
comparison libs/STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Examples/TIM/TimeBase/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 TIM/TimeBase/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 | |
27 /** @addtogroup STM32F10x_StdPeriph_Examples | |
28 * @{ | |
29 */ | |
30 | |
31 /** @addtogroup TIM_TimeBase | |
32 * @{ | |
33 */ | |
34 | |
35 /* Private typedef -----------------------------------------------------------*/ | |
36 /* Private define ------------------------------------------------------------*/ | |
37 /* Private macro -------------------------------------------------------------*/ | |
38 /* Private variables ---------------------------------------------------------*/ | |
39 uint16_t capture = 0; | |
40 extern __IO uint16_t CCR1_Val; | |
41 extern __IO uint16_t CCR2_Val; | |
42 extern __IO uint16_t CCR3_Val; | |
43 extern __IO uint16_t CCR4_Val; | |
44 | |
45 /* Private function prototypes -----------------------------------------------*/ | |
46 /* Private functions ---------------------------------------------------------*/ | |
47 | |
48 /******************************************************************************/ | |
49 /* Cortex-M3 Processor Exceptions Handlers */ | |
50 /******************************************************************************/ | |
51 | |
52 /** | |
53 * @brief This function handles NMI exception. | |
54 * @param None | |
55 * @retval None | |
56 */ | |
57 void NMI_Handler(void) | |
58 { | |
59 } | |
60 | |
61 /** | |
62 * @brief This function handles Hard Fault exception. | |
63 * @param None | |
64 * @retval None | |
65 */ | |
66 void HardFault_Handler(void) | |
67 { | |
68 /* Go to infinite loop when Hard Fault exception occurs */ | |
69 while (1) | |
70 {} | |
71 } | |
72 | |
73 /** | |
74 * @brief This function handles Memory Manage exception. | |
75 * @param None | |
76 * @retval None | |
77 */ | |
78 void MemManage_Handler(void) | |
79 { | |
80 /* Go to infinite loop when Memory Manage exception occurs */ | |
81 while (1) | |
82 {} | |
83 } | |
84 | |
85 /** | |
86 * @brief This function handles Bus Fault exception. | |
87 * @param None | |
88 * @retval None | |
89 */ | |
90 void BusFault_Handler(void) | |
91 { | |
92 /* Go to infinite loop when Bus Fault exception occurs */ | |
93 while (1) | |
94 {} | |
95 } | |
96 | |
97 /** | |
98 * @brief This function handles Usage Fault exception. | |
99 * @param None | |
100 * @retval None | |
101 */ | |
102 void UsageFault_Handler(void) | |
103 { | |
104 /* Go to infinite loop when Usage Fault exception occurs */ | |
105 while (1) | |
106 {} | |
107 } | |
108 | |
109 /** | |
110 * @brief This function handles Debug Monitor exception. | |
111 * @param None | |
112 * @retval None | |
113 */ | |
114 void DebugMon_Handler(void) | |
115 {} | |
116 | |
117 /** | |
118 * @brief This function handles SVCall exception. | |
119 * @param None | |
120 * @retval None | |
121 */ | |
122 void SVC_Handler(void) | |
123 {} | |
124 | |
125 /** | |
126 * @brief This function handles PendSV_Handler exception. | |
127 * @param None | |
128 * @retval None | |
129 */ | |
130 void PendSV_Handler(void) | |
131 {} | |
132 | |
133 /** | |
134 * @brief This function handles SysTick Handler. | |
135 * @param None | |
136 * @retval None | |
137 */ | |
138 void SysTick_Handler(void) | |
139 {} | |
140 | |
141 /******************************************************************************/ | |
142 /* STM32F10x Peripherals Interrupt Handlers */ | |
143 /******************************************************************************/ | |
144 | |
145 /** | |
146 * @brief This function handles TIM2 global interrupt request. | |
147 * @param None | |
148 * @retval None | |
149 */ | |
150 void TIM2_IRQHandler(void) | |
151 { | |
152 if (TIM_GetITStatus(TIM2, TIM_IT_CC1) != RESET) | |
153 { | |
154 TIM_ClearITPendingBit(TIM2, TIM_IT_CC1); | |
155 | |
156 /* Pin PC.06 toggling with frequency = 73.24 Hz */ | |
157 GPIO_WriteBit(GPIOC, GPIO_Pin_6, (BitAction)(1 - GPIO_ReadOutputDataBit(GPIOC, GPIO_Pin_6))); | |
158 capture = TIM_GetCapture1(TIM2); | |
159 TIM_SetCompare1(TIM2, capture + CCR1_Val); | |
160 } | |
161 else if (TIM_GetITStatus(TIM2, TIM_IT_CC2) != RESET) | |
162 { | |
163 TIM_ClearITPendingBit(TIM2, TIM_IT_CC2); | |
164 | |
165 /* Pin PC.07 toggling with frequency = 109.8 Hz */ | |
166 GPIO_WriteBit(GPIOC, GPIO_Pin_7, (BitAction)(1 - GPIO_ReadOutputDataBit(GPIOC, GPIO_Pin_7))); | |
167 capture = TIM_GetCapture2(TIM2); | |
168 TIM_SetCompare2(TIM2, capture + CCR2_Val); | |
169 } | |
170 else if (TIM_GetITStatus(TIM2, TIM_IT_CC3) != RESET) | |
171 { | |
172 TIM_ClearITPendingBit(TIM2, TIM_IT_CC3); | |
173 | |
174 /* Pin PC.08 toggling with frequency = 219.7 Hz */ | |
175 GPIO_WriteBit(GPIOC, GPIO_Pin_8, (BitAction)(1 - GPIO_ReadOutputDataBit(GPIOC, GPIO_Pin_8))); | |
176 capture = TIM_GetCapture3(TIM2); | |
177 TIM_SetCompare3(TIM2, capture + CCR3_Val); | |
178 } | |
179 else | |
180 { | |
181 TIM_ClearITPendingBit(TIM2, TIM_IT_CC4); | |
182 | |
183 /* Pin PC.09 toggling with frequency = 439.4 Hz */ | |
184 GPIO_WriteBit(GPIOC, GPIO_Pin_9, (BitAction)(1 - GPIO_ReadOutputDataBit(GPIOC, GPIO_Pin_9))); | |
185 capture = TIM_GetCapture4(TIM2); | |
186 TIM_SetCompare4(TIM2, capture + CCR4_Val); | |
187 } | |
188 } | |
189 | |
190 /******************************************************************************/ | |
191 /* STM32F10x Peripherals Interrupt Handlers */ | |
192 /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */ | |
193 /* available peripheral interrupt handler's name please refer to the startup */ | |
194 /* file (startup_stm32f10x_xx.s). */ | |
195 /******************************************************************************/ | |
196 | |
197 /** | |
198 * @brief This function handles PPP interrupt request. | |
199 * @param None | |
200 * @retval None | |
201 */ | |
202 /*void PPP_IRQHandler(void) | |
203 { | |
204 }*/ | |
205 | |
206 /** | |
207 * @} | |
208 */ | |
209 | |
210 /** | |
211 * @} | |
212 */ | |
213 | |
214 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ |