Closed rneurink closed 4 years ago
Good find! This fixes the getSensorID() issues that I was having.
This error never popped its head up because the vast majority of registers are 0x00FF or lower. There are only two above 0xFF: VL53L1_IDENTIFICATION__MODEL_ID and VL53L1_ROI_CONFIG__MODE_ROI_CENTRE_SPAD.
I've tested this PR against the model ID register and it fixes my read issue. I haven't tested against the ROI Config but I assume it was experiencing similar issues.
(uint8_t) RegisterAddr>>8 is not correct. This casts the Registeraddress to a uint8_t and shifts it to the right by 8 bits. The cast can be removed as it is unnecessary or put parentheses around the shift like this: (uint8_t) (RegisterAddr>>8)