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

This commit is contained in:
chunyexixiaoyu 2021-08-13 14:29:35 +08:00
parent a3d753153c
commit 6ad0b192e8
3 changed files with 26 additions and 8 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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
{