@Test public void writeValueTest16bit() { byte[] expected = new byte[] { (byte) 0x12, (byte) 0x34 }; byte[] actual; RegMap.writeValue(actual = new byte[2], 0x1234L); assertThat(actual, is(expected)); }
@VisibleForTesting static void writeValue(byte[] buff, long value) { for (int i = 0; i < buff.length; i++) { buff[i] = (byte) (value >> ((buff.length - i - 1) * 8)); } }
RegMap { @VisibleForTesting static void writeValue(byte[] buff, long value) { for (int i = 0; i < buff.length; i++) { buff[i] = (byte) (value >> ((buff.length - i - 1) * 8)); } } }
RegMap { @VisibleForTesting static void writeValue(byte[] buff, long value) { for (int i = 0; i < buff.length; i++) { buff[i] = (byte) (value >> ((buff.length - i - 1) * 8)); } } RegMap(int address, int reg_bits, I2cAdapter i2CAdapter); }
RegMap { @VisibleForTesting static void writeValue(byte[] buff, long value) { for (int i = 0; i < buff.length; i++) { buff[i] = (byte) (value >> ((buff.length - i - 1) * 8)); } } RegMap(int address, int reg_bits, I2cAdapter i2CAdapter); void read_regs(long reg, byte[] vals, int offset, int length); int read_reg(long reg); void write_reg(long reg, int val); void bulk_write(long reg, byte[] vals); void bulk_write(long reg, byte[] vals, int len); void update_bits(int reg, int mask, int val); }
RegMap { @VisibleForTesting static void writeValue(byte[] buff, long value) { for (int i = 0; i < buff.length; i++) { buff[i] = (byte) (value >> ((buff.length - i - 1) * 8)); } } RegMap(int address, int reg_bits, I2cAdapter i2CAdapter); void read_regs(long reg, byte[] vals, int offset, int length); int read_reg(long reg); void write_reg(long reg, int val); void bulk_write(long reg, byte[] vals); void bulk_write(long reg, byte[] vals, int len); void update_bits(int reg, int mask, int val);  }