throwCLidarLiteException(_HERE_,"CORRELATION between measurements cannot be obtained because the device is not running.");
if(numberOfReadings<2||numberOfReadings>1024)
throwCLidarLiteException(_HERE_,"CORRELATION between measurements cannot be obtained. Incorrect selecetd NUMBER OF READINGS, which must be between [2~1024].");
// Object to return
std::vector<int>correlationValues;
correlationValues.resize(numberOfReadings);
// Select memory bank
write(ACQ_SETTINGS,0xc0);
// Test mode enable
write(COMMAND,0x07);
for(intii=0;ii<numberOfReadings;ii++)
{
// Read two bytes from 0xd2
unsignedcharaddr=addr_to_read_2bytes(CORR_DATA);// See header file for a description of this functionality.
unsignedchardata[2];
try{
this->adapter_->write(DEVICE_ID,&addr,1);
this->adapter_->read(DEVICE_ID,data,2);
}
catch(CException&e)
{
throwCLidarLiteException(_HERE_,e.what());
}
// Low byte is the value of the correlation record
correlationValues.at(ii)=(int)data[0];
// High byte is the sign from the record. If upper byte lsb is set, the value is negative.