UVC_CAMERA APIs

[中文]

Important

The UVC_CAMERA API v1.0 is the lastest stable UVC_CAMERA APIs. All new applications should use UVC_CAMERA API v1.0.

UVC_CAMERA Interface

UVC camera only support full speed type

UVC_CAMERA API Categories

Most of UVC_CAMERA APIs can be categoried as:

  • UVC_CAMERA APIs

    The common APIs are prefixed with bk_uvc, e.g. bk_uvc_init() etc.

UVC_CAMERA APIs:

API Reference

Header File

Functions

bk_err_t bk_uvc_camera_driver_init(uvc_camera_config_t *config)

Init the uvc.

This API init psram, dma, uvc param, and open uvc

Parameters

data – configure for camera

Returns

  • kNoErr: succeed

  • others: other errors.

bk_err_t bk_uvc_camera_driver_deinit(void)

Deinit the uvc.

This API deinit dma and close uvc

@attation: called after bk_uvc_camera_driver_init

Returns

  • kNoErr: succeed

  • others: other errors.

bk_err_t bk_uvc_camera_power_enable(uint8_t enable, uint8_t active_level)

uvc power on

This API called by user, before calling bk_uvc_camera_driver_init, you should power on uvc

@attation 1. This api config different gpio and different active level

Parameters
  • enable – power up/down:1/0

  • enable – 1:high power leve for power up; 0 low power lever for power up

Returns

  • kNoErr: succeed

  • others: other errors.

bk_err_t bk_uvc_camera_get_config(uvc_camera_device_t *param, uint16_t count)

Get uvc config.

This API called by user, get uvc support fps and resolutions

Parameters
  • param – the memory user malloc for save uvc support config

  • count – the param1 malloc size, the count config of uvc support

Returns

  • BK_OK: succeed

  • others: other errors.

bk_err_t bk_uvc_camera_start(void)

Set uvc config.

This API called by user, Set uvc support fps and resolutions

Set uvc start

This API called by user, Set uvc start transfer

@attation 1. this api called must after uvc have been init and have stopped

Parameters
  • mode – the uvc work type, reference media_camera_type_t

  • config – the uvc need support param the user set

Returns

  • kNoErr: succeed

  • others: other errors.

Returns

  • kNoErr: succeed

  • others: other errors.

bk_err_t bk_uvc_camera_stop(void)

Stop uvc start.

This API called by user, Set uvc stop transfer

@attation 1. this api called must after uvc have been init and have start

Returns

  • kNoErr: succeed

  • others: other errors.

media_camera_device_t *bk_uvc_camera_get_device(void)

Get current uvc device.

This API called by user, get currnet uvc device in working

@attation 1. if no uvc work, the return will be NULL

Returns

  • uvc_camera_device_t *: current working uvc device ptr

  • NULL: no uvc device working

bk_err_t bk_uvc_camera_register_info_callback(uvc_device_info_t cb)

register callback notify uvc device info

This API called by user, before uvc start work

@attation 1. this function will be called when uvc connect success, if you register

Returns

  • BK_OK: succeed

  • others: other errors.

bk_err_t bk_uvc_camera_set_config(bk_uvc_config_t *config)

set uvc params

This API called by user, after uvc bk_uvc_camera_driver_init, if you called bk_uvc_camera_register_info_callback

@attation 1. this function need user to call, when register info callback, need set config reference struct bk_uvc_config_t

@attation 2. this function will use config param to start uvc

Returns

  • BK_OK: succeed

  • others: other errors.

int bk_uvc_camera_jpeg_frame_check_eof(uint8_t *data, uint32_t length)

check input frame length

This API called by user, check frame valied length, check eof(0xffd9), some frame after ffd9 have invailed data

@attation, the check length control by marco CONFIG_JPEG_FRAME_CHECK_LENGTH, default value 1024

Parameters
  • 1. – The frame start address

  • 2. – the frame total length

Returns

  • length: actual data length

  • others: cannot find 0xffd9, this frame have error

API Typedefs