From 4763b0737ce9fd0be3eaee11076bcfbe038ffc4d Mon Sep 17 00:00:00 2001 From: Robert Atkinson Date: Fri, 11 Dec 2015 15:19:28 -0800 Subject: [PATCH] fix (and test) new modern color sensor code Former-commit-id: 519bf151ed1d6dffc26645394ce795bdac674d31 Former-commit-id: f7c6fad7b62cf774a098eb25bf9d1a476d81bac3 --- .../library/internal/MemberUtil.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/SwerveRoboticsLibrary/src/main/java/org/swerverobotics/library/internal/MemberUtil.java b/SwerveRoboticsLibrary/src/main/java/org/swerverobotics/library/internal/MemberUtil.java index 6dfed879a1e..dc100973e9b 100644 --- a/SwerveRoboticsLibrary/src/main/java/org/swerverobotics/library/internal/MemberUtil.java +++ b/SwerveRoboticsLibrary/src/main/java/org/swerverobotics/library/internal/MemberUtil.java @@ -221,8 +221,9 @@ static int portOfModernColorSensor(ColorSensor sensor) // Legacy Module //---------------------------------------------------------------------------------------------- - static I2cController.I2cPortReadyCallback[] callbacksOfLegacyModule(LegacyModule module) + static I2cController.I2cPortReadyCallback[] callbacksOfLegacyModule(LegacyModule imodule) { + ModernRoboticsUsbLegacyModule module = (ModernRoboticsUsbLegacyModule)imodule; return Util.getPrivateObjectField(module, 4); } @@ -230,20 +231,21 @@ static I2cController.I2cPortReadyCallback[] callbacksOfLegacyModule(LegacyModule // Device Interface Module //---------------------------------------------------------------------------------------------- - static I2cController.I2cPortReadyCallback[] callbacksOfDeviceInterfaceModule(DeviceInterfaceModule module) + static I2cController.I2cPortReadyCallback[] callbacksOfDeviceInterfaceModule(DeviceInterfaceModule imodule) { - return Util.getPrivateObjectField(module, 0); + ModernRoboticsUsbDeviceInterfaceModule module = (ModernRoboticsUsbDeviceInterfaceModule)imodule; + return Util.getPrivateObjectField(module, 3); } + //---------------------------------------------------------------------------------------------- + // I2cDevice + //---------------------------------------------------------------------------------------------- + public static I2cController i2cControllerOfI2cDevice(I2cDevice i2cDevice) { return Util.getPrivateObjectField(i2cDevice, 0); } - //---------------------------------------------------------------------------------------------- - // I2cDevice - //---------------------------------------------------------------------------------------------- - public static int portOfI2cDevice(I2cDevice i2cDevice) { return Util.getPrivateIntField(i2cDevice, 1);