use of com.qualcomm.robotcore.hardware.I2cDeviceImpl in project robotcode by OutoftheBoxFTC.
the class HardwareDeviceManager method createI2cDeviceSynch.
protected I2cDeviceSynch createI2cDeviceSynch(I2cController controller, int channel, String name) {
I2cDevice i2cDevice = new I2cDeviceImpl(controller, channel);
I2cDeviceSynch i2cDeviceSynch = new I2cDeviceSynchImpl(i2cDevice, true);
i2cDeviceSynch.setUserConfiguredName(name);
return i2cDeviceSynch;
}
use of com.qualcomm.robotcore.hardware.I2cDeviceImpl in project robotcode by OutoftheBoxFTC.
the class UserI2cSensorType method createInstance.
@NonNull
public HardwareDevice createInstance(I2cController controller, int port) throws InvocationTargetException {
try {
Constructor ctor;
ctor = findMatch(ctorI2cDeviceSynch);
if (null == ctor) {
ctor = findMatch(ctorI2cDeviceSynchSimple);
}
if (null != ctor) {
I2cDevice i2cDevice = new I2cDeviceImpl(controller, port);
I2cDeviceSynch i2cDeviceSynch = new I2cDeviceSynchImpl(i2cDevice, true);
return (HardwareDevice) ctor.newInstance(i2cDeviceSynch);
}
ctor = findMatch(ctorI2cDevice);
if (null != ctor) {
I2cDevice i2cDevice = new I2cDeviceImpl(controller, port);
return (HardwareDevice) ctor.newInstance(i2cDevice);
}
ctor = findMatch(ctorI2cControllerPort);
if (null != ctor) {
return (HardwareDevice) ctor.newInstance(controller, port);
}
} catch (IllegalAccessException | InstantiationException e) {
throw new RuntimeException("internal error: exception");
}
throw new RuntimeException("internal error: unable to locate constructor for user sensor type");
}
Aggregations