use of com.qualcomm.robotcore.hardware.I2cDeviceSynchImpl 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.I2cDeviceSynchImpl in project robotcode by OutoftheBoxFTC.
the class HardwareFactory method mapI2cDeviceSynch.
private void mapI2cDeviceSynch(HardwareMap map, DeviceManager deviceMgr, I2cController i2cController, DeviceConfiguration devConf) {
if (!devConf.isEnabled()) {
return;
}
I2cDevice i2cDevice = deviceMgr.createI2cDevice(i2cController, devConf.getI2cChannel(), devConf.getName());
I2cDeviceSynch i2cDeviceSynch = new I2cDeviceSynchImpl(i2cDevice, true);
map.i2cDeviceSynch.put(devConf.getName(), i2cDeviceSynch);
}
use of com.qualcomm.robotcore.hardware.I2cDeviceSynchImpl 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