3.1 Calculation of Configuration Parameters
Value1 has an expected range from -5 to 15. Value1 is stored as a signed 5-bit value in address location 0x0004.
uint8 value1 = indirect_read(0x04,0x1F)
int8 offset1
if((value1 & 0x10) != 0)
{
offset1 = (int8) ((uint8)value1 - 0x20)
}
else
{
offset1 = (int8) value1
}
Value2 is stored as a signed 5-bit value in address location 0x0008.
uint8 value2 = indirect_read(0x08,0x1F)
int8 offset2
if((value2 & 0x10) != 0)
{
offset2 = (int8) ((uint8)value2 - 0x20)
}
else
{
offset2 = (int8) value2
}
The following parameters must be calculated from the device configuration parameters mentioned above to use for the configuration of the registers.
uint16 cfgparam1 = (uint16) (((9 + offset1) & 0x3F) << 10) | (uint16) (((14 + offset1) & 0x3F) << 4) | 0x03
uint16 cfgparam2 = (uint16) (((40 + offset2) & 0x3F) << 10)
