コード例 #1
0
/**
  * @brief  Enables the touch Panel interrupt.
  * @param  None
  * @retval IOE_OK: if all initializations are OK. Other value if error.
  */
uint8_t IOE_TPITConfig(void)
{    
  /* Enable the Global interrupt */  
  IOE_GITCmd(ENABLE);     
          
  /* Enable the Global GPIO Interrupt */
  IOE_GITConfig((uint8_t)(IOE_GIT_TOUCH | IOE_GIT_FTH | IOE_GIT_FOV), ENABLE);    
    
  /* Read the GPIO_IT_STA to clear all pending bits if any */
  I2C_ReadDeviceRegister(IOE_REG_GPIO_INT_STA); 
  
  /* If all OK return IOE_OK */
  return IOE_OK;
}
コード例 #2
0
/**
  * @brief  Configures The selected interrupts on the IO Expanders.
  * @param  IOE_ITSRC_Source: the source of the interrupts. Could be one or a 
  *         combination of the following parameters:
  *   @arg  IOE_ITSRC_JOYSTICK: Joystick IO intputs.
  *   @arg  IOE_ITSRC_TSC: Touch Screen interrupts.
  *   @arg  IOE_ITSRC_INMEMS: MEMS interrupt lines.
  * @retval IOE_OK: if all initializations are OK. Other value if error.
  */
uint8_t IOE_ITConfig(uint32_t IOE_ITSRC_Source)
{   
  /* Configure the Interrupt output pin to generate low level (INT_CTRL) */
  IOE_ITOutConfig(Polarity_High, Type_Level);  
  
  /* Manage the Touch Screen Interrupts */  
  if (IOE_ITSRC_Source & IOE_ITSRC_TSC) {   
    /* Enable the Global interrupt */  
    IOE_GITCmd(IOE_1_ADDR, ENABLE);     
           
    /* Enable the Global GPIO Interrupt */
    IOE_GITConfig(IOE_1_ADDR, (uint8_t)(IOE_GIT_TOUCH | IOE_GIT_FTH), ENABLE);    
    
    /* Read the GPIO_IT_STA to clear all pending bits if any */
    I2C_ReadDeviceRegister(IOE_1_ADDR, IOE_REG_GPIO_INT_STA); 
  }
  
  /* Configure the Interrupt line as EXTI source */
  IOE_EXTI_Config();    
  
  /* If all OK return IOE_OK */
  return IOE_OK;
}
コード例 #3
0
/**
  * @brief  Configures The selected interrupts on the IO Expanders.
  * @param  IOE_ITSRC_Source: the source of the interrupts. Could be one or a
  *         combination of the following parameters:
  *   @arg  IOE_ITSRC_JOYSTICK: Joystick IO interrupts.
  *   @arg  IOE_ITSRC_TSC: Touch Screen interrupts.
  *   @arg  IOE_ITSRC_INMEMS: MEMS interrupt lines.
  * @retval IOE_OK: if all initializations are OK. Other value if error.
  */
uint8_t IOE_ITConfig(uint32_t IOE_ITSRC_Source)
{
    /* Configure the Interrupt output pin to generate low level (INT_CTRL) */
    IOE_ITOutConfig(Polarity_Low, Type_Level);

    /* Manage the Joystick Interrupts */
    if (IOE_ITSRC_Source & IOE_ITSRC_JOYSTICK)
    {
        /* Enable the Global interrupt */
        IOE_GITCmd(IOE_2_ADDR, ENABLE);

        /* Enable the Joystick pins to generate interrupt (GPIO_INT_EN) */
        IOE_IOITConfig(IOE_2_ADDR, IOE_JOY_IT, ENABLE);

        /* Enable the Global GPIO Interrupt */
        IOE_GITConfig(IOE_2_ADDR, IOE_GIT_GPIO, ENABLE);

        /* Read the GPIO_IT_STA to clear all pending bits if any */
        I2C_ReadDeviceRegister(IOE_2_ADDR, IOE_REG_GPIO_INT_STA);

        /* Enable the Joystick pins to generate interrupt */
        IOE_IOITConfig(IOE_2_ADDR, IOE_JOY_IT, ENABLE);

        /* Read the GPIO_IT_STA to clear all pending bits if any */
        I2C_ReadDeviceRegister(IOE_2_ADDR, IOE_REG_GPIO_INT_STA);
    }

    /* Manage the MEMS Interrupts lines  */
    if (IOE_ITSRC_Source & IOE_ITSRC_INMEMS)
    {
        /* Enable the Global interrupt */
        IOE_GITCmd(IOE_1_ADDR, ENABLE);

        /* Enable the pins to generate interrupt (GPIO_INT_EN) */
        IOE_IOITConfig(IOE_1_ADDR, IOE_INMEMS_IT, ENABLE);

        /* Enable the Global GPIO Interrupt */
        IOE_GITConfig(IOE_1_ADDR, IOE_GIT_GPIO, ENABLE);

        /* Read the GPIO_IT_STA to clear all pending bits if any */
        I2C_ReadDeviceRegister(IOE_1_ADDR, IOE_REG_GPIO_INT_STA);

        /* Enable the pins to generate interrupt */
        IOE_IOITConfig(IOE_1_ADDR, IOE_INMEMS_IT, ENABLE);

        /* Read the GPIO_IT_STA to clear all pending bits if any */
        I2C_ReadDeviceRegister(IOE_1_ADDR, IOE_REG_GPIO_INT_STA);
    }

    /* Manage the Touch Screen Interrupts */
    if (IOE_ITSRC_Source & IOE_ITSRC_TSC)
    {
        /* Enable the Global interrupt */
        IOE_GITCmd(IOE_1_ADDR, ENABLE);

        /* Enable the Global GPIO Interrupt */
        IOE_GITConfig(IOE_1_ADDR, (uint8_t)(IOE_GIT_TOUCH | IOE_GIT_FTH | IOE_GIT_FOV), ENABLE);

        /* Read the GPIO_IT_STA to clear all pending bits if any */
        I2C_ReadDeviceRegister(IOE_1_ADDR, IOE_REG_GPIO_INT_STA);
    }

    /* Configure the Interrupt line as EXTI source */
    IOE_EXTI_Config();

    /* If all OK return IOE_OK */
    return IOE_OK;
}