Skip to content

isp_wrapper: few minor improvements & allow repeated start / stop #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
14 changes: 3 additions & 11 deletions isp_wrapper/src/isp_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,11 @@
#include "imx335_isp_param_conf.h"
#include "zephyr/drivers/video-controls.h"
#include "zephyr/drivers/video.h"
#include "zephyr/drivers/video/stm32_dcmipp.h"

#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(isp_wrapper);

extern void stm32_dcmipp_isp_vsync_update(DCMIPP_HandleTypeDef *hdcmipp, uint32_t Pipe);
extern int stm32_dcmipp_isp_init(DCMIPP_HandleTypeDef *hdcmipp, const struct device *sensor);
extern int stm32_dcmipp_isp_start(void);
extern int stm32_dcmipp_isp_stop(void);

static const struct device *sensor_i;
static ISP_HandleTypeDef isp_i;
static struct k_thread isp_thread;
Expand Down Expand Up @@ -72,8 +68,6 @@ static ISP_StatusTypeDef isp_SetSensorGain(uint32_t Instance, int32_t Gain)
struct video_control ctrl;
int ret;

assert(sensor_i);

ctrl.id = VIDEO_CID_ANALOGUE_GAIN;
ctrl.val = Gain;
ret = video_set_ctrl(sensor_i, &ctrl);
Expand Down Expand Up @@ -101,8 +95,6 @@ static ISP_StatusTypeDef isp_SetSensorExposure(uint32_t Instance, int32_t Exposu
struct video_control ctrl;
int ret;

assert(sensor_i);

ctrl.id = VIDEO_CID_EXPOSURE;
ctrl.val = Exposure / IMX335_1H_PERIOD_USEC;
ret = video_set_ctrl(sensor_i, &ctrl);
Expand Down Expand Up @@ -152,6 +144,8 @@ int stm32_dcmipp_isp_init(DCMIPP_HandleTypeDef *hdcmipp, const struct device *se
k_tid_t isp_tid;
int res;

assert(sensor);

sensor_i = sensor;
res = ISP_Init(&isp_i, hdcmipp, 0, &isp_helpers, &ISP_IQParamCacheInit_IMX335);
if (res)
Expand Down Expand Up @@ -180,8 +174,6 @@ int stm32_dcmipp_isp_start(void)

int stm32_dcmipp_isp_stop(void)
{
assert(0);

return 0;
}

Expand Down