Java 类edu.wpi.first.wpilibj.I2C.Port 实例源码

项目:CasseroleLib    文件:TCS34725ColorSensor.java   
/**
 * Constructor for TCS34725 Color Sensor from Adafruit. Initializes internal data structures and
 * opens I2C coms to the device.
 */
TCS34725ColorSensor() {
    color_sen = new I2C(Port.kOnboard, I2C_constants.TCS34725_I2C_ADDR);
    sensor_initalized = false;
    good_data_read = false;

}
项目:Frc2017FirstSteamWorks    文件:FrcI2cDevice.java   
/**
 * Constructor: Creates an instance of the object.
 *
 * @param instanceName specifies the instance name.
 * @param port specifies the I2C port the device is connected to.
 * @param devAddress specifies the address of the device on the I2C bus.
 */
public FrcI2cDevice(final String instanceName, Port port, int devAddress)
{
    super(instanceName);

    if (debugEnabled)
    {
        dbgTrace = new TrcDbgTrace(moduleName + "." + instanceName, tracingEnabled, traceLevel, msgLevel);
    }

    device = new I2C(port, devAddress);
}
项目:CasseroleLib    文件:pulsedLightLIDAR.java   
public pulsedLightLIDAR() {
    i2c = new I2C(Port.kMXP, LIDAR_ADDR);
    distance = new byte[2];
    updater = new java.util.Timer();
}
项目:CMonster2015    文件:ITG3200.java   
/**
 * Creates a new ITG-3200 on the specified I2C port and digital interrupt
 * port, possibly using the alternate address.
 * 
 * @param port the I2C port the gyro is attached to
 * @param interrupt the interrupt port to use
 * @param altAddress whether to use the alternate address
 */
public ITG3200(Port port, DigitalSource interrupt, boolean altAddress) {
    // Setup the address
    if (altAddress) {
        address = ALT_ADDRESS;
    } else {
        address = ADDRESS;
    }

    i2c = new I2C(port, address);

    // Register an interrupt handler
    interrupt.requestInterrupts(new InterruptHandlerFunction<Object>() {

        @Override
        public void interruptFired(int interruptAssertedMask, Object param) {
            if (calibrate) {
                // If in calibration mode, run the calibration handler
                readCalibrationAxes();
            } else {
                // Otherwise, read the axes normally
                readAxes();
            }
        }
    });
    // Listen for a falling edge
    interrupt.setUpSourceEdge(false, true);

    // Write the power management register (ie. clock source)
    writePowerManagement();
    // Write the filter and full scale register
    writeDLPFFullScale();
    // Write sample rate divider
    writeSampleRateDivider();

    // Enable digital interrupt pin
    interrupt.enableInterrupts();
    // Write interrupt config to gyro
    writeInterruptConfig();
    // Clear any existing interrupts in case the robot code was restarted
    // but the gyro was not
    clearInterrupts();

    // Calibrate the gyro
    calibrate(DEFAULT_CALIBRATION_TIME);
}
项目:Frc2017FirstSteamWorks    文件:FrcI2cDevice.java   
/**
 * Constructor: Creates an instance of the object.
 *
 * @param instanceName specifies the instance name.
 * @param devAddress specifies the address of the device on the I2C bus.
 */
public FrcI2cDevice(final String instanceName, int devAddress)
{
    this(instanceName, Port.kOnboard, devAddress);
}
项目:CMonster2015    文件:ITG3200.java   
/**
 * Creates a new ITG-3200 on the specified I2C port and digital interrupt
 * port.
 * 
 * @param port the I2C port the gyro is attached to
 * @param interrupt the interrupt port to use
 */
public ITG3200(Port port, DigitalSource interrupt) {
    this(port, interrupt, false);
}