Sensor Library API References

This section lists sensor APIs

SDK Management API

The STFLIB_ISP_SENSOR_* APIs handle sensor discovery and lifecycle at the SDK management layer. The libSensorapi.a and libISPC.a files are required for using the following API.
Table 1. STFLIB_ISP_SENSOR_GetSensorId
Synopsis
STFLIB_ISP_SENSOR_GetSensorId(
    const STF_CHAR *pszSensorName
    );
Description Gets the sensor ID by the sensor name.
Parameter
  • pszSensorName: The sensor name
Return STF_S8: Positive identifier if the sensor is found or negative number otherwise
Table 2. STFLIB_ISP_SENSOR_StructInitialize
Synopsis
STFLIB_ISP_SENSOR_StructInitialize(
    ST_SENSOR *pstSensor,
    STF_U8 u8SensorId,
        );
Description Initializes a ST_SENSOR structure.
Parameter
  • pstSensor: The sensor handle
  • u8SensorId: The sensor ID
Return
  • Success: 0
  • Failure: Other values
Table 3. STFLIB_ISP_SENSOR_StructUninitialize
Synopsis
STFLIB_ISP_SENSOR_StructUninitialize(
    ST_SENSOR *pstSensor,
    );
Description De-initializes a ST_SENSOR structure.
Parameter
  • pstSensor: The sensor handle
Return
  • Success: 0
  • Failure: Other values

SENSOR_FUNCS Implementation API

Table 4. GetModeIdx
Synopsis
GetModeIdx(
    SENSOR_HANDLE *pstHandle,
    STF_U16 u16Width,
    STF_U16 u16Height
    );
Description Gets the sensor mode index.
Parameter
  • pstHandle: The sensor handle
  • u16Width: Image width
  • u16Height: Image height
Return Sensor mode index
Table 5. GetMode
Synopsis
GetMode(
    SENSOR_HANDLE *pstHandle,
    STF_U8 u8ModeIdx,
    SENSOR_MODE *pstModes
    );
Description Gets the sensor mode index.
Parameter
  • pstHandle: The sensor handle
  • u8ModeIdx: Sensor mode index
  • pstModes: Sensor mode information
Return
  • Success: 0
  • Failure: Other values
Table 6. GetState
Synopsis
GetState(
    SENSOR_HANDLE *pstHandle,
    SENSOR_STATUS *pstStatus
    );
Description Gets the current state of the sensor.
Parameter
  • pstHandle: The sensor handle
  • pstStatus: Sensor state
Return
  • Success: 0
  • Failure: Other values
Table 7. GetInterfaceInfo
Synopsis
GetInterfaceInfo(
    SENSOR_HANDLE *pstHandle,
    SENSOR_INTFC *pstInterface
    );
Description Gets the sensor's connection data bus and I2C hardware information.
Parameter
  • pstHandle: The sensor handle
  • pstInterface: Sensor interface handle
Return
  • Success: 0
  • Failure: Other values
Table 8. SetMode
Synopsis
SetMode(
    SENSOR_HANDLE *pstHandle,
    STF_U8 u8ModeIdx,
    STF_U8 u8Flipping
    );
Description Sets the sensor mode.
Parameter
  • pstHandle: The sensor handle
  • u8ModeIdx: Sensor mode index
  • u8Flipping: Flip and mirror information
Return
  • Success: 0
  • Failure: Other values
Table 9. Enable
Synopsis
Enable(
    SENSOR_HANDLE *pstHandle
    );
Description Enables the sensor
Parameter
  • pstHandle: The sensor handle
Return
  • Success: 0
  • Failure: Other values
Table 10. Disable
Synopsis
Disable(
    SENSOR_HANDLE *pstHandle
    );
Description Disables the sensor
Parameter
  • pstHandle: The sensor handle
Return
  • Success: 0
  • Failure: Other values
Table 11. Destroy
Synopsis
Destroy(
    SENSOR_HANDLE *pstHandle
    );
Description Releases and de-initializes the sensor.
Parameter
  • pstHandle: The sensor handle
Return
  • Success: 0
  • Failure: Other values
Table 12. GetInfo
Synopsis
GetInfo(
    SENSOR_HANDLE *pstHandle,
    SENSOR_INFO *pstInfo
    );
