IOE_Status_TypDef JOYSTICK_interrupt(void) { uint16_t JoyStick ; JoyStick = IOE16_GetITStatus() ; ///phv TObe COnfirmed //JoyStick |= ~(JOY_IO_PINS) ; //JoyStick = ~JoyStick; switch (JoyStick) { case JOY_IO16_SEL: // CENTER JOYSTICK_press_event(4); break; case JOY_IO16_DOWN: JOYSTICK_press_event(1); break; case JOY_IO16_LEFT: JOYSTICK_press_event(2); break; case JOY_IO16_RIGHT: JOYSTICK_press_event(3); break; case JOY_IO16_UP: JOYSTICK_press_event(0); break; default: JOYSTICK_release_event(0); JOYSTICK_release_event(1); JOYSTICK_release_event(2); JOYSTICK_release_event(3); JOYSTICK_release_event(4); break; } /* Clear the interrupt pending bits */ CLEARFIFO; IOE_CLEAR_IT(IOE_ADDR, IOE_TS_IT); return IOE_OK; }
/** * @brief This function handles External lines 9 to 5 interrupt request. * @param None * @retval None */ void EXTI9_5_IRQHandler(void) { if(EXTI_GetITStatus(IOE16_IT_EXTI_LINE) != RESET) { #ifdef IOE_INTERRUPT_MODE __IO uint16_t tmpsr = 0; static JOY_State_TypeDef JoyState = JOY_NONE; static TS_STATE* TS_State; /* Get the interrupt status register */ tmpsr = IOE16_GetITStatus(); /* Check Touch screen interrupt event occurred */ if((tmpsr & IOE16_TS_IT) != 0) { /* Update the structure with the current position */ TS_State = IOE_TS_GetState(); if ((TS_State->TouchDetected) && (TS_State->Y < 92) && (TS_State->Y > 52)) { if ((TS_State->X > 60) && (TS_State->X < 120)) { LCD_SetTextColor(LCD_COLOR_GREEN); LCD_DisplayStringLine(LCD_LINE_10, (uint8_t *)" LED1 "); STM_EVAL_LEDOn(LED1); } else if ((TS_State->X > 140) && (TS_State->X < 200)) { LCD_SetTextColor(LCD_COLOR_YELLOW); LCD_DisplayStringLine(LCD_LINE_10, (uint8_t *)" LED2 "); STM_EVAL_LEDOn(LED2); } else if ((TS_State->X > 220) && (TS_State->X < 280)) { LCD_SetTextColor(LCD_COLOR_RED); LCD_DisplayStringLine(LCD_LINE_10, (uint8_t *)" LED3 "); STM_EVAL_LEDOn(LED3); } else if ((TS_State->X > 300) && (TS_State->X < 360)) { LCD_SetTextColor(LCD_COLOR_BLUE); LCD_DisplayStringLine(LCD_LINE_10, (uint8_t *)" LED4"); STM_EVAL_LEDOn(LED4); } } else { STM_EVAL_LEDOff(LED1); STM_EVAL_LEDOff(LED2); STM_EVAL_LEDOff(LED3); STM_EVAL_LEDOff(LED4); } /* Clear the interrupt pending bits */ IOE_ClearGITPending(IOE16_TS_IT); } /* Check joystick interrupt event occurred */ if((tmpsr & IOE16_JOY_IT) != 0 ) { /* Get the joystick State */ JoyState = IOE16_JoyStickGetState(); /* Set the LCD Text Color */ LCD_SetTextColor(Blue); switch (JoyState) { case JOY_NONE: LCD_DisplayStringLine(LCD_LINE_5, (uint8_t *)" JOY: ---- "); break; case JOY_UP: LCD_DisplayStringLine(LCD_LINE_5, (uint8_t *)" JOY: UP "); break; case JOY_DOWN: LCD_DisplayStringLine(LCD_LINE_5, (uint8_t *)" JOY: DOWN "); break; case JOY_LEFT: LCD_DisplayStringLine(LCD_LINE_5, (uint8_t *)" JOY: LEFT "); break; case JOY_RIGHT: LCD_DisplayStringLine(LCD_LINE_5, (uint8_t *)" JOY: RIGHT "); break; case JOY_CENTER: LCD_DisplayStringLine(LCD_LINE_5, (uint8_t *)" JOY: CENTER "); break; default: LCD_DisplayStringLine(LCD_LINE_5, (uint8_t *)" JOY: ERROR "); break; } } #endif /* IOE_INTERRUPT_MODE */ /* Clear all pending bits */ EXTI_ClearITPendingBit(IOE16_IT_EXTI_LINE); IOE_ClearGITPending(ALL_GIT); IOE16_GetITStatus(); } }