@Test public void readValueTest16bit() { long expected = 0x1234L; long actual = RegMap.readValue(new byte[] { (byte) 0x12, (byte) 0x34 }); assertThat(actual, is(expected)); }
@VisibleForTesting static long readValue(byte[] buff) { long res = 0; for (int i = 0; i < buff.length; i++) { res |= ((long) (buff[i] & 0xFF)) << ((buff.length - i - 1) * 8); } return res; }
RegMap { @VisibleForTesting static long readValue(byte[] buff) { long res = 0; for (int i = 0; i < buff.length; i++) { res |= ((long) (buff[i] & 0xFF)) << ((buff.length - i - 1) * 8); } return res; } }
RegMap { @VisibleForTesting static long readValue(byte[] buff) { long res = 0; for (int i = 0; i < buff.length; i++) { res |= ((long) (buff[i] & 0xFF)) << ((buff.length - i - 1) * 8); } return res; } RegMap(int address, int reg_bits, I2cAdapter i2CAdapter); }
RegMap { @VisibleForTesting static long readValue(byte[] buff) { long res = 0; for (int i = 0; i < buff.length; i++) { res |= ((long) (buff[i] & 0xFF)) << ((buff.length - i - 1) * 8); } return res; } 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 long readValue(byte[] buff) { long res = 0; for (int i = 0; i < buff.length; i++) { res |= ((long) (buff[i] & 0xFF)) << ((buff.length - i - 1) * 8); } return res; } 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);  }