Description Gets the information of the sensor.
Parameter
  • pstHandle: The sensor handle
  • pstInfo: Sensor information handle
Return
  • Success: 0
  • Failure: Other values
Table 13. GetRegister
Synopsis
GetRegister(
    SENSOR_HANDLE *pstHandle,
    STF_U16 u16RegAddr,
    STF_U16 *pu16RegVal,
       );
Description Reads the sensor register value.
Parameter
  • pstHandle: The sensor handle
  • u16RegAddr: Register address
  • pu16RegVal: Reads back value from the sensor
Return
  • Success: 0
  • Failure: Other values
Table 14. SetRegister
Synopsis
SetRegister(
    SENSOR_HANDLE *pstHandle,
    STF_U16 u16RegAddr,
    STF_U16 u16RegVal,
       );
Description Sets the sensor register value.
Parameter
  • pstHandle: The sensor handle
  • u16RegAddr: Register address
  • u16RegVal: Register value
Return
  • Success: 0
  • Failure: Other values
Table 15. SetGain
Synopsis
SetGain(
    SENSOR_HANDLE *pstHandle,
    STF_DOUBLE dGain
       );
Description Sets the current gain to the sensor.
Parameter
  • pstHandle: The sensor handle
  • dGain: Gain value
Return
  • Success: 0
  • Failure: Other values
Table 16. GetExposureRange
Synopsis
GetExposureRange(
    SENSOR_HANDLE *pstHandle,
    STF_U32 *pu32Min,
    STF_U32 *pu32Max
    );
Description Gets the range of exposures the sensor can use.
Parameter
  • pstHandle: The sensor handle
  • pu32Min: Minimum exposure time value
  • pu32Max: Maximum exposure time value
Return
  • Success: 0
  • Failure: Other values
Table 17. GetExposure
Synopsis
GetExposure(
    SENSOR_HANDLE *pstHandle,
    STF_U32 *pu32Exposure
    );
Description Queries the sensor for the current exposure period.
Parameter
  • pstHandle: The sensor handle
  • pu32Exposure: Exposure time value
Return
  • Success: 0
  • Failure: Other values
Table 18. SetExposure
Synopsis
SetExposure(
    SENSOR_HANDLE *pstHandle,
    STF_U32 *pu32Exposure
    );
Description Sets the sensor to the requested exposure period.
Parameter
  • pstHandle: The sensor handle
  • pu32Exposure: Exposure time value
Return
  • Success: 0
  • Failure: Other values
Table 19. SetFlipMirror
Synopsis
SetFlipMirror(
    SENSOR_HANDLE *pstHandle,
    STF_U8 u8Flag
    );
Description Sets flip and mirror value in the sensor.
Parameter
  • pstHandle: The sensor handle
  • u8Flag: Flip and mirror status
Return
  • Success: 0
  • Failure: Other values
Table 20. GetFixedFPS
Synopsis
GetFixedFPS(
    SENSOR_HANDLE *pstHandle,
    STF_U16 *pu16FixedFps
    );
Description Gets the fixed FPS value in the sensor.
Parameter
  • pstHandle: The sensor handle
  • pu16FixedFps: Fixed FPS value
Return
  • Success: 0
  • Failure: Other values
Table 21. SetFPS
Synopsis
SetFPS(
    SENSOR_HANDLE *pstHandle,
    STF_DOUBLE dFps
    );
Description Sets the FPS value in the sensor.
Parameter
  • pstHandle: The sensor handle
  • dFps: FPS value
Return
  • Success: 0
  • Failure: Other values
Table 22. SetExposureAndGain
Synopsis
SetExposureAndGain(
    SENSOR_HANDLE *pstHandle,
    STF_U32 u32Exposure,
    STF_DOUBLE dGain
    );
Description Programx the exposure time and gain in the sensor.
Parameter
  • pstHandle: The sensor handle
  • u32Exposure: Exposure time
  • dGain: Gain value
Return
  • Success: 0
  • Failure: Other values
Table 23. Reset
Synopsis
Reset(
    SENSOR_HANDLE *pstHandle
    );
Description Resets the sensor
Parameter
  • pstHandle: The sensor handle
Return
  • Success: 0
  • Failure: Other values