Esempio n. 1
0
/**
  * @brief  This function handles External line 10 interrupt request.
  * @param  None
  * @retval None
  */
void EXTI2_IRQHandler(void)
{
#if 0
  static JOY_State_TypeDef JoyState = JOY_NONE;

  if(EXTI_GetITStatus(IOE_IT_EXTI_LINE) != RESET)
  {
    if(IOE_GetGITStatus(IOE_2_ADDR, IOE_GIT_GPIO))
    {
      /* Get the Joystick State */
      JoyState = IOE_JoyStickGetState();

      switch (JoyState)
      {
        case JOY_NONE:
        break;

        case JOY_UP:
        {
          PressedKey =  UP;
          break;
        }
        case JOY_DOWN:
        {
          PressedKey =  DOWN;
          break;
        }
        case JOY_RIGHT :
        {
          PressedKey =  JOY_NONE;
          break;
        }
        case JOY_LEFT:
        {
          PressedKey =  JOY_NONE;
          break;
        }
        case JOY_CENTER:
        {
          PressedKey =  SEL;
          break;
        }
        default:
        {
          PressedKey =  JOY_NONE;
          LCD_DisplayStringLine(LINE(17), (uint8_t*)"     JOY  ERROR     ");
          break;
        }
      }
    }
    /* Clear the interrupt pending bits */
    IOE_ClearGITPending(IOE_2_ADDR, IOE_GIT_GPIO);
    IOE_ClearIOITPending(IOE_2_ADDR, IOE_JOY_IT);
  }
  /* Clear interrupt pending bit */
  EXTI_ClearITPendingBit(IOE_IT_EXTI_LINE);
#endif
}
Esempio n. 2
0
/**
  * @brief  This function handles External lines 15 to 10 interrupt request.
  * @param  None
  * @retval None
  */
void EXTI15_10_IRQHandler(void)
{   
  /* Checks whether the IOE EXTI line is asserted or not */
  if(EXTI_GetITStatus(IOE_IT_EXTI_LINE) != RESET)
  {
    
#ifdef IOE_INTERRUPT_MODE       
    /* Check if the interrupt source is the Touch Screen */
    if (IOE_GetGITStatus(IOE_1_ADDR, IOE_TS_IT) & IOE_TS_IT)
    {
      static TS_STATE* TS_State;
      
      /* Update the structure with the current position */
      TS_State = IOE_TS_GetState();  
      
      if ((TS_State->TouchDetected) && (TS_State->Y < 220) && (TS_State->Y > 180))
      {
        if ((TS_State->X > 10) && (TS_State->X < 70))
        {
          LCD_DisplayStringLine(Line6, " LD4                ");
          STM_EVAL_LEDOn(LED4);
        }
        else if ((TS_State->X > 90) && (TS_State->X < 150))
        {
          LCD_DisplayStringLine(Line6, "      LD3           ");
          STM_EVAL_LEDOn(LED3);
        }
        else if ((TS_State->X > 170) && (TS_State->X < 230))
        {
          LCD_DisplayStringLine(Line6, "           LD2      ");
          STM_EVAL_LEDOn(LED2);
        }     
        else if ((TS_State->X > 250) && (TS_State->X < 310))
        {
          LCD_DisplayStringLine(Line6, "                LD1 ");
          STM_EVAL_LEDOn(LED1);
        }
      }
      else
      {
        STM_EVAL_LEDOff(LED1);
        STM_EVAL_LEDOff(LED2);
        STM_EVAL_LEDOff(LED3);
        STM_EVAL_LEDOff(LED4);
      }    
      
      /* Clear the interrupt pending bits */    
      IOE_ClearGITPending(IOE_1_ADDR, IOE_TS_IT);      
    }
 #ifdef USE_STM3210C_EVAL 
    else if (IOE_GetGITStatus(IOE_2_ADDR, IOE_GIT_GPIO))
    {
      static JOY_State_TypeDef JoyState = JOY_NONE;
      
      /* Get the Joytick State */
      JoyState = IOE_JoyStickGetState();
      
      switch (JoyState)
      {
      case JOY_NONE:
        LCD_DisplayStringLine(Line5, "JOY: IT  ----       ");
        break;
      case JOY_UP:
        LCD_DisplayStringLine(Line5, "JOY: IT  UP         ");
        break;     
      case JOY_DOWN:
        LCD_DisplayStringLine(Line5, "JOY: IT DOWN        ");
        break;          
      case JOY_LEFT:
        LCD_DisplayStringLine(Line5, "JOY: IT LEFT        ");
        break;         
      case JOY_RIGHT:
        LCD_DisplayStringLine(Line5, "JOY: IT  RIGHT      ");
        break;                 
      case JOY_CENTER:
        LCD_DisplayStringLine(Line5, "JOY: IT CENTER      ");
        break; 
      default:
        LCD_DisplayStringLine(Line5, "JOY: IT ERROR       ");
        break;         
      }   
      
      /* Clear the interrupt pending bits */    
      IOE_ClearGITPending(IOE_2_ADDR, IOE_GIT_GPIO);
      IOE_ClearIOITPending(IOE_2_ADDR, IOE_JOY_IT);     
    }
    /* CLear all pending interrupt */
    IOE_ClearGITPending(IOE_2_ADDR, ALL_IT);
    IOE_ClearIOITPending(IOE_2_ADDR, IOE_JOY_IT);    
 #endif /* USE_STM3210C_EVAL */
    
    /* CLear all pending interrupt */
    IOE_ClearGITPending(IOE_1_ADDR, ALL_IT);
    
#endif /* IOE_INTERRUPT_MODE */
    
    EXTI_ClearITPendingBit(IOE_IT_EXTI_LINE);
  }  
}
/**
  * @brief  This function handles External lines 15 to 10 interrupt request.
  * @param  None
  * @retval None
  */
