Class FtcMRI2cDevice

Direct Known Subclasses:
FtcMRI2cColorSensor, FtcMRI2cGyro, FtcMRI2cRangeSensor

public class FtcMRI2cDevice extends FtcI2cDevice
This class implements the common features of all Modern Robotics I2C devices. Typically, this class will be extended by specific Modern Robotics I2C devices.
  • 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.