use of com.qualcomm.hardware.lynx.commands.core.LynxI2cWriteReadMultipleBytesCommand in project robotcode by OutoftheBoxFTC.
the class LynxI2cDeviceSynchV2 method readTimeStamped.
/*
* Supporting firmware version XX.XX.XX
*/
@Override
public synchronized TimestampedData readTimeStamped(final int ireg, final int creg) {
LynxI2cDeviceSynchV2 deviceHavingProblems = null;
boolean reportUnhealthy;
try {
return acquireI2cLockWhile(new Supplier<TimestampedData>() {
@Override
public TimestampedData get() throws InterruptedException, RobotCoreException, LynxNackException {
LynxCommand<?> tx = new LynxI2cWriteReadMultipleBytesCommand(getModule(), bus, i2cAddr, ireg, creg);
tx.send();
readTimeStampedPlaceholder.reset();
return pollForReadResult(i2cAddr, ireg, creg);
}
});
} catch (InterruptedException | RobotCoreException | RuntimeException e) {
handleException(e);
} catch (LynxNackException e) {
/*
* This is a possible device problem, go ahead and tell makeFakeData to warn.
*/
deviceHavingProblems = this;
handleException(e);
}
return readTimeStampedPlaceholder.log(TimestampedI2cData.makeFakeData(deviceHavingProblems, getI2cAddress(), ireg, creg));
}
Aggregations