User Manual

- 7 -
HPS3D_HandleTypeDef handle;
RET_StatusTypeDef ret =
RET_OK
;
ret = HPS3D_Connect(&handle);
if
(
RET_OK
!= ret)
{
printf
("Connect Failedret = %d\n",ret);
break
;
}
3. call the initialization configuration function, before this step, you need to perform step 2, using
the handle->DeviceFd device file descriptor obtained in step 2, after calling this function will
initialize the device configuration, the default configuration is standby mode and asynchronous
communication mode, And create an asynchronous communication thread; get the
handle->DeviceAddr device address, handle->RoiNumber device support ROI number,
handle->ThresholdNumber device ROI area support threshold number, handle->opticalEnable
optical enable parameter (for 3D Point cloud space coordinate transformation), and dynamically
allocate space for MeasureData. Sample code:
/*Device initialization*/
ret = HPS3D_ConfigInit(&handle);
if
(
RET_OK
!= ret)
{
printf("Initialization failed! error code is:%d\n", ret);
break
;
}
printf("Initialization succeed!\n");
Note
(1) Step 2: The handle->DeviceFd device file descriptor returned by the device function and the
handle->DeviceAddr device address returned by the initialization function in step 3 are used in all
command function interfaces.
(2) Be sure to check the return value of the initialization function and determine whether the
initialization is successful based on the return value. Most of the SDK's APIs provide operational
state return. It is recommended that users check the return value of each API to ensure reliability.
4. According to the user's need to call other command function interface, configure the camera,
and set the running mode after the configuration is completed. After being configured as a
continuous measurement command, the command return value of the set operation mode may
not be detected. In this case, the return value of the function can be ignored; sample code:
/*Set to continuous measurement mode*/
handle.RunMode =
RUN_CONTINUOUS
;
HPS3D_SetRunMode(&handle);
Note
(1) When all command function interfaces are configured, a stop measurement command will be
sent. Therefore, in the continuous measurement process, after calling the command function
interface, you need to reset the operation mode.
(2) In the operation mode configuration, three modes can be selected:
RUN_IDLE: Idle mode, in which the camera enters standby mode.