Пример #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; 
}
Пример #2
0
/**
  * @brief  Initialize the stmpe1600 and configure the needed hardware resources
  * @param  DeviceAddr: Device address on communication Bus.  
  * @retval None
  */
void stmpe1600_Init(uint16_t DeviceAddr)
{
  uint8_t instance;
  uint8_t empty;
  
  /* Check if device instance already exists */
  instance = stmpe1600_GetInstance(DeviceAddr);
  
  if(instance == 0xFF)
  {
    /* Look for empty instance */
    empty = stmpe1600_GetInstance(0);
    
    if(empty < STMPE1600_MAX_INSTANCE)
    {
      /* Register the current device instance */
      stmpe1600[empty] = DeviceAddr;
      
      /* Initialize IO BUS layer */
      IOE_Init(); 
      
      /* Generate stmpe1600 Software reset */
      stmpe1600_Reset(DeviceAddr);
    }
  } 
}
Пример #3
0
/**
  * @brief  User callback that manages the IOE errors.
  * @param  None
  * @retval None
  */ 
void IOE_TimeoutUserCallback(void)
{
  /* Configure the needed pins */
  IOE_EXTI_Config(); 
  
  /* Configure I2C device */
  IOE_StructInit();
  IOE_Init();
}  
Пример #4
0
/**
  * @brief  Read the stmpe1600 device ID.
  * @param  DeviceAddr: Device address on communication Bus.  
  * @retval The Device ID (two bytes).
  */
uint16_t stmpe1600_ReadID(uint16_t DeviceAddr)
{
  uint8_t tmpData[2] = {0 , 0};

  /* Initialize IO BUS layer */
  IOE_Init(); 
  
  /* Read the stmpe1600 device ID */
  IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_CHP_ID, tmpData, 2);
  
  /* Return the device ID value */
  return((uint16_t)tmpData[0] | (((uint16_t)tmpData[1]) << 8));
}
Пример #5
0
/**
  * @brief  Initializes and configures the touch screen functionalities and 
  *         configures all necessary hardware resources (GPIOs, clocks..).
  * @param  xSize: Maximum X size of the TS area on LCD
  *         ySize: Maximum Y size of the TS area on LCD  
  * @retval TS_OK if all initializations are OK. Other value if error.
  */
uint8_t BSP_TS_Init(uint16_t xSize, uint16_t ySize)
{
  uint8_t status = TS_OK;
  tsXBoundary = xSize;
  tsYBoundary = ySize;
  
  /* Read ID and verify if the IO expander is ready */
  if(stmpe811_ts_drv.ReadID(TS_I2C_ADDRESS) == STMPE811_ID) 
  { 
    /* Initialize the TS driver structure */
    tsDriver = &stmpe811_ts_drv;  
    I2cAddress = TS_I2C_ADDRESS;
    tsOrientation = TS_SWAP_Y;
  }
  else
  {
    IOE_Init();
    
    /* Check TS3510 touch screen driver presence to determine if TS3510 or
     * EXC7200 driver will be used */
    if(BSP_TS3510_IsDetected() == 0)
    {
      /* Initialize the TS driver structure */
      tsDriver = &ts3510_ts_drv; 
      I2cAddress = TS3510_I2C_ADDRESS;
    }
    else    
    {
      /* Initialize the TS driver structure */
      tsDriver = &exc7200_ts_drv; 
      I2cAddress = EXC7200_I2C_ADDRESS;
    }
    tsOrientation = TS_SWAP_NONE;   
  }
  
  /* Initialize the TS driver */
  tsDriver->Init(I2cAddress);
  tsDriver->Start(I2cAddress);
  
  return status;
}
Пример #6
0
/**
  * @brief  Initialize the ts3510 and configure the needed hardware resources
  * @param  DeviceAddr: Device address on communication Bus.
  * @retval None
  */
void ts3510_Init(uint16_t DeviceAddr)
{
  /* Initialize IO BUS layer */
  IOE_Init(); 
  
}
Пример #7
0
/**
  * @brief  Initialize the exc7200 and configure the needed hardware resources
  * @param  DeviceAddr: Device address on communication Bus.
  * @retval None
  */
void exc7200_Init(uint16_t DeviceAddr)
{
  /* Initialize IO BUS layer */
  IOE_Init();

}
/**
  * @brief  Initialize 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)
{
    IOE_StructInit();
    IOE_Init();

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

    /* Read IO Expander 2 ID  */
    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_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);

    /* 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_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));

    /* 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));

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

    /* Configuration is OK */
    return IOE_OK;
}