当前位置: 首页>>代码示例>>Java>>正文


Java SPI.setChipSelectActiveLow方法代码示例

本文整理汇总了Java中edu.wpi.first.wpilibj.SPI.setChipSelectActiveLow方法的典型用法代码示例。如果您正苦于以下问题:Java SPI.setChipSelectActiveLow方法的具体用法?Java SPI.setChipSelectActiveLow怎么用?Java SPI.setChipSelectActiveLow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在edu.wpi.first.wpilibj.SPI的用法示例。


在下文中一共展示了SPI.setChipSelectActiveLow方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ADXRS453_Gyro

import edu.wpi.first.wpilibj.SPI; //导入方法依赖的package包/类
/**
 * Constructor.
 *
 * @param port
 *            (the SPI port that the gyro is connected to)
 */
public ADXRS453_Gyro(SPI.Port port) {
    m_spi = new SPI(port);
    m_spi.setClockRate(3000000);
    m_spi.setMSBFirst();
    m_spi.setSampleDataOnRising();
    m_spi.setClockActiveHigh();
    m_spi.setChipSelectActiveLow();

    /** Validate the part ID */
    if ((readRegister(kPIDRegister) & 0xff00) != 0x5200) {
        m_spi.free();
        m_spi = null;
        DriverStation.reportError("Could not find ADXRS453 gyro on SPI port " + port.value, false);
        return;
    }

    m_spi.initAccumulator(kSamplePeriod, 0x20000000, 4, 0x0c00000E, 0x04000000, 10, 16, true, true);

    calibrate();

    LiveWindow.addSensor("ADXRS453_Gyro", port.value, this);
}
 
开发者ID:team8,项目名称:FRC-2017-Public,代码行数:29,代码来源:ADXRS453_Gyro.java

示例2: ADXRS453_Gyro

import edu.wpi.first.wpilibj.SPI; //导入方法依赖的package包/类
/**
 * Constructor.
 *
 * @param port
 *            (the SPI port that the gyro is connected to)
 */
public ADXRS453_Gyro(SPI.Port port) {
    m_spi = new SPI(port);
    m_spi.setClockRate(3000000);
    m_spi.setMSBFirst();
    m_spi.setSampleDataOnRising();
    m_spi.setClockActiveHigh();
    m_spi.setChipSelectActiveLow();

    /** Validate the part ID */
    if ((readRegister(kPIDRegister) & 0xff00) != 0x5200) {
        m_spi.free();
        m_spi = null;
        DriverStation.reportError("Could not find ADXRS453 gyro on SPI port " + port.name(), false);
        return;
    }

    m_spi.initAccumulator(kSamplePeriod, 0x20000000, 4, 0x0c00000E, 0x04000000, 10, 16, true, true);

    calibrate();


}
 
开发者ID:RobotCasserole1736,项目名称:CasseroleLib,代码行数:29,代码来源:ADXRS453_Gyro.java

示例3: ADIS16448_IMU

import edu.wpi.first.wpilibj.SPI; //导入方法依赖的package包/类
/**
 * Constructor.
 */
public ADIS16448_IMU() {
  m_spi = new SPI(SPI.Port.kMXP);
  m_spi.setClockRate(1000000);
  m_spi.setMSBFirst();
  m_spi.setSampleDataOnFalling();
  m_spi.setClockActiveLow();
  m_spi.setChipSelectActiveLow();

  readRegister(kRegPROD_ID); // dummy read
  
  // Validate the part ID
  if (readRegister(kRegPROD_ID) != 16448) {
    m_spi.free();
    m_spi = null;
    DriverStation.reportError("IMU is NOT Responding!!! Cannot Initalize!", false);
    return;
  }

  // Set IMU internal decimation to 102.4 SPS
  writeRegister(kRegSMPL_PRD, 769);

  // Enable Data Ready (LOW = Good Data) on DIO1 (PWM0 on MXP)
  writeRegister(kRegMSC_CTRL, 4);

  // Configure IMU internal Bartlett filter
  writeRegister(kRegSENS_AVG, 1030);

  m_cmd = ByteBuffer.allocateDirect(26);
  m_cmd.put(0, (byte) kGLOB_CMD);
  m_cmd.put(1, (byte) 0);
  m_resp = ByteBuffer.allocateDirect(26);
  m_resp.order(ByteOrder.BIG_ENDIAN);

  // Configure interrupt on MXP DIO0
  m_interrupt = new DigitalInput(10);  // MXP DIO0
  m_task = new Thread(new ReadTask(this));
  m_interrupt.requestInterrupts();
  m_interrupt.setUpSourceEdge(false, true);
  m_task.setDaemon(true);
  m_task.start();

  calibrate();
}
 
开发者ID:RobotCasserole1736,项目名称:CasseroleLib,代码行数:47,代码来源:ADIS16448_IMU.java

示例4: ADIS16448_IMU

import edu.wpi.first.wpilibj.SPI; //导入方法依赖的package包/类
/**
 * Constructor.
 */
public ADIS16448_IMU() {
  m_spi = new SPI(SPI.Port.kMXP);
  m_spi.setClockRate(1000000);
  m_spi.setMSBFirst();
  m_spi.setSampleDataOnFalling();
  m_spi.setClockActiveLow();
  m_spi.setChipSelectActiveLow();

  System.out.println("ADIS16448_IMU.java");
  readRegister(kRegPROD_ID); // dummy read
  
  // Validate the part ID
  if (readRegister(kRegPROD_ID) != 16448) {
    m_spi.free();
    m_spi = null;
    DriverStation.reportError("could not find ADIS16448", false);
    return;
  }

  // Set IMU internal decimation to 102.4 SPS
  writeRegister(kRegSMPL_PRD, 769);

  // Enable Data Ready (LOW = Good Data) on DIO1 (PWM0 on MXP)
  writeRegister(kRegMSC_CTRL, 4);

  // Configure IMU internal Bartlett filter
  writeRegister(kRegSENS_AVG, 1030);

  m_cmd = ByteBuffer.allocateDirect(26);
  m_cmd.put(0, (byte) kGLOB_CMD);
  m_cmd.put(1, (byte) 0);
  m_resp = ByteBuffer.allocateDirect(26);
  m_resp.order(ByteOrder.BIG_ENDIAN);

  // Configure interrupt on MXP DIO0
  m_interrupt = new InterruptSource(10);  // MXP DIO0
  m_task = new Thread(new ReadTask(this));
  m_interrupt.requestInterrupts();
  m_interrupt.setUpSourceEdge(false, true);
  m_task.setDaemon(true);
  m_task.start();

  calibrate();

  //UsageReporting.report(tResourceType.kResourceType_ADIS16448, 0);
  LiveWindow.addSensor("ADIS16448_IMU", 0, this);
}
 
开发者ID:mtmustski,项目名称:FRC-Robotics-2016-Team-2262,代码行数:51,代码来源:ADIS16448_IMU.java


注:本文中的edu.wpi.first.wpilibj.SPI.setChipSelectActiveLow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。