mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-02 02:51:42 +00:00
[hal,wpilib] Add support for second I2C port (#7878)
This commit is contained in:
@@ -20,10 +20,10 @@ import java.nio.ByteBuffer;
|
||||
public class I2C implements AutoCloseable {
|
||||
/** I2C connection ports. */
|
||||
public enum Port {
|
||||
/** Onboard I2C port. */
|
||||
kOnboard(0),
|
||||
/** MXP (roboRIO MXP) I2C port. */
|
||||
kMXP(1);
|
||||
/** I2C Port 0. */
|
||||
kPort0(0),
|
||||
/** I2C Port 1. */
|
||||
kPort1(1);
|
||||
|
||||
/** Port value. */
|
||||
public final int value;
|
||||
|
||||
@@ -18,7 +18,7 @@ class ADXL345SimTest {
|
||||
void testInitI2C(ADXL345_I2C.Range range) {
|
||||
HAL.initialize(500, 0);
|
||||
|
||||
try (ADXL345_I2C accel = new ADXL345_I2C(I2C.Port.kMXP, range)) {
|
||||
try (ADXL345_I2C accel = new ADXL345_I2C(I2C.Port.kPort0, range)) {
|
||||
ADXL345Sim sim = new ADXL345Sim(accel);
|
||||
|
||||
sim.setX(1.91);
|
||||
|
||||
Reference in New Issue
Block a user