STM32F10x_StdPeriph_Examples/I2C/IOExpander/stm32f10x_it.c

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    I2C/IOExpander/stm32f10x_it.c 
00004   * @author  MCD Application Team
00005   * @version V3.4.0
00006   * @date    10/15/2010
00007   * @brief   Main Interrupt Service Routines.
00008   *          This file provides template for all exceptions handler and peripherals
00009   *          interrupt service routine.
00010   ******************************************************************************
00011   * @copy
00012   *
00013   * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
00014   * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
00015   * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
00016   * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
00017   * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
00018   * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
00019   *
00020   * <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>
00021   */ 
00022 
00023 /* Includes ------------------------------------------------------------------*/
00024 #include "stm32f10x_it.h"
00025 #include "main.h"
00026 
00027 /** @addtogroup STM32F10x_StdPeriph_Examples
00028   * @{
00029   */
00030   
00031 /** @addtogroup I2C_IOExpander
00032   * @{
00033   */
00034 
00035 /* Private typedef -----------------------------------------------------------*/
00036 /* Private define ------------------------------------------------------------*/
00037 /* Private macro -------------------------------------------------------------*/
00038 /* Private variables ---------------------------------------------------------*/
00039 /* Private function prototypes -----------------------------------------------*/
00040 /* Private functions ---------------------------------------------------------*/
00041 
00042 /******************************************************************************/
00043 /*            Cortex-M3 Processor Exceptions Handlers                         */
00044 /******************************************************************************/
00045 
00046 /**
00047   * @brief  This function handles NMI exception.
00048   * @param  None
00049   * @retval None
00050   */
00051 void NMI_Handler(void)
00052 {
00053 }
00054 
00055 /**
00056   * @brief  This function handles Hard Fault exception.
00057   * @param  None
00058   * @retval None
00059   */
00060 void HardFault_Handler(void)
00061 {
00062   /* Go to infinite loop when Hard Fault exception occurs */
00063   while (1)
00064   {
00065   }
00066 }
00067 
00068 /**
00069   * @brief  This function handles Memory Manage exception.
00070   * @param  None
00071   * @retval None
00072   */
00073 void MemManage_Handler(void)
00074 {
00075   /* Go to infinite loop when Memory Manage exception occurs */
00076   while (1)
00077   {
00078   }
00079 }
00080 
00081 /**
00082   * @brief  This function handles Bus Fault exception.
00083   * @param  None
00084   * @retval None
00085   */
00086 void BusFault_Handler(void)
00087 {
00088   /* Go to infinite loop when Bus Fault exception occurs */
00089   while (1)
00090   {
00091   }
00092 }
00093 
00094 /**
00095   * @brief  This function handles Usage Fault exception.
00096   * @param  None
00097   * @retval None
00098   */
00099 void UsageFault_Handler(void)
00100 {
00101   /* Go to infinite loop when Usage Fault exception occurs */
00102   while (1)
00103   {
00104   }
00105 }
00106 
00107 /**
00108   * @brief  This function handles SVCall exception.
00109   * @param  None
00110   * @retval None
00111   */
00112 void SVC_Handler(void)
00113 {
00114 }
00115 
00116 /**
00117   * @brief  This function handles Debug Monitor exception.
00118   * @param  None
00119   * @retval None
00120   */
00121 void DebugMon_Handler(void)
00122 {
00123 }
00124 
00125 /**
00126   * @brief  This function handles PendSVC exception.
00127   * @param  None
00128   * @retval None
00129   */
00130 void PendSV_Handler(void)
00131 {
00132 }
00133 
00134 
00135 /******************************************************************************/
00136 /*                 STM32F10x Peripherals Interrupt Handlers                   */
00137 /*  Add here the Interrupt Handler for the used peripheral(s) (PPP), for the  */
00138 /*  available peripheral interrupt handler's name please refer to the startup */
00139 /*  file (startup_stm32f10x_xx.s).                                            */
00140 /******************************************************************************/
00141 
00142 /**
00143   * @brief  This function handles External lines 15 to 10 interrupt request.
00144   * @param  None
00145   * @retval None
00146   */
00147 void EXTI15_10_IRQHandler(void)
00148 {   
00149   /* Checks whether the IOE EXTI line is asserted or not */
00150   if(EXTI_GetITStatus(IOE_IT_EXTI_LINE) != RESET)
00151   {
00152     
00153 #ifdef IOE_INTERRUPT_MODE       
00154     /* Check if the interrupt source is the Touch Screen */
00155     if (IOE_GetGITStatus(IOE_1_ADDR, IOE_TS_IT) & IOE_TS_IT)
00156     {
00157       static TS_STATE* TS_State;
00158       
00159       /* Update the structure with the current position */
00160       TS_State = IOE_TS_GetState();  
00161       
00162       if ((TS_State->TouchDetected) && (TS_State->Y < 220) && (TS_State->Y > 180))
00163       {
00164         if ((TS_State->X > 10) && (TS_State->X < 70))
00165         {
00166           LCD_DisplayStringLine(Line6, " LD4                ");
00167           STM_EVAL_LEDOn(LED4);
00168         }
00169         else if ((TS_State->X > 90) && (TS_State->X < 150))
00170         {
00171           LCD_DisplayStringLine(Line6, "      LD3           ");
00172           STM_EVAL_LEDOn(LED3);
00173         }
00174         else if ((TS_State->X > 170) && (TS_State->X < 230))
00175         {
00176           LCD_DisplayStringLine(Line6, "           LD2      ");
00177           STM_EVAL_LEDOn(LED2);
00178         }     
00179         else if ((TS_State->X > 250) && (TS_State->X < 310))
00180         {
00181           LCD_DisplayStringLine(Line6, "                LD1 ");
00182           STM_EVAL_LEDOn(LED1);
00183         }
00184       }
00185       else
00186       {
00187         STM_EVAL_LEDOff(LED1);
00188         STM_EVAL_LEDOff(LED2);
00189         STM_EVAL_LEDOff(LED3);
00190         STM_EVAL_LEDOff(LED4);
00191       }    
00192       
00193       /* Clear the interrupt pending bits */    
00194       IOE_ClearGITPending(IOE_1_ADDR, IOE_TS_IT);      
00195     }
00196  #ifdef USE_STM3210C_EVAL 
00197     else if (IOE_GetGITStatus(IOE_2_ADDR, IOE_GIT_GPIO))
00198     {
00199       static JOY_State_TypeDef JoyState = JOY_NONE;
00200       
00201       /* Get the Joytick State */
00202       JoyState = IOE_JoyStickGetState();
00203       
00204       switch (JoyState)
00205       {
00206       case JOY_NONE:
00207         LCD_DisplayStringLine(Line5, "JOY: IT  ----       ");
00208         break;
00209       case JOY_UP:
00210         LCD_DisplayStringLine(Line5, "JOY: IT  UP         ");
00211         break;     
00212       case JOY_DOWN:
00213         LCD_DisplayStringLine(Line5, "JOY: IT DOWN        ");
00214         break;          
00215       case JOY_LEFT:
00216         LCD_DisplayStringLine(Line5, "JOY: IT LEFT        ");
00217         break;         
00218       case JOY_RIGHT:
00219         LCD_DisplayStringLine(Line5, "JOY: IT  RIGHT      ");
00220         break;                 
00221       case JOY_CENTER:
00222         LCD_DisplayStringLine(Line5, "JOY: IT CENTER      ");
00223         break; 
00224       default:
00225         LCD_DisplayStringLine(Line5, "JOY: IT ERROR       ");
00226         break;         
00227       }   
00228       
00229       /* Clear the interrupt pending bits */    
00230       IOE_ClearGITPending(IOE_2_ADDR, IOE_GIT_GPIO);
00231       IOE_ClearIOITPending(IOE_2_ADDR, IOE_JOY_IT);     
00232     }
00233     /* CLear all pending interrupt */
00234     IOE_ClearGITPending(IOE_2_ADDR, ALL_IT);
00235     IOE_ClearIOITPending(IOE_2_ADDR, IOE_JOY_IT);    
00236  #endif /* USE_STM3210C_EVAL */
00237     
00238     /* CLear all pending interrupt */
00239     IOE_ClearGITPending(IOE_1_ADDR, ALL_IT);
00240     
00241 #endif /* IOE_INTERRUPT_MODE */
00242     
00243     EXTI_ClearITPendingBit(IOE_IT_EXTI_LINE);
00244   }  
00245 }
00246 
00247 /**
00248   * @}
00249   */ 
00250 
00251 
00252 /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/
STM32F10x Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM32(CORTEX M3) 32-bit Microcontrollers platform visit  www.st.com/STM32