/* Configures the selected pin to be in Alternate function or not.  */
uint8_t IOE_IOAFConfig(uint8_t DeviceAddr, uint8_t IO_Pin, FunctionalState NewState)
/* Configures the selected pin to be in Alternate function or not.  */
uint8_t IOE_IOAFConfig(uint8_t DeviceAddr, uint8_t IO_Pin, FunctionalState NewState)
{
  uint8_t tmp = 0;
  tmp = I2C_ReadDeviceRegister(DeviceAddr, IOE_REG_GPIO_AF);
  if (NewState != DISABLE)
  {
    tmp |= (uint8_t)IO_Pin;
  }
  else
  {   
    tmp &= ~(uint8_t)IO_Pin;   
  }  
  I2C_WriteDeviceRegister(DeviceAddr, IOE_REG_GPIO_AF, tmp);
  return IOE_OK;
}