Package ftclib.archive
Class FtcMRI2cDevice
java.lang.Object
trclib.robotcore.TrcSerialBusDevice
ftclib.robotcore.FtcI2cDevice
ftclib.archive.FtcMRI2cDevice
- Direct Known Subclasses:
FtcMRI2cColorSensor
,FtcMRI2cGyro
,FtcMRI2cRangeSensor
This class implements the common features of all Modern Robotics I2C devices. Typically, this class will be
extended by specific Modern Robotics I2C devices.
-
Nested Class Summary
Nested classes/interfaces inherited from class trclib.robotcore.TrcSerialBusDevice
TrcSerialBusDevice.Request
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int
private static final int
private static final int
private static final int
private static final byte
private static final byte
private final int
protected static final byte
private final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
Fields inherited from class ftclib.robotcore.FtcI2cDevice
deviceSynch
Fields inherited from class trclib.robotcore.TrcSerialBusDevice
instanceName, tracer
-
Constructor Summary
ConstructorsConstructorDescriptionFtcMRI2cDevice
(com.qualcomm.robotcore.hardware.HardwareMap hardwareMap, String instanceName, int i2cAddress, boolean addressIs7Bit) Constructor: Creates an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
changeI2cAddress
(int newAddress) This method changes the I2C address of the Modern Robotics device.void
changeI2cAddress
(int newAddress, boolean addressIs7Bit) This method changes the I2C address of the Modern Robotics device.int
This method returns the firmware revision.int
This method returns the ID code of the sensor.int
This method returns the manufacturer code of the sensor.Methods inherited from class ftclib.robotcore.FtcI2cDevice
readData, writeData
Methods inherited from class trclib.robotcore.TrcSerialBusDevice
asyncRead, asyncRead, asyncRead, asyncRead, asyncRead, asyncWrite, asyncWrite, asyncWrite, isEnabled, preemptiveWrite, sendByteCommand, sendWordCommand, setEnabled, syncRead, syncRead, syncWrite, syncWrite, toString
-
Field Details
-
REG_FIRMWARE_REVISION
protected static final int REG_FIRMWARE_REVISION- See Also:
-
REG_MANUFACTURER_CODE
protected static final int REG_MANUFACTURER_CODE- See Also:
-
REG_ID_CODE
protected static final int REG_ID_CODE- See Also:
-
REG_COMMAND
protected static final int REG_COMMAND- See Also:
-
REG_SET_I2C_ADDRESS
protected static final int REG_SET_I2C_ADDRESS- See Also:
-
HEADER_START
private static final int HEADER_START- See Also:
-
HEADER_END
private static final int HEADER_END- See Also:
-
HEADER_LENGTH
private static final int HEADER_LENGTH- See Also:
-
MANUFACTURER_CODE
protected static final byte MANUFACTURER_CODE- See Also:
-
I2CADDR_TRIGGER_BYTE_1
private static final byte I2CADDR_TRIGGER_BYTE_1- See Also:
-
I2CADDR_TRIGGER_BYTE_2
private static final byte I2CADDR_TRIGGER_BYTE_2- See Also:
-
firmwareRev
private final int firmwareRev -
manufacturerCode
private final int manufacturerCode -
idCode
private final int idCode
-
-
Constructor Details
-
FtcMRI2cDevice
public FtcMRI2cDevice(com.qualcomm.robotcore.hardware.HardwareMap hardwareMap, String instanceName, int i2cAddress, boolean addressIs7Bit) Constructor: Creates an instance of the object.- Parameters:
hardwareMap
- specifies the global hardware map.instanceName
- specifies the instance name.i2cAddress
- specifies the I2C address of the device.addressIs7Bit
- specifies true if the I2C address is a 7-bit address, false if it is 8-bit.
-
-
Method Details
-
changeI2cAddress
public void changeI2cAddress(int newAddress, boolean addressIs7Bit) This method changes the I2C address of the Modern Robotics device.- Parameters:
newAddress
- specifies the new I2C address.addressIs7Bit
- specifies true if the I2C address is a 7-bit address, false if it is 8-bit.
-
changeI2cAddress
public void changeI2cAddress(int newAddress) This method changes the I2C address of the Modern Robotics device.- Parameters:
newAddress
- specifies the new I2C address.
-
getFirmwareRevision
public int getFirmwareRevision()This method returns the firmware revision.- Returns:
- firmware revision number.
-
getManufacturerCode
public int getManufacturerCode()This method returns the manufacturer code of the sensor.- Returns:
- manufacturer code.
-
getIdCode
public int getIdCode()This method returns the ID code of the sensor.- Returns:
- ID code.
-