Tool/software:
I'm working on the OPT4048 Light sensor, for light luminance and CCT values. I'm reading 0x0,0x2,0x04, 0x06 registers and conversion steps I'm following as below
I2C_TransferReturn_TypeDef ret = I2C_transaction(I2C_FLAG_WRITE_READ, OPT4048_I2C_BUS_ADDRESS, ®, 1, data, 3);
if (ret != i2cTransferDone) {
*channels[i] = 0;
return false;
}
uint8_t exponent = (data[0] >> 4) & 0x0F;
uint32_t mantissa = ((data[0] & 0x0F) << 16) | (data[1] << 8) | data[2];
*channels[i] = mantissa * 0.00215f * pow(2, exponent);
I'm receiving light data from channel 0 and using channel 1,2,3 data for CCT calculation.
But the issue I'm facing is that the readings are constant every time, even when the light intensity is changed.
When i restart the device, the correct readings are updated. In the configuration register, I'm using continuous mode, writing to config reg with {0x0A, 0x0C, 0x9F}
Do I need to add more delay or should I use the interrupt pin to get the updated readings?