Пример #1
0
/**
  * @brief  Initialize and Configures the IO_Expanders Functionalities 
  *         (Touch Screen ..) and configures all STM32100E-EVAL necessary
  *         hardware (GPIOs, APB clocks ..).
  * @param  None
  * @retval IOE_OK if all initializations done correctly. Other value if error.
  */
uint8_t IOE_Config(void)
{
  IOE_StructInit();
  IOE_Init();
  
  /* Read IO Expander 1 ID  */
  if(IOE_IsOperational(IOE_1_ADDR))
  {
    return IOE1_NOT_OPERATIONAL;
  } 
  
  /* Generate IOExpander Software reset */
  IOE_Reset(IOE_1_ADDR); 
  
  /* ---------------------- IO Expander configuration --------------------- */
  /* Enable the GPIO, Touch Screen and ADC functionalities */
  IOE_FnctCmd(IOE_1_ADDR, IOE_ADC_FCT | IOE_IO_FCT , ENABLE);
   
  /* Touch Screen controller configuration */
  IOE_TS_Config();
  
  /* Temperature Sensor configuration */
  IOE_TempSens_Config();
  
  /* Configuration is OK */
  return IOE_OK; 
}
/**
  * @brief  Initializes and Configures the IO_Expander Touch Panel Functionality 
  *         and configures all STM32F429I_DISCO necessary
  *         hardware (GPIOs, APB clocks ..).
  * @param  None
  * @retval IOE_OK if all initializations done correctly. Other value if error.
  */
uint8_t IOE_Config(void)
{
  /* Configure the needed pins */
  IOE_GPIO_Config(); 
  
  /* I2C initialization */
  IOE_I2C_Config();
    
  /* Read IO Expander ID  */
  if(IOE_IsOperational())
  {
    return IOE_NOT_OPERATIONAL;
  }
  
  /* Generate IO Expander Software reset */
  IOE_Reset(); 
  
  /* IO Expander configuration */
  /* Touch Panel controller and ADC configuration */
  IOE_FnctCmd(IOE_ADC_FCT, ENABLE);
  IOE_TP_Config();

  /* Configuration is OK */
  return IOE_OK; 
}
Пример #3
0
/**
  * @brief  Initializes the IO Expander registers.
  * @param  None
  * @retval - 0: if all initializations are OK.
  */
uint32_t GL_TSC_Interface_Init(void)
{
#if TOUCH_SCREEN_CAPABILITY

  /* Configure the needed pins */
  TSC_GPIO_Configuration();

  /* Read IO Expander 1 ID  */
  if(IOE_IsOperational(pTscHwParam.TSC_DeviceRegister))
  {
    return 1;
  }

  /* Generate IOExpander Software reset */
  IOE_Reset(pTscHwParam.TSC_DeviceRegister);
  
  /* Disable all the Functionnalities */
  IOE_FnctCmd(pTscHwParam.TSC_DeviceRegister, IOE_IO_FCT | IOE_TEMPSENS_FCT | IOE_TS_FCT | IOE_ADC_FCT, DISABLE);
#endif

  return 0; /* Configuration is OK */
}
Пример #4
0
/**
  * @brief  Initializes and Configures the two IO_Expanders Functionalities
  *         (IOs, Touch Screen ..) and configures all STM3210C-EVAL necessary
  *         hardware (GPIOs, APB clocks ..).
  * @param  None
  * @retval IOE_OK if all initializations done correctly. Other value if error.
  */
uint8_t IOE_Config(void)
{
  /* Configure the needed pins */
  IOE_GPIO_Config();

  /* Configure the I2C peripheral */
  IOE_I2C_Config();

  /* Read IO Expander 1 ID  */
  if(IOE_IsOperational(IOE_1_ADDR))
  {
    return IOE1_NOT_OPERATIONAL;
  }
  if(IOE_IsOperational(IOE_2_ADDR))
  {
    return IOE2_NOT_OPERATIONAL;
  }

  /* Generate IOExpander Software reset */
  IOE_Reset(IOE_1_ADDR);
  IOE_Reset(IOE_2_ADDR);

  /* ---------------------- IO Expander 1 configuration --------------------- */
  /* Enable the GPIO, Touch Screen and ADC functionalities */
  IOE_FnctCmd(IOE_1_ADDR, IOE_IO_FCT | IOE_TS_FCT | IOE_ADC_FCT, ENABLE);
  /* Configure the VBAT pin in output mode pin*/
  IOE_IOPinConfig(IOE_1_ADDR, VBAT_DIV_PIN , Direction_OUT);
  /* ENABLE the alternate function for IN1 pin */
  IOE_IOAFConfig(IOE_1_ADDR, VBAT_DIV_PIN, ENABLE);

  /* Apply the default state for the out pins */
  IOE_WriteIOPin(VBAT_DIV_PIN, BitReset);
  /* Configure the MEMS interrupt pins in Input mode */
  IOE_IOPinConfig(IOE_2_ADDR, (uint32_t)(MEMS_INT1_PIN | MEMS_INT2_PIN), Direction_IN);

  /* ENABLE the alternate function for the Joystick pins */
  IOE_IOAFConfig(IOE_2_ADDR, (uint32_t)(MEMS_INT1_PIN | MEMS_INT2_PIN), ENABLE);
  /* Configure the IOs to detect Falling and Rising Edges */
  IOE_IOEdgeConfig(IOE_2_ADDR, (uint32_t)(MEMS_INT1_PIN | MEMS_INT2_PIN), (uint32_t)(EDGE_FALLING | EDGE_RISING));
  /* Touch Screen controller configuration */
  IOE_TS_Config();

  /* ------------------------------------------------------------------------ */

  /* ---------------------- IO Expander 2 configuration --------------------- */
  /* Enable the GPIO, Temperature Sensor and ADC functionalities */
  IOE_FnctCmd(IOE_2_ADDR, IOE_IO_FCT | IOE_TEMPSENS_FCT | IOE_ADC_FCT, ENABLE);

  /* Configure the Audio Codec Reset pin in output mode pin*/
  IOE_IOPinConfig(IOE_2_ADDR, (uint32_t)(AUDIO_RESET_PIN), Direction_OUT);
  IOE_IOPinConfig(IOE_2_ADDR, (uint32_t)(MII_INT_PIN), Direction_IN);

  /* ENABLE the alternate function for IN1 pin */
  IOE_IOAFConfig(IOE_2_ADDR, (uint32_t)(AUDIO_RESET_PIN | MII_INT_PIN), ENABLE);

  /* Apply the default state for the out pins */
  IOE_WriteIOPin(AUDIO_RESET_PIN, BitReset);
  IOE_WriteIOPin(MII_INT_PIN, BitReset);
  /* Configure the Joystick pins in Input mode */
  IOE_IOPinConfig(IOE_2_ADDR, JOY_IO_PINS , Direction_IN);

  /* ENABLE the alternate function for the Joystick pins */
  IOE_IOAFConfig(IOE_2_ADDR, JOY_IO_PINS, ENABLE);
  /* Configure the IOs to detect Falling and Rising Edges */
  IOE_IOEdgeConfig(IOE_2_ADDR, JOY_IO_PINS, (uint8_t)(EDGE_FALLING | EDGE_RISING));

  /* Temperature Sensor module configuration */
  IOE_TempSens_Config();
  /* ------------------------------------------------------------------------ */

  /* Configuration is OK */
  return IOE_OK;
}