sensor register addresses

I am trying to make the transition from using existing libraries to understanding how sensors and registers work so I can get more out of them. At the moment I am playing with a LIS2DH12 accelerometer breakout and using a library from dfrobot (I have attached the data sheet register mapping and the library code). When I compare the addresses in the data sheet to the addresses in the library they seem to be offset by 0x80 and I can’t work out why. For example according to the data sheet there are six control registers with addresses from 0x20 to 0x25 but the library uses an addresses starting at 0xA0. The relevant code for setting the control registers is:

  uint8_t ctrl_reg_values[] = {0x2F, 0x00, 0x00, range, 0x00, 0x00};
  ret = (int8_t)writeReg(0xA0, ctrl_reg_values, sizeof(ctrl_reg_values));
uint8_t DFRobot_LIS2DH12::writeReg(uint8_t regAddress, uint8_t *regValue, size_t quanity, bool autoIncrement)
{   
  Wire.beginTransmission(sensorAddress);
  if(autoIncrement) {
    Wire.write(regAddress);
    Wire.write(regValue, quanity);
  }
  else {
    for(size_t i = 0; i < quanity; i++){
      Wire.write(regAddress+i);
      Wire.write(regValue[i]);
      if( i<(quanity-1) ){
        Wire.endTransmission(false);
        Wire.beginTransmission(sensorAddress);
      }
    }
  }
  return Wire.endTransmission(true);
}

Similarly the data sheet has six output registers with addresses ranging from 0x28 to 0x2D but the library code for reading is:

readReg(0xA8, sensorData, 6);

So what I want to know is where would I find the info to work out to offset the addresses by this amount?

DFRobot_LIS2DH12.cpp (3.5 KB)

DFRobot_LIS2DH12.h (1.5 KB)

LIS2DH12 register mapping.pdf (44.4 KB)

You probably have the wrong datasheet. Are you sure you have the datasheet from the correct chip manufacturer?

The pin layout of the actual chips usually conform to agreed standards among manufacturers but I am not aware (although not extensively experienced) of them necessarily complying with standards as to register addresses.

I just checked the most recent datasheet from the accelerometer chip manufacturer and the addresses are the same. Is it possible that the company that made the sensor did something? added components? i dont really know what i am talking about? that made the address changes necessary and just haven't documented it? For example the sensor wiki says the sensor has " on-board I2C level conversion" whatever that means. I know I can make this work just by offsetting the addresses by 0x80 but really I am trying to learn and understand how to read the documentation.

The sensor is a Gravity: I2C Triple Axis Accelerometer - LIS2DH SKU:SEN0224 and the wiki is
Gravity_-DFRobotI2C_Triple_Axis_Accelerometer-_LIS2DH_SKU:SEN0224

Solved. The clue was in the fact that the addresses were offset by 0x80 i.e. the most significant bit (MSB) in an 8 bit address. It turns out that the 7 least significant bits are the actual address and the MSB turns autoincrement on for reading and writing. How do I mark this issue as solved to help others that might face similar problems?