src/vl53l1x.cpp
void Vl53l1x::writeReg16Bit(uint16_t reg, uint16_t value)
{
  uint8_t writeBuffer[4];

  writeBuffer[0] = ((reg >> 8)   & 0xFF);  // reg high byte
  writeBuffer[1] = ( reg         & 0xFF);  // reg low byte
  writeBuffer[2] = ((value >> 8) & 0xFF);  // value high byte
  writeBuffer[3] = ( value       & 0xFF);  // value low byte

  auto result = write(fd, writeBuffer, sizeof(writeBuffer));
  last_status = (result > 0) ? 0 : 1;
}
//Write an 16-bit register
Write an 16-bit register
Write an 16 - bit register
void Vl53l1x::writeReg16Bit(uint16_t reg, uint16_t value)
{
  uint8_t writeBuffer[4];
  writeBuffer[0] = ((reg >> 8)   & 0xFF);  
  writeBuffer[1] = ( reg         & 0xFF);  
  writeBuffer[2] = ((value >> 8) & 0xFF);  
  writeBuffer[3] = ( value       & 0xFF);  
  auto result = write(fd, writeBuffer, sizeof(writeBuffer));
  last_status = (result > 0) ? 0 : 1;
}
void Vl53l1x :: writeReg16Bit ( uint16_t reg , uint16_t value ) { uint8_t writeBuffer [ 4 ] ; writeBuffer [ 0 ] = ( ( reg >> 8 ) & 0xFF ) ; writeBuffer [ 1 ] = ( reg & 0xFF ) ; writeBuffer [ 2 ] = ( ( value >> 8 ) & 0xFF ) ; writeBuffer [ 3 ] = ( value & 0xFF ) ; auto result = write ( fd , writeBuffer , sizeof ( writeBuffer ) ) ; last_status = ( result > 0 ) ? 0 : 1 ; }
Write an 16-bit register
Write an 16 - bit register
// reg high byte // reg low byte // value high byte // value low byte