Mercurial > ~darius > hgwebdir.cgi > stm32temp
comparison libs/STM32F10x_StdPeriph_Lib_V3.5.0/Project/STM32F10x_StdPeriph_Examples/I2C/IOExpander/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 I2C/IOExpander/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 "main.h" | |
27 | |
28 /** @addtogroup STM32F10x_StdPeriph_Examples | |
29 * @{ | |
30 */ | |
31 | |
32 /** @addtogroup I2C_IOExpander | |
33 * @{ | |
34 */ | |
35 | |
36 /* Private typedef -----------------------------------------------------------*/ | |
37 /* Private define ------------------------------------------------------------*/ | |
38 /* Private macro -------------------------------------------------------------*/ | |
39 /* Private variables ---------------------------------------------------------*/ | |
40 /* Private function prototypes -----------------------------------------------*/ | |
41 /* Private functions ---------------------------------------------------------*/ | |
42 | |
43 /******************************************************************************/ | |
44 /* Cortex-M3 Processor Exceptions Handlers */ | |
45 /******************************************************************************/ | |
46 | |
47 /** | |
48 * @brief This function handles NMI exception. | |
49 * @param None | |
50 * @retval None | |
51 */ | |
52 void NMI_Handler(void) | |
53 { | |
54 } | |
55 | |
56 /** | |
57 * @brief This function handles Hard Fault exception. | |
58 * @param None | |
59 * @retval None | |
60 */ | |
61 void HardFault_Handler(void) | |
62 { | |
63 /* Go to infinite loop when Hard Fault exception occurs */ | |
64 while (1) | |
65 { | |
66 } | |
67 } | |
68 | |
69 /** | |
70 * @brief This function handles Memory Manage exception. | |
71 * @param None | |
72 * @retval None | |
73 */ | |
74 void MemManage_Handler(void) | |
75 { | |
76 /* Go to infinite loop when Memory Manage exception occurs */ | |
77 while (1) | |
78 { | |
79 } | |
80 } | |
81 | |
82 /** | |
83 * @brief This function handles Bus Fault exception. | |
84 * @param None | |
85 * @retval None | |
86 */ | |
87 void BusFault_Handler(void) | |
88 { | |
89 /* Go to infinite loop when Bus Fault exception occurs */ | |
90 while (1) | |
91 { | |
92 } | |
93 } | |
94 | |
95 /** | |
96 * @brief This function handles Usage Fault exception. | |
97 * @param None | |
98 * @retval None | |
99 */ | |
100 void UsageFault_Handler(void) | |
101 { | |
102 /* Go to infinite loop when Usage Fault exception occurs */ | |
103 while (1) | |
104 { | |
105 } | |
106 } | |
107 | |
108 /** | |
109 * @brief This function handles SVCall exception. | |
110 * @param None | |
111 * @retval None | |
112 */ | |
113 void SVC_Handler(void) | |
114 { | |
115 } | |
116 | |
117 /** | |
118 * @brief This function handles Debug Monitor exception. | |
119 * @param None | |
120 * @retval None | |
121 */ | |
122 void DebugMon_Handler(void) | |
123 { | |
124 } | |
125 | |
126 /** | |
127 * @brief This function handles PendSVC exception. | |
128 * @param None | |
129 * @retval None | |
130 */ | |
131 void PendSV_Handler(void) | |
132 { | |
133 } | |
134 | |
135 | |
136 /******************************************************************************/ | |
137 /* STM32F10x Peripherals Interrupt Handlers */ | |
138 /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */ | |
139 /* available peripheral interrupt handler's name please refer to the startup */ | |
140 /* file (startup_stm32f10x_xx.s). */ | |
141 /******************************************************************************/ | |
142 | |
143 /** | |
144 * @brief This function handles External lines 15 to 10 interrupt request. | |
145 * @param None | |
146 * @retval None | |
147 */ | |
148 void EXTI15_10_IRQHandler(void) | |
149 { | |
150 /* Checks whether the IOE EXTI line is asserted or not */ | |
151 if(EXTI_GetITStatus(IOE_IT_EXTI_LINE) != RESET) | |
152 { | |
153 | |
154 #ifdef IOE_INTERRUPT_MODE | |
155 /* Check if the interrupt source is the Touch Screen */ | |
156 if (IOE_GetGITStatus(IOE_1_ADDR, IOE_TS_IT) & IOE_TS_IT) | |
157 { | |
158 static TS_STATE* TS_State; | |
159 | |
160 /* Update the structure with the current position */ | |
161 TS_State = IOE_TS_GetState(); | |
162 | |
163 if ((TS_State->TouchDetected) && (TS_State->Y < 220) && (TS_State->Y > 180)) | |
164 { | |
165 if ((TS_State->X > 10) && (TS_State->X < 70)) | |
166 { | |
167 LCD_DisplayStringLine(Line6, " LD4 "); | |
168 STM_EVAL_LEDOn(LED4); | |
169 } | |
170 else if ((TS_State->X > 90) && (TS_State->X < 150)) | |
171 { | |
172 LCD_DisplayStringLine(Line6, " LD3 "); | |
173 STM_EVAL_LEDOn(LED3); | |
174 } | |
175 else if ((TS_State->X > 170) && (TS_State->X < 230)) | |
176 { | |
177 LCD_DisplayStringLine(Line6, " LD2 "); | |
178 STM_EVAL_LEDOn(LED2); | |
179 } | |
180 else if ((TS_State->X > 250) && (TS_State->X < 310)) | |
181 { | |
182 LCD_DisplayStringLine(Line6, " LD1 "); | |
183 STM_EVAL_LEDOn(LED1); | |
184 } | |
185 } | |
186 else | |
187 { | |
188 STM_EVAL_LEDOff(LED1); | |
189 STM_EVAL_LEDOff(LED2); | |
190 STM_EVAL_LEDOff(LED3); | |
191 STM_EVAL_LEDOff(LED4); | |
192 } | |
193 | |
194 /* Clear the interrupt pending bits */ | |
195 IOE_ClearGITPending(IOE_1_ADDR, IOE_TS_IT); | |
196 } | |
197 #ifdef USE_STM3210C_EVAL | |
198 else if (IOE_GetGITStatus(IOE_2_ADDR, IOE_GIT_GPIO)) | |
199 { | |
200 static JOY_State_TypeDef JoyState = JOY_NONE; | |
201 | |
202 /* Get the Joystick State */ | |
203 JoyState = IOE_JoyStickGetState(); | |
204 | |
205 switch (JoyState) | |
206 { | |
207 case JOY_NONE: | |
208 LCD_DisplayStringLine(Line5, "JOY: IT ---- "); | |
209 break; | |
210 case JOY_UP: | |
211 LCD_DisplayStringLine(Line5, "JOY: IT UP "); | |
212 break; | |
213 case JOY_DOWN: | |
214 LCD_DisplayStringLine(Line5, "JOY: IT DOWN "); | |
215 break; | |
216 case JOY_LEFT: | |
217 LCD_DisplayStringLine(Line5, "JOY: IT LEFT "); | |
218 break; | |
219 case JOY_RIGHT: | |
220 LCD_DisplayStringLine(Line5, "JOY: IT RIGHT "); | |
221 break; | |
222 case JOY_CENTER: | |
223 LCD_DisplayStringLine(Line5, "JOY: IT CENTER "); | |
224 break; | |
225 default: | |
226 LCD_DisplayStringLine(Line5, "JOY: IT ERROR "); | |
227 break; | |
228 } | |
229 | |
230 /* Clear the interrupt pending bits */ | |
231 IOE_ClearGITPending(IOE_2_ADDR, IOE_GIT_GPIO); | |
232 IOE_ClearIOITPending(IOE_2_ADDR, IOE_JOY_IT); | |
233 } | |
234 /* CLear all pending interrupt */ | |
235 IOE_ClearGITPending(IOE_2_ADDR, ALL_IT); | |
236 IOE_ClearIOITPending(IOE_2_ADDR, IOE_JOY_IT); | |
237 #endif /* USE_STM3210C_EVAL */ | |
238 | |
239 /* CLear all pending interrupt */ | |
240 IOE_ClearGITPending(IOE_1_ADDR, ALL_IT); | |
241 | |
242 #endif /* IOE_INTERRUPT_MODE */ | |
243 | |
244 EXTI_ClearITPendingBit(IOE_IT_EXTI_LINE); | |
245 } | |
246 } | |
247 | |
248 /** | |
249 * @} | |
250 */ | |
251 | |
252 | |
253 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ |