@Test public void setMotorState() throws IOException { final int dcOn = 4096, dcOff = 0; mDriver.setMotorState(0, MotorHat.MOTOR_STATE_CW); verifyPin(9, dcOn, dcOff); verifyPin(10, dcOff, dcOn); mDriver.setMotorState(1, MotorHat.MOTOR_STATE_CCW); verifyPin(12, dcOff, dcOn); verifyPin(11, dcOn, dcOff); mDriver.setMotorState(2, MotorHat.MOTOR_STATE_RELEASE); verifyPin(3, dcOff, dcOn); verifyPin(4, dcOff, dcOn); }
public void setMotorState(int motor, @MotorState int state) throws IOException { if (mI2cDevice == null) { throw new IllegalStateException("I2C device not open"); } mMotors[motor].setState(state); }
MotorHat implements AutoCloseable { public void setMotorState(int motor, @MotorState int state) throws IOException { if (mI2cDevice == null) { throw new IllegalStateException("I2C device not open"); } mMotors[motor].setState(state); } }
MotorHat implements AutoCloseable { public void setMotorState(int motor, @MotorState int state) throws IOException { if (mI2cDevice == null) { throw new IllegalStateException("I2C device not open"); } mMotors[motor].setState(state); } MotorHat(String i2cBusName);  MotorHat(String i2cBusName, int i2cAddress); @VisibleForTesting  MotorHat(I2cDevice device); }
MotorHat implements AutoCloseable { public void setMotorState(int motor, @MotorState int state) throws IOException { if (mI2cDevice == null) { throw new IllegalStateException("I2C device not open"); } mMotors[motor].setState(state); } MotorHat(String i2cBusName);  MotorHat(String i2cBusName, int i2cAddress); @VisibleForTesting  MotorHat(I2cDevice device); @Override void close(); void setMotorSpeed(int motor, int speed); void setMotorState(int motor, @MotorState int state); }
MotorHat implements AutoCloseable { public void setMotorState(int motor, @MotorState int state) throws IOException { if (mI2cDevice == null) { throw new IllegalStateException("I2C device not open"); } mMotors[motor].setState(state); } MotorHat(String i2cBusName);  MotorHat(String i2cBusName, int i2cAddress); @VisibleForTesting  MotorHat(I2cDevice device); @Override void close(); void setMotorSpeed(int motor, int speed); void setMotorState(int motor, @MotorState int state); static final int DEFAULT_I2C_ADDRESS; static final int MOTOR_STATE_RELEASE; static final int MOTOR_STATE_CW; static final int MOTOR_STATE_CCW; }