bool MicoI2cProbeDevice( mico_i2c_device_t* device, int retries )
{
  platform_i2c_config_t config;

  if ( device->port >= MICO_I2C_NONE )
    return kUnsupportedErr;
  
  config.address       = device->address;
  config.address_width = device->address_width;
  config.flags         &= ~I2C_DEVICE_USE_DMA ;
  config.speed_mode    = device->speed_mode;
  
  return platform_i2c_probe_device( &platform_i2c_peripherals[device->port], &config, retries );
}
示例#2
0
bool MicoI2cProbeDevice( mico_i2c_device_t* device, int retries )
{
  bool ret;
  platform_i2c_config_t config;

  if ( device->port >= MICO_I2C_NONE )
    return kUnsupportedErr;
  
  config.address       = device->address;
  config.address_width = device->address_width;
  config.flags         &= ~I2C_DEVICE_USE_DMA ;
  config.speed_mode    = device->speed_mode;

  mico_rtos_lock_mutex( &platform_i2c_drivers[device->port].i2c_mutex );
  ret = platform_i2c_probe_device( &platform_i2c_peripherals[device->port], &config, retries );
  mico_rtos_unlock_mutex( &platform_i2c_drivers[device->port].i2c_mutex );

  return ret;
}