99#include <zephyr/drivers/gpio.h>
1010#include <zephyr/drivers/i2c.h>
1111#include <zephyr/drivers/video.h>
12+ #include <zephyr/drivers/video-controls.h>
1213#include <zephyr/logging/log.h>
1314
1415LOG_MODULE_REGISTER (video_ov7670 , CONFIG_VIDEO_LOG_LEVEL );
@@ -181,6 +182,8 @@ const struct ov7670_resolution_cfg OV7670_RESOLUTION_VGA = {
181182
182183/* OV7670 definitions */
183184#define OV7670_PROD_ID 0x76
185+ #define OV7670_MVFP_HFLIP 0x20
186+ #define OV7670_MVFP_VFLIP 0x10
184187
185188#define OV7670_VIDEO_FORMAT_CAP (width , height , format ) \
186189 { \
@@ -204,7 +207,7 @@ static const struct video_format_cap fmts[] = {
204207 * Note that this table assumes the camera is fed a 6MHz XCLK signal
205208 */
206209static const struct ov7670_reg ov7670_init_regtbl [] = {
207- {OV7670_MVFP , 0x20 }, /* MVFP: Mirror/VFlip,Normal image */
210+ {OV7670_MVFP , 0x00 }, /* MVFP: Mirror/VFlip,Normal image */
208211
209212 /* configure the output timing */
210213 /* PCLK does not toggle during horizontal blank, one PCLK, one pixel */
@@ -547,10 +550,39 @@ static int ov7670_init(const struct device *dev)
547550 return 0 ;
548551}
549552
553+ static int ov7670_stream_start (const struct device * dev )
554+ {
555+ return 0 ;
556+ }
557+
558+ static int ov7670_stream_stop (const struct device * dev )
559+ {
560+ return 0 ;
561+ }
562+
563+ static int ov7670_set_ctrl (const struct device * dev , unsigned int cid , void * value )
564+ {
565+ const struct ov7670_config * config = dev -> config ;
566+
567+ switch (cid ) {
568+ case VIDEO_CID_HFLIP :
569+ return i2c_reg_update_byte_dt (& config -> bus , OV7670_MVFP ,
570+ OV7670_MVFP_HFLIP , ((int )value ) ? OV7670_MVFP_HFLIP : 0 );
571+ case VIDEO_CID_VFLIP :
572+ return i2c_reg_update_byte_dt (& config -> bus , OV7670_MVFP ,
573+ OV7670_MVFP_VFLIP , ((int )value ) ? OV7670_MVFP_VFLIP : 0 );
574+ default :
575+ return - ENOTSUP ;
576+ }
577+ }
578+
550579static DEVICE_API (video , ov7670_api ) = {
551580 .set_format = ov7670_set_fmt ,
552581 .get_format = ov7670_get_fmt ,
553582 .get_caps = ov7670_get_caps ,
583+ .stream_start = ov7670_stream_start ,
584+ .stream_stop = ov7670_stream_stop ,
585+ .set_ctrl = ov7670_set_ctrl ,
554586};
555587
556588#if DT_ANY_INST_HAS_PROP_STATUS_OKAY (reset_gpios )
0 commit comments