void EXTI15_10_IRQHandler(void)
{  
 #ifdef USE_STM32100E_EVAL  
  if(EXTI_GetITStatus(RIGHT_BUTTON_EXTI_LINE) != RESET)
  {
    if (ReadKey == 1)
    {
      PressedKey =  RIGHT;     
    }
    else
    {
      if (GetMutex == 1)
      {
        ShowMutex = 0;
      }
      else
      {
        ReqOperation = SHOW_TEMPERATURE_OP ;
      }
    }
    
    /* Clear EXTI interrupts pending bits */
    EXTI_ClearITPendingBit(RIGHT_BUTTON_EXTI_LINE);
  }
  
  if(EXTI_GetITStatus(LEFT_BUTTON_EXTI_LINE) != RESET)
  {
    if (ReadKey == 1)
    {
      PressedKey =  LEFT;     
    }
    else
    {
      if (GetMutex == 1)
      {
        ShowMutex = 0;
      }
      else
      {
        ReqOperation = SHOW_TIME_OP;
      }
    }
    
    /* Clear EXTI interrupts pending bits */
    EXTI_ClearITPendingBit(LEFT_BUTTON_EXTI_LINE);
  }
  
  if(EXTI_GetITStatus(UP_BUTTON_EXTI_LINE) != RESET)
  {
    if (ReadKey == 1)
    {
      PressedKey =  UP;     
    }
    else
    {
      if (GetMutex == 0)
      {
        ReqOperation = GET_REPORT_OP;
      }
    }
    
    /* Clear EXTI interrupts pending bits */
    EXTI_ClearITPendingBit(UP_BUTTON_EXTI_LINE);
  }
  
  if(EXTI_GetITStatus(DOWN_BUTTON_EXTI_LINE) != RESET)
  {    
    if (ReadKey == 1)
    {
      PressedKey =  DOWN;     
    }
    else
    {
      if (GetMutex == 0)
      {
        ReqOperation = ERASE_EEPROM_OP;
      }
    }
    
    /* Clear EXTI interrupts pending bits */
    EXTI_ClearITPendingBit(DOWN_BUTTON_EXTI_LINE);
  }
 #endif /* USE_STM32100E_EVAL */ 
  
  if(EXTI_GetITStatus(IOE_IT_EXTI_LINE) != RESET)
  {     
 #ifdef  USE_STM3210C_EVAL     
    static JOY_State_TypeDef JoyState = JOY_NONE;
 #endif /* USE_STM3210C_EVAL */
    static TS_STATE* TS_State;
    
    /* Check if the interrupt source is the Touch Screen */
    if (IOE_GetGITStatus(IOE_1_ADDR, IOE_TS_IT) & IOE_TS_IT)
    { 
      /* Update the structure with the current position */
      TS_State = IOE_TS_GetState();  
      
      if ((TS_State->TouchDetected) && (TS_State->Y < 230) && (TS_State->Y > 200))
      {
        if ((TS_State->X > 10) && (TS_State->X < 70))
        {
          LCD_DisplayStringLine(Line7, (uint8_t*)" TS1                ");
        }
        else if ((TS_State->X > 90) && (TS_State->X < 150))
        {
          LCD_DisplayStringLine(Line7, (uint8_t*)"      TS2           ");
        }
        else if ((TS_State->X > 170) && (TS_State->X < 230))
        {
          LCD_DisplayStringLine(Line7, (uint8_t*)"           TS3      ");
        }     
        else if ((TS_State->X > 250) && (TS_State->X < 310))
        {
          LCD_DisplayStringLine(Line7, (uint8_t*)"                TS4 ");
        }          
      }
      else
      {
        STM_EVAL_LEDOff(LED1);
        STM_EVAL_LEDOff(LED2);
        STM_EVAL_LEDOff(LED3);
        STM_EVAL_LEDOff(LED4);
      }    
      
      /* Clear the interrupt pending bits */    
      IOE_ClearGITPending(IOE_1_ADDR, IOE_TS_IT); 
    }
 #ifdef USE_STM3210C_EVAL     
    else if (IOE_GetGITStatus(IOE_2_ADDR, IOE_GIT_GPIO))
    {       
      /* Get the Joystick State */
      JoyState = IOE_JoyStickGetState();
      
      switch (JoyState)
      {
      case JOY_NONE:
        break;
        
      case JOY_UP:
        if (ReadKey == 1)
        {
          PressedKey =  UP;     
        }
        else
        {
          if (GetMutex == 0)
          {
            ReqOperation = GET_REPORT_OP;
          }     
        }
        break;     
        
      case JOY_DOWN:
        if (ReadKey == 1)
        {
          PressedKey =  DOWN;     
        }
        else
        {
          if (GetMutex == 0)
          {
            ReqOperation = ERASE_EEPROM_OP;
          }
        }
        break;       
        
      case JOY_RIGHT :
        if (ReadKey == 1)
        {
          PressedKey =  RIGHT;     
        }
        else
        {        
          if (GetMutex == 1)
          {
            ShowMutex = 0;
          }
          else
          {
            ReqOperation = SHOW_TEMPERATURE_OP ;
          }
        }
        break;     
        
      case JOY_LEFT:
        if (ReadKey == 1)
        {
          PressedKey =  LEFT;     
        }
        else
        {        
          if (GetMutex == 1)
          {
            ShowMutex = 0;
          }
          else
          {
            ReqOperation = SHOW_TIME_OP;
          }
        }
        break;       
        
      case JOY_CENTER:
        if (ReadKey == 1)
        {
          PressedKey =  SEL;     
        }
        else
        {
          if (GetMutex == 1)
          {
            NextRep = 1;
            ExitMutex = 1; 
          }
        }
        break; 
        
      default:
        LCD_DisplayStringLine(Line9, (uint8_t*)"     JOY  ERROR     ");
        break;           
      }
      
      /* Clear the interrupt pending bits */    
      IOE_ClearGITPending(IOE_2_ADDR, IOE_GIT_GPIO);
      IOE_ClearIOITPending(IOE_2_ADDR, IOE_JOY_IT);   
    }
 #endif /* USE_STM3210C_EVAL */       
    else
    {
      /* Clear the interrupt pending bits */       
 #ifdef  USE_STM3210C_EVAL 
      IOE_ClearGITPending(IOE_1_ADDR, ALL_IT);
      IOE_ClearGITPending(IOE_2_ADDR, ALL_IT);
 #else 
      IOE_ClearGITPending(IOE_1_ADDR, ALL_IT);
 #endif /* USE_STM3210C_EVAL */   
    }    
  }
  
  /* Clear EXTI interrupts pending bits */
  EXTI_ClearITPendingBit(IOE_IT_EXTI_LINE); 
}