Browse Source

Ubiquitous/RT_Thread/: add a interface about k210 dvp image setting.

pull/8/head
chunyexixiaoyu 11 months ago
parent
commit
6ad0b192e8
  1. 3
      Ubiquitous/RT_Thread/bsp/k210/base-drivers/drv_dvp.c
  2. 17
      Ubiquitous/RT_Thread/drivers/ov2640/ov2640_source/drv_ov2640.c
  3. 14
      Ubiquitous/RT_Thread/drivers/ov2640/ov2640_source/drv_ov2640.h

3
Ubiquitous/RT_Thread/bsp/k210/base-drivers/drv_dvp.c

@ -67,8 +67,7 @@ static rt_err_t rt_dvp_init(rt_device_t dev)
dvp_set_output_enable(0, 1);
dvp_set_output_enable(1, 1);
dvp_set_image_format(DVP_CFG_RGB_FORMAT);////////////////
// dvp_set_image_size(320, 240);
dvp_set_image_size(256, 256);
dvp_set_image_size(320, 240); // default
dvp_config_interrupt(DVP_CFG_FINISH_INT_ENABLE, 0);
dvp_disable_auto();
plic_set_priority(IRQN_DVP_INTERRUPT, 1);

17
Ubiquitous/RT_Thread/drivers/ov2640/ov2640_source/drv_ov2640.c

@ -1467,20 +1467,31 @@ static rt_err_t rt_ov2640_control(rt_device_t dev, int cmd, void *args)
{
RT_ASSERT(dev != RT_NULL);
rt_err_t ret = RT_EOK;
if(cmd < IOCTRL_CAMERA_START_SHOT || cmd > IOCTRL_CAMERA_SET_EXPOSURE)
if(cmd < IOCTRL_CAMERA_SET_DVP_RESO || cmd > IOCTRL_CAMERA_SET_EXPOSURE)
{
LOG_E("CMD value should be 22 ~29");
return RT_ERROR;
}
}
int value = 0;
_ioctl_shoot_para shoot_para = {0};
#ifdef BOARD_K210_EVB
_ioctl_set_dvp_reso set_dvp_reso = {0};
#endif
if(IOCTRL_CAMERA_START_SHOT == cmd)
{
shoot_para = *((_ioctl_shoot_para*)args);
ret = rt_ov2640_start_shoot(shoot_para.pdata,shoot_para.length);
return ret;
}
#ifdef BOARD_K210_EVB
else if(IOCTRL_CAMERA_SET_DVP_RESO == cmd)
{
set_dvp_reso =*((_ioctl_set_dvp_reso*)args);
dvp_set_image_size(set_dvp_reso.width, set_dvp_reso.height);
return RT_EOK;
}
#endif
else
{
value = *((int*)args);

14
Ubiquitous/RT_Thread/drivers/ov2640/ov2640_source/drv_ov2640.h

@ -123,9 +123,9 @@ extern "C" {
#define OV2640_SENSOR_HISTO_LOW 0x61
#define OV2640_SENSOR_HISTO_HIGH 0x62
#ifdef BOARD_K210_EVB
#define IOCTRL_CAMERA_SET_DVP_RESO (21) // set dev resolution
#endif
#define IOCTRL_CAMERA_START_SHOT (22) // start shoot
#define IOCTRL_CAMERA_SET_RESO (23) //set resolution
@ -136,6 +136,14 @@ extern "C" {
#define IOCTRL_CAMERA_SET_EFFECT (28) //set effect
#define IOCTRL_CAMERA_SET_EXPOSURE (29) //set auto exposure
#ifdef BOARD_K210_EVB
typedef struct
{
uint32_t width; // width The width of image
uint32_t height; // height The height of image
}_ioctl_set_dvp_reso;
#endif
struct camera_device
{

Loading…
Cancel
Save