Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions platforms/tab5/main/hal/components/hal_camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/
#include <driver/gpio.h>
#include <fcntl.h>
#include <inttypes.h>
#include <memory>
#include <mooncake_log.h>
#include <stdlib.h>
Expand Down Expand Up @@ -80,6 +81,31 @@ typedef enum
EXAMPLE_VIDEO_FMT_YUV420 = V4L2_PIX_FMT_YUV420,
} example_fmt_t;

static bool set_sensor_control(int fd, uint32_t control_id, int32_t value, const char* control_name)
{
struct v4l2_control control = {};
control.id = control_id;
control.value = value;

if (ioctl(fd, VIDIOC_S_CTRL, &control) == 0)
{
ESP_LOGI(TAG,
"Set %s (0x%08" PRIx32 ") to %" PRId32,
control_name != NULL ? control_name : "control",
control_id,
value);
return true;
}

ESP_LOGW(TAG,
"Failed to set %s (0x%08" PRIx32 ") to %" PRId32 ": %s",
control_name != NULL ? control_name : "control",
control_id,
value,
strerror(errno));
return false;
}

/**
* @brief Open the video device and initialize the video device to use `init_fmt` as the output
* format.
Expand Down
Loading