微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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);
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。