Performs some initial checking based on the security level. If the checks fail, the function returns without attempting to fetch calibration values. The reason for the checking is that the Si114x uses the same registers to store calibration values as used for storing proximity and ambient light measurements. Therefore, this function needs to be used only if there is no possibility of an autonomous process possibly overwriting the output registers.

If the checks are successful, then the si114x retrieves the compressed values from the Si114x, then populates the SI114X_CAL_S structure whose pointer is passed to si114x_calibration()

If there are any errors, si114x_cal is populated with default values

Parameters

[in]

si114x_handle

The programmer's toolkit handle

[out]

si114x_cal

Points to the SI114X_CAL_S structure that will hold the calibration values from the Si114x. If there are any errors, si114x_cal is populated with default values.

[in]

security

0 Minimal checking

1 Checks to make sure that interface registers are zero, otherwise, returns -1 interface registers are zero only when the Si114x has been reset, and no autonomous measurements have started.

Takes in an optional input ucoef pointer, then modifies it based on calibration. If the input ucoef is NULL, default values for clear overlay is assumed and then the si114x_cal is used to adjust it before setting the ucoef. Note that the Si114x ucoef registers are updated by this function; no additional action is required. This routine also performs the necessary querying of the chip identification to make sure that it is a uvindex-capable device.

Parameters

[in]

si114x_handle

The programmer's toolkit handle

[in]

input_ucoef

if NULL, a clear overlay is assumed, and datasheet values for ucoef is used. Otherwise, pointer to 4 bytes array representing the reference coefficients is passed.

[in]

si114x_cal

Points to the SI114X_CAL_S structure that holds the calibration values from the Si113x/4x

This function ensures that the Si113x/4x is idle and ready to receive a command before writing the parameter. Furthermore, command completion is checked. If setting parameter is not done properly, no measurements will occur. This is the most common error. It is highly recommended that host code make use of this function.