]> git.sur5r.net Git - freertos/blob - Demo/CORTEX_STM32F103_Primer_GCC/ST_Code/stm32f10x_circle_it.c
Add STM32 Primer demo. Remove the .lock file from the Eclipse demos.
[freertos] / Demo / CORTEX_STM32F103_Primer_GCC / ST_Code / stm32f10x_circle_it.c
1 /********************* (C) COPYRIGHT 2007 RAISONANCE S.A.S. *******************/\r
2 /**\r
3 *\r
4 * @file     stm32f10x_circle_it.c\r
5 * @brief    Interrupt handler for the CircleOS project.\r
6 * @author   FL\r
7 * @author   IB\r
8 * @date     07/2007\r
9 *\r
10 **/\r
11 /******************************************************************************/\r
12 \r
13 /* Includes ------------------------------------------------------------------*/\r
14 #include "circle.h"\r
15 \r
16 /* External variables --------------------------------------------------------*/\r
17 extern u16 CCR_Val;\r
18 extern u16 Current_CCR_BackLightStart;\r
19 \r
20 /*******************************************************************************\r
21 *\r
22 *                                NMIException\r
23 *\r
24 *******************************************************************************/\r
25 /**\r
26 *\r
27 *  Handles the NMI exception.\r
28 *\r
29 **/\r
30 /******************************************************************************/\r
31 void NMIException( void ) {}\r
32 \r
33 /*******************************************************************************\r
34 *\r
35 *                                HardFaultException\r
36 *\r
37 *******************************************************************************/\r
38 /**\r
39 *\r
40 *  Handles the Hard Fault exception.\r
41 *\r
42 **/\r
43 /******************************************************************************/\r
44 void HardFaultException( void ) \r
45    {\r
46    #ifdef TIMING_ANALYSIS     //to debug with a scope\r
47    GPIO_WriteBit( GPIOA, GPIO_Pin_5, Bit_RESET );  \r
48    GPIO_WriteBit( GPIOA, GPIO_Pin_5, Bit_SET );    \r
49    #endif\r
50    }\r
51 \r
52 /*******************************************************************************\r
53 *\r
54 *                                MemManageException\r
55 *\r
56 *******************************************************************************/\r
57 /**\r
58 *\r
59 *  Handles the Memory Manage exception.\r
60 *\r
61 **/\r
62 /******************************************************************************/\r
63 void MemManageException( void ) {}\r
64 \r
65 /*******************************************************************************\r
66 *\r
67 *                                BusFaultException\r
68 *\r
69 *******************************************************************************/\r
70 /**\r
71 *\r
72 *  Handles the Bus Fault exception.\r
73 *\r
74 **/\r
75 /******************************************************************************/\r
76 void BusFaultException( void ) {}\r
77 \r
78 /*******************************************************************************\r
79 *\r
80 *                                UsageFaultException\r
81 *\r
82 *******************************************************************************/\r
83 /**\r
84 *\r
85 *  Handles the Usage Fault exception.\r
86 *\r
87 **/\r
88 /******************************************************************************/\r
89 void UsageFaultException( void ) {}\r
90 \r
91 /*******************************************************************************\r
92 *\r
93 *                                DebugMonitor\r
94 *\r
95 *******************************************************************************/\r
96 /**\r
97 *\r
98 *  Handles the  Debug Monitor exception.\r
99 *\r
100 **/\r
101 /******************************************************************************/\r
102 void DebugMonitor( void ) {}\r
103 \r
104 /*******************************************************************************\r
105 *\r
106 *                                SVCHandler\r
107 *\r
108 *******************************************************************************/\r
109 /**\r
110 *\r
111 *  Handles the SVCall exception.\r
112 *\r
113 **/\r
114 /******************************************************************************/\r
115 void SVCHandler( void ) {}\r
116 \r
117 /*******************************************************************************\r
118 *\r
119 *                                PendSVC\r
120 *\r
121 *******************************************************************************/\r
122 /**\r
123 *\r
124 *  Handles the PendSVC exception.\r
125 *\r
126 **/\r
127 /******************************************************************************/\r
128 void PendSVC( void ) {}\r
129 \r
130 /*******************************************************************************\r
131 *\r
132 *                                DummyHandler\r
133 *\r
134 *******************************************************************************/\r
135 /**\r
136 *\r
137 *  Default handling for the IRQ-Exception\r
138 *\r
139 **/\r
140 /******************************************************************************/\r
141 void DummyHandler ( void ) {}\r
142 \r
143 /*******************************************************************************\r
144 *\r
145 *                                TIM2_IRQHandler\r
146 *\r
147 *******************************************************************************/\r
148 /**\r
149 *\r
150 *  Handles the TIM2 global interrupt request.\r
151 *\r
152 **/\r
153 /******************************************************************************/\r
154 void TIM2_IRQHandler( void )\r
155    {\r
156    #ifdef TIMING_ANALYSIS     //to debug with a scope\r
157    GPIO_WriteBit( GPIOA, GPIO_Pin_7, Bit_RESET );\r
158    #endif\r
159 \r
160    /* Clear TIM2 update interrupt */\r
161    TIM_ClearITPendingBit( TIM2, TIM_IT_Update );\r
162 \r
163    MEMS_Handler();\r
164 \r
165    #ifdef TIMING_ANALYSIS     //to debug with a scope\r
166    GPIO_WriteBit( GPIOA, GPIO_Pin_7, Bit_SET );\r
167    #endif\r
168    }\r
169 \r
170 /*******************************************************************************\r
171 *\r
172 *                                TIM3_IRQHandler\r
173 *\r
174 *******************************************************************************/\r
175 /**\r
176 *\r
177 *  Handles the TIM3 global interrupt request.\r
178 *\r
179 **/\r
180 /******************************************************************************/\r
181 void TIM3_IRQHandler( void )\r
182 {\r
183    u16 capture = 0;\r
184 \r
185    if( TIM_GetITStatus( TIM3, TIM_IT_CC3 ) != RESET )\r
186       {\r
187       capture = TIM_GetCapture3( TIM3 );\r
188 \r
189       TIM_SetCompare3( TIM3, capture + CCR_Val + 1 );\r
190       TIM_ClearITPendingBit( TIM3, TIM_IT_CC3 );\r
191    }\r
192 }\r
193 \r
194 /*******************************************************************************\r
195 *\r
196 *                                TIM4_IRQHandler\r
197 *\r
198 *******************************************************************************/\r
199 /**\r
200 *\r
201 *  Handles the TIM4 global interrupt request.\r
202 *\r
203 **/\r
204 /******************************************************************************/\r
205 void TIM4_IRQHandler( void )\r
206 {\r
207    u16 BackLight_capture = 0;\r
208 \r
209    if( TIM_GetITStatus( TIM4, TIM_IT_CC2 ) != RESET )\r
210       {\r
211       BackLight_capture = TIM_GetCapture2( TIM4 );\r
212 \r
213       TIM_SetCompare2( TIM4, BackLight_capture + Current_CCR_BackLightStart + 1 );\r
214       TIM_ClearITPendingBit( TIM4, TIM_IT_CC2 );\r
215   }\r
216 }\r
217 \r