use of com.qualcomm.robotcore.hardware.I2cDeviceSynchSimple in project robotcode by OutoftheBoxFTC.
the class UserI2cSensorType method createInstance.
// ----------------------------------------------------------------------------------------------
// Instance creation
// ----------------------------------------------------------------------------------------------
@NonNull
public HardwareDevice createInstance(RobotCoreLynxModule lynxModule, Func<I2cDeviceSynchSimple> simpleSynchFunc, Func<I2cDeviceSynch> synchFunc) throws InvocationTargetException {
try {
Constructor ctor;
ctor = findMatch(ctorI2cDeviceSynchSimple);
if (null != ctor) {
I2cDeviceSynchSimple i2cDeviceSynchSimple = simpleSynchFunc.value();
return (HardwareDevice) ctor.newInstance(i2cDeviceSynchSimple);
}
ctor = findMatch(ctorI2cDeviceSynch);
if (null != ctor) {
I2cDeviceSynch i2cDeviceSynch = synchFunc.value();
return (HardwareDevice) ctor.newInstance(i2cDeviceSynch);
}
} catch (IllegalAccessException | InstantiationException e) {
throw new RuntimeException("internal error: exception");
}
throw new RuntimeException("internal error: unable to locate constructor for user sensor type");
}
use of com.qualcomm.robotcore.hardware.I2cDeviceSynchSimple in project robotcode by OutoftheBoxFTC.
the class HardwareDeviceManager method createI2cDeviceSynchSimple.
protected I2cDeviceSynchSimple createI2cDeviceSynchSimple(RobotCoreLynxModule lynxModule, DeviceConfiguration.I2cChannel channel, String name) {
I2cDeviceSynchSimple result = LynxFirmwareVersionManager.createLynxI2cDeviceSynch(context, (LynxModule) lynxModule, channel.channel);
result.setUserConfiguredName(name);
return result;
}
use of com.qualcomm.robotcore.hardware.I2cDeviceSynchSimple in project robotcode by OutoftheBoxFTC.
the class HardwareDeviceManager method createI2cDeviceSynch.
@Override
public I2cDeviceSynch createI2cDeviceSynch(RobotCoreLynxModule lynxModule, DeviceConfiguration.I2cChannel channel, String name) {
RobotLog.v("Creating I2cDeviceSynch (Lynx) - mod=%d bus=%d", lynxModule.getModuleAddress(), channel.channel);
I2cDeviceSynchSimple i2cDeviceSynchSimple = createI2cDeviceSynchSimple(lynxModule, channel, name);
I2cDeviceSynch result = new I2cDeviceSynchImplOnSimple(i2cDeviceSynchSimple, true);
return result;
}
Aggregations