@Test public void writeSegments() throws IOException { Ht16k33 driver = new Ht16k33(mI2c); short[] segments = { Ht16k33.SEGMENT_TOP, Ht16k33.SEGMENT_RIGHT_TOP, Ht16k33.SEGMENT_RIGHT_BOTTOM, Ht16k33.SEGMENT_BOTTOM, Ht16k33.SEGMENT_LEFT_BOTTOM, Ht16k33.SEGMENT_LEFT_TOP, Ht16k33.SEGMENT_CENTER_LEFT, Ht16k33.SEGMENT_CENTER_RIGHT, Ht16k33.SEGMENT_DIAGONAL_LEFT_TOP, Ht16k33.SEGMENT_CENTER_TOP, Ht16k33.SEGMENT_DIAGONAL_RIGHT_TOP, Ht16k33.SEGMENT_DIAGONAL_LEFT_BOTTOM, Ht16k33.SEGMENT_CENTER_BOTTOM, Ht16k33.SEGMENT_DIAGONAL_RIGHT_BOTTOM, Ht16k33.SEGMENT_DOT }; for (final short s: segments) { driver.writeColumn(0, s); Mockito.verify(mI2c, times(1)).writeRegWord(0, s); } final short SIGMA = Ht16k33.SEGMENT_TOP | Ht16k33.SEGMENT_BOTTOM | Ht16k33.SEGMENT_DIAGONAL_LEFT_TOP | Ht16k33.SEGMENT_DIAGONAL_LEFT_BOTTOM; driver.writeColumn(0, SIGMA); Mockito.verify(mI2c, times(1)).writeRegWord(0, SIGMA); }
public void writeColumn(int column, short data) throws IOException { if (mDevice == null) { throw new IllegalStateException("I2C device not opened"); } mDevice.writeRegWord(column * 2, data); }
Ht16k33 implements AutoCloseable { public void writeColumn(int column, short data) throws IOException { if (mDevice == null) { throw new IllegalStateException("I2C device not opened"); } mDevice.writeRegWord(column * 2, data); } }
Ht16k33 implements AutoCloseable { public void writeColumn(int column, short data) throws IOException { if (mDevice == null) { throw new IllegalStateException("I2C device not opened"); } mDevice.writeRegWord(column * 2, data); } Ht16k33(String bus);  Ht16k33(String bus, int i2cAddress); @VisibleForTesting  Ht16k33(I2cDevice device); }
Ht16k33 implements AutoCloseable { public void writeColumn(int column, short data) throws IOException { if (mDevice == null) { throw new IllegalStateException("I2C device not opened"); } mDevice.writeRegWord(column * 2, data); } Ht16k33(String bus);  Ht16k33(String bus, int i2cAddress); @VisibleForTesting  Ht16k33(I2cDevice device); @Override void close(); void setEnabled(boolean enabled); void setBrightness(int value); void setBrightness(float value); void writeColumn(int column, short data); }
Ht16k33 implements AutoCloseable { public void writeColumn(int column, short data) throws IOException { if (mDevice == null) { throw new IllegalStateException("I2C device not opened"); } mDevice.writeRegWord(column * 2, data); } Ht16k33(String bus);  Ht16k33(String bus, int i2cAddress); @VisibleForTesting  Ht16k33(I2cDevice device); @Override void close(); void setEnabled(boolean enabled); void setBrightness(int value); void setBrightness(float value); void writeColumn(int column, short data); static final int I2C_ADDRESS; static final int HT16K33_BRIGHTNESS_MAX; static final short SEGMENT_TOP; static final short SEGMENT_RIGHT_TOP; static final short SEGMENT_RIGHT_BOTTOM; static final short SEGMENT_BOTTOM; static final short SEGMENT_LEFT_BOTTOM; static final short SEGMENT_LEFT_TOP; static final short SEGMENT_CENTER_LEFT; static final short SEGMENT_CENTER_RIGHT; static final short SEGMENT_DIAGONAL_LEFT_TOP; static final short SEGMENT_CENTER_TOP; static final short SEGMENT_DIAGONAL_RIGHT_TOP; static final short SEGMENT_DIAGONAL_LEFT_BOTTOM; static final short SEGMENT_CENTER_BOTTOM; static final short SEGMENT_DIAGONAL_RIGHT_BOTTOM; static final short SEGMENT_DOT; }