mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
ports/all: Refactor sensor flags.
This commit is contained in:
parent
a617dab56b
commit
13e6573c46
@ -131,8 +131,8 @@ typedef enum {
|
||||
} sensor_attr_t;
|
||||
|
||||
typedef enum {
|
||||
ACTIVE_LOW,
|
||||
ACTIVE_HIGH
|
||||
ACTIVE_LOW = 0,
|
||||
ACTIVE_HIGH = 1
|
||||
} polarity_t;
|
||||
|
||||
typedef enum {
|
||||
@ -206,36 +206,6 @@ typedef enum {
|
||||
SENSOR_CONFIG_WINDOWING = (1 << 3),
|
||||
} sensor_config_t;
|
||||
|
||||
// Bayer patterns.
|
||||
// NOTE: These must match the Bayer subformats in imlib.h
|
||||
//
|
||||
// BGGR matches the bayer pattern of BGBG...
|
||||
// GRGR...
|
||||
//
|
||||
// GBRG matches the bayer pattern of GBGB...
|
||||
// RGRG...
|
||||
//
|
||||
// GRBG matches the bayer pattern of GRGR...
|
||||
// BGBG...
|
||||
//
|
||||
// RGGB matches the bayer pattern of RGRG...
|
||||
// GBGB...
|
||||
//
|
||||
#define SENSOR_HW_FLAGS_BAYER_BGGR (SUBFORMAT_ID_BGGR)
|
||||
#define SENSOR_HW_FLAGS_BAYER_GBRG (SUBFORMAT_ID_GBRG)
|
||||
#define SENSOR_HW_FLAGS_BAYER_GRBG (SUBFORMAT_ID_GRBG)
|
||||
#define SENSOR_HW_FLAGS_BAYER_RGGB (SUBFORMAT_ID_RGGB)
|
||||
|
||||
// YUV patterns.
|
||||
// NOTE: These must match the YUV subformats in imlib.h
|
||||
//
|
||||
// YUV422 matches the YUV pattern of YUYV... etc. coming out of the sensor.
|
||||
//
|
||||
// YVU422 matches the YUV pattern of YVYU... etc. coming out of the sensor.
|
||||
//
|
||||
#define SENSOR_HW_FLAGS_YUV422 (SUBFORMAT_ID_YUV422)
|
||||
#define SENSOR_HW_FLAGS_YVU422 (SUBFORMAT_ID_YVU422)
|
||||
|
||||
typedef void (*vsync_cb_t) (uint32_t vsync);
|
||||
typedef void (*frame_cb_t) ();
|
||||
|
||||
@ -249,20 +219,21 @@ typedef struct _sensor {
|
||||
|
||||
// Hardware flags (clock polarities, hw capabilities etc..)
|
||||
struct {
|
||||
uint32_t vsync : 1; // Vertical sync polarity.
|
||||
uint32_t hsync : 1; // Horizontal sync polarity.
|
||||
uint32_t pixck : 1; // Pixel clock edge.
|
||||
uint32_t fsync : 1; // Hardware frame sync.
|
||||
uint32_t jpege : 1; // Hardware jpeg encoder.
|
||||
uint32_t jpeg_mode : 3; // JPEG mode.
|
||||
uint32_t gs_bpp : 2; // Grayscale bytes per pixel output.
|
||||
uint32_t reset_pol : 1; // Reset polarity.
|
||||
uint32_t power_pol : 1; // Power-down polarity.
|
||||
uint32_t vsync_pol : 1; // Vertical sync polarity.
|
||||
uint32_t hsync_pol : 1; // Horizontal sync polarity.
|
||||
uint32_t pixck_pol : 1; // Pixel clock edge.
|
||||
uint32_t frame_sync : 1; // Hardware frame sync.
|
||||
uint32_t mono_bpp : 2; // Grayscale bytes per pixel output.
|
||||
uint32_t rgb_swap : 1; // Byte-swap 2BPP RGB formats after capture.
|
||||
uint32_t yuv_swap : 1; // Byte-swap 2BPP YUV formats after capture.
|
||||
uint32_t bayer : 3; // Bayer/CFA pattern.
|
||||
uint32_t yuv_order : 1; // YUV/YVU order.
|
||||
uint32_t blc_size : 4; // Number of black level calibration registers.
|
||||
uint32_t raw : 1; // The sensor supports raw/Bayer output only.
|
||||
} hw_flags;
|
||||
uint32_t raw_output : 1; // The sensor supports raw output only.
|
||||
uint32_t yuv_format : 1; // YUV/YVU output format.
|
||||
uint32_t jpg_format : 3; // JPEG output format/mode.
|
||||
uint32_t cfa_format : 3; // CFA format/pattern.
|
||||
};
|
||||
|
||||
const uint16_t *color_palette; // Color palette used for color lookup.
|
||||
bool disable_delays; // Set to true to disable all sensor settling time delays.
|
||||
@ -270,8 +241,6 @@ typedef struct _sensor {
|
||||
|
||||
vsync_cb_t vsync_callback; // VSYNC callback.
|
||||
frame_cb_t frame_callback; // Frame callback.
|
||||
polarity_t pwdn_pol; // PWDN polarity (TODO move to hw_flags)
|
||||
polarity_t reset_pol; // Reset polarity (TODO move to hw_flags)
|
||||
|
||||
// Sensor state
|
||||
sde_t sde; // Special digital effects
|
||||
|
||||
@ -258,7 +258,7 @@ int sensor_probe_init(uint32_t bus_id, uint32_t bus_speed) {
|
||||
int init_ret = 0;
|
||||
|
||||
#if defined(OMV_CSI_POWER_PIN)
|
||||
sensor.pwdn_pol = ACTIVE_HIGH;
|
||||
sensor.power_pol = ACTIVE_HIGH;
|
||||
// Do a power cycle
|
||||
omv_gpio_write(OMV_CSI_POWER_PIN, 1);
|
||||
mp_hal_delay_ms(10);
|
||||
@ -294,7 +294,7 @@ int sensor_probe_init(uint32_t bus_id, uint32_t bus_speed) {
|
||||
|
||||
if ((sensor.slv_addr = sensor_detect()) == 0) {
|
||||
#if defined(OMV_CSI_POWER_PIN)
|
||||
sensor.pwdn_pol = ACTIVE_LOW;
|
||||
sensor.power_pol = ACTIVE_LOW;
|
||||
omv_gpio_write(OMV_CSI_POWER_PIN, 1);
|
||||
mp_hal_delay_ms(OMV_CSI_POWER_DELAY);
|
||||
#endif
|
||||
@ -316,7 +316,7 @@ int sensor_probe_init(uint32_t bus_id, uint32_t bus_speed) {
|
||||
} else if (paj6100_detect(&sensor)) {
|
||||
// Found PixArt PAJ6100
|
||||
sensor.chip_id_w = PAJ6100_ID;
|
||||
sensor.pwdn_pol = ACTIVE_LOW;
|
||||
sensor.power_pol = ACTIVE_LOW;
|
||||
sensor.reset_pol = ACTIVE_LOW;
|
||||
#endif
|
||||
} else {
|
||||
@ -527,13 +527,13 @@ __weak int sensor_shutdown(int enable) {
|
||||
|
||||
#if defined(OMV_CSI_POWER_PIN)
|
||||
if (enable) {
|
||||
if (sensor.pwdn_pol == ACTIVE_HIGH) {
|
||||
if (sensor.power_pol == ACTIVE_HIGH) {
|
||||
omv_gpio_write(OMV_CSI_POWER_PIN, 1);
|
||||
} else {
|
||||
omv_gpio_write(OMV_CSI_POWER_PIN, 0);
|
||||
}
|
||||
} else {
|
||||
if (sensor.pwdn_pol == ACTIVE_HIGH) {
|
||||
if (sensor.power_pol == ACTIVE_HIGH) {
|
||||
omv_gpio_write(OMV_CSI_POWER_PIN, 0);
|
||||
} else {
|
||||
omv_gpio_write(OMV_CSI_POWER_PIN, 1);
|
||||
@ -586,10 +586,10 @@ __weak int sensor_set_pixformat(pixformat_t pixformat) {
|
||||
// If the current format is BAYER (1BPP), and the target format is color and (2BPP), and the frame does not
|
||||
// fit in RAM it will just be switched back again to BAYER, so we keep the current format unchanged.
|
||||
uint32_t size = framebuffer_get_buffer_size();
|
||||
if ((sensor.pixformat == PIXFORMAT_BAYER)
|
||||
&& ((pixformat == PIXFORMAT_RGB565) || (pixformat == PIXFORMAT_YUV422))
|
||||
&& (MAIN_FB()->u * MAIN_FB()->v * 2 > size)
|
||||
&& (MAIN_FB()->u * MAIN_FB()->v * 1 <= size)) {
|
||||
if ((sensor.pixformat == PIXFORMAT_BAYER) &&
|
||||
((pixformat == PIXFORMAT_RGB565) || (pixformat == PIXFORMAT_YUV422)) &&
|
||||
(MAIN_FB()->u * MAIN_FB()->v * 2 > size) &&
|
||||
(MAIN_FB()->u * MAIN_FB()->v * 1 <= size)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -721,16 +721,16 @@ __weak void sensor_throttle_framerate() {
|
||||
|
||||
__weak bool sensor_get_cropped() {
|
||||
if (sensor.framesize != FRAMESIZE_INVALID) {
|
||||
return (MAIN_FB()->x != 0) // should be zero if not cropped.
|
||||
|| (MAIN_FB()->y != 0) // should be zero if not cropped.
|
||||
|| (MAIN_FB()->u != resolution[sensor.framesize][0]) // should be equal to the resolution if not cropped.
|
||||
|| (MAIN_FB()->v != resolution[sensor.framesize][1]); // should be equal to the resolution if not cropped.
|
||||
return (MAIN_FB()->x != 0) ||
|
||||
(MAIN_FB()->y != 0) ||
|
||||
(MAIN_FB()->u != resolution[sensor.framesize][0]) ||
|
||||
(MAIN_FB()->v != resolution[sensor.framesize][1]);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
__weak uint32_t sensor_get_src_bpp() {
|
||||
if (sensor.hw_flags.raw) {
|
||||
if (sensor.raw_output) {
|
||||
return 1;
|
||||
}
|
||||
switch (sensor.pixformat) {
|
||||
@ -741,7 +741,7 @@ __weak uint32_t sensor_get_src_bpp() {
|
||||
case PIXFORMAT_YUV422:
|
||||
return 2;
|
||||
case PIXFORMAT_GRAYSCALE:
|
||||
return sensor.hw_flags.gs_bpp;
|
||||
return sensor.mono_bpp;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@ -1345,7 +1345,7 @@ __weak int sensor_copy_line(void *dma, uint8_t *src, uint8_t *dst) {
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
if (sensor.hw_flags.gs_bpp == 1) {
|
||||
if (sensor.mono_bpp == 1) {
|
||||
// 1BPP GRAYSCALE.
|
||||
if (!sensor.transpose) {
|
||||
unaligned_memcpy(dst, src, MAIN_FB()->u);
|
||||
@ -1370,8 +1370,8 @@ __weak int sensor_copy_line(void *dma, uint8_t *src, uint8_t *dst) {
|
||||
#endif
|
||||
if (0) {
|
||||
#if !OMV_CSI_HW_SWAP_ENABLE
|
||||
} else if ((sensor.pixformat == PIXFORMAT_RGB565 && sensor.hw_flags.rgb_swap)
|
||||
|| (sensor.pixformat == PIXFORMAT_YUV422 && sensor.hw_flags.yuv_swap)) {
|
||||
} else if ((sensor.pixformat == PIXFORMAT_RGB565 && sensor.rgb_swap) ||
|
||||
(sensor.pixformat == PIXFORMAT_YUV422 && sensor.yuv_swap)) {
|
||||
if (!sensor.transpose) {
|
||||
unaligned_memcpy_rev16(dst16, src16, MAIN_FB()->u);
|
||||
} else {
|
||||
|
||||
@ -384,11 +384,22 @@ typedef enum {
|
||||
} pixformat_id_t;
|
||||
|
||||
// Pixel sub-format IDs.
|
||||
// YUV422 matches the YUV pattern of YUYV...
|
||||
// YVU422 matches the YUV pattern of YVYU...
|
||||
//
|
||||
// BGGR matches the bayer pattern of BGBG...
|
||||
// GRGR...
|
||||
// GBRG matches the bayer pattern of GBGB...
|
||||
// RGRG...
|
||||
// GRBG matches the bayer pattern of GRGR...
|
||||
// BGBG...
|
||||
// RGGB matches the bayer pattern of RGRG...
|
||||
// Note: The bayer sub-format must not overflow sensor.cfa_format.
|
||||
typedef enum {
|
||||
SUBFORMAT_ID_GRAY8 = 0,
|
||||
SUBFORMAT_ID_GRAY16 = 1,
|
||||
SUBFORMAT_ID_BGGR = 0, // !!! Note: Make sure bayer sub-formats don't !!!
|
||||
SUBFORMAT_ID_GBRG = 1, // !!! overflow the sensor.hw_flags.bayer field !!!
|
||||
SUBFORMAT_ID_BGGR = 0,
|
||||
SUBFORMAT_ID_GBRG = 1,
|
||||
SUBFORMAT_ID_GRBG = 2,
|
||||
SUBFORMAT_ID_RGGB = 3,
|
||||
SUBFORMAT_ID_YUV422 = 0,
|
||||
|
||||
@ -535,12 +535,12 @@ static mp_obj_t py_sensor_set_auto_blc(uint n_args, const mp_obj_t *pos_args, mp
|
||||
mp_arg_parse_all(n_args, pos_args, kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, args);
|
||||
|
||||
int enable = args[ARG_enable].u_int;
|
||||
int regs[sensor.hw_flags.blc_size];
|
||||
int regs[sensor.blc_size];
|
||||
bool regs_present = args[ARG_regs].u_obj != mp_const_none;
|
||||
if (regs_present) {
|
||||
mp_obj_t *arg_array;
|
||||
mp_obj_get_array_fixed_n(args[ARG_regs].u_obj, sensor.hw_flags.blc_size, &arg_array);
|
||||
for (uint32_t i = 0; i < sensor.hw_flags.blc_size; i++) {
|
||||
mp_obj_get_array_fixed_n(args[ARG_regs].u_obj, sensor.blc_size, &arg_array);
|
||||
for (uint32_t i = 0; i < sensor.blc_size; i++) {
|
||||
regs[i] = mp_obj_get_int(arg_array[i]);
|
||||
}
|
||||
}
|
||||
@ -557,14 +557,14 @@ static mp_obj_t py_sensor_set_auto_blc(uint n_args, const mp_obj_t *pos_args, mp
|
||||
static MP_DEFINE_CONST_FUN_OBJ_KW(py_sensor_set_auto_blc_obj, 1, py_sensor_set_auto_blc);
|
||||
|
||||
static mp_obj_t py_sensor_get_blc_regs() {
|
||||
int regs[sensor.hw_flags.blc_size];
|
||||
int regs[sensor.blc_size];
|
||||
int error = sensor_get_blc_regs(regs);
|
||||
if (error != 0) {
|
||||
sensor_raise_error(error);
|
||||
}
|
||||
|
||||
mp_obj_list_t *l = mp_obj_new_list(sensor.hw_flags.blc_size, NULL);
|
||||
for (uint32_t i = 0; i < sensor.hw_flags.blc_size; i++) {
|
||||
mp_obj_list_t *l = mp_obj_new_list(sensor.blc_size, NULL);
|
||||
for (uint32_t i = 0; i < sensor.blc_size; i++) {
|
||||
l->items[i] = mp_obj_new_int(regs[i]);
|
||||
}
|
||||
return l;
|
||||
|
||||
@ -128,9 +128,9 @@ int sensor_config(sensor_config_t config) {
|
||||
|
||||
// Configure VSYNC, HSYNC and PIXCLK signals.
|
||||
CSI_REG_CR1(CSI) |= CSI_CR1_EXT_VSYNC_MASK;
|
||||
CSI_REG_CR1(CSI) |= !sensor.hw_flags.vsync ? CSI_CR1_SOF_POL_MASK : 0;
|
||||
CSI_REG_CR1(CSI) |= !sensor.hw_flags.hsync ? CSI_CR1_HSYNC_POL_MASK : 0;
|
||||
CSI_REG_CR1(CSI) |= sensor.hw_flags.pixck ? CSI_CR1_REDGE_MASK : 0;
|
||||
CSI_REG_CR1(CSI) |= !sensor.vsync_pol ? CSI_CR1_SOF_POL_MASK : 0;
|
||||
CSI_REG_CR1(CSI) |= !sensor.hsync_pol ? CSI_CR1_HSYNC_POL_MASK : 0;
|
||||
CSI_REG_CR1(CSI) |= sensor.pixck_pol ? CSI_CR1_REDGE_MASK : 0;
|
||||
|
||||
// Stride config: No stride.
|
||||
CSI_REG_FBUF_PARA(CSI) = 0;
|
||||
@ -257,7 +257,7 @@ void sensor_line_callback(uint32_t addr) {
|
||||
return;
|
||||
}
|
||||
bool jpeg_end = false;
|
||||
if (sensor.hw_flags.jpeg_mode == 4) {
|
||||
if (sensor.jpg_format == 4) {
|
||||
// JPEG MODE 4:
|
||||
//
|
||||
// The width and height are fixed in each frame. The first two bytes are valid data
|
||||
@ -287,7 +287,7 @@ void sensor_line_callback(uint32_t addr) {
|
||||
}
|
||||
buffer->offset += size;
|
||||
}
|
||||
} else if (sensor.hw_flags.jpeg_mode == 3) {
|
||||
} else if (sensor.jpg_format == 3) {
|
||||
// OV2640 JPEG TODO
|
||||
}
|
||||
// In JPEG mode the camera sensor will output some number of lines that doesn't match the
|
||||
@ -356,7 +356,7 @@ static void edma_config(sensor_t *sensor, uint32_t bytes_per_pixel) {
|
||||
uint32_t line_width_bytes = MAIN_FB()->u * bytes_per_pixel;
|
||||
|
||||
// YUV422 Source -> Y Destination
|
||||
if ((sensor->pixformat == PIXFORMAT_GRAYSCALE) && (sensor->hw_flags.gs_bpp == 2)) {
|
||||
if ((sensor->pixformat == PIXFORMAT_GRAYSCALE) && (sensor->mono_bpp == 2)) {
|
||||
line_width_bytes /= 2;
|
||||
}
|
||||
|
||||
@ -383,7 +383,7 @@ static void edma_config(sensor_t *sensor, uint32_t bytes_per_pixel) {
|
||||
}
|
||||
|
||||
// YUV422 Source -> Y Destination
|
||||
if ((sensor->pixformat == PIXFORMAT_GRAYSCALE) && (sensor->hw_flags.gs_bpp == 2)) {
|
||||
if ((sensor->pixformat == PIXFORMAT_GRAYSCALE) && (sensor->mono_bpp == 2)) {
|
||||
src_inc = 2;
|
||||
src_size = 1;
|
||||
}
|
||||
@ -444,8 +444,8 @@ int sensor_snapshot(sensor_t *sensor, image_t *image, uint32_t flags) {
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((sensor->pixformat == PIXFORMAT_RGB565 && sensor->hw_flags.rgb_swap)
|
||||
|| (sensor->pixformat == PIXFORMAT_YUV422 && sensor->hw_flags.yuv_swap)) {
|
||||
if ((sensor->pixformat == PIXFORMAT_RGB565 && sensor->rgb_swap) ||
|
||||
(sensor->pixformat == PIXFORMAT_YUV422 && sensor->yuv_swap)) {
|
||||
CSI_REG_CR1(CSI) |= CSI_CR1_SWAP16_EN_MASK | CSI_CR1_PACK_DIR_MASK;
|
||||
} else {
|
||||
CSI_REG_CR1(CSI) &= ~(CSI_CR1_SWAP16_EN_MASK | CSI_CR1_PACK_DIR_MASK);
|
||||
@ -465,7 +465,7 @@ int sensor_snapshot(sensor_t *sensor, image_t *image, uint32_t flags) {
|
||||
|
||||
// Let the camera know we want to trigger it now.
|
||||
#if defined(OMV_CSI_FSYNC_PIN)
|
||||
if (sensor->hw_flags.fsync) {
|
||||
if (sensor->frame_sync) {
|
||||
omv_gpio_write(OMV_CSI_FSYNC_PIN, 1);
|
||||
}
|
||||
#endif
|
||||
@ -487,7 +487,7 @@ int sensor_snapshot(sensor_t *sensor, image_t *image, uint32_t flags) {
|
||||
sensor_abort(true, false);
|
||||
|
||||
#if defined(OMV_CSI_FSYNC_PIN)
|
||||
if (sensor->hw_flags.fsync) {
|
||||
if (sensor->frame_sync) {
|
||||
omv_gpio_write(OMV_CSI_FSYNC_PIN, 0);
|
||||
}
|
||||
#endif
|
||||
@ -499,7 +499,7 @@ int sensor_snapshot(sensor_t *sensor, image_t *image, uint32_t flags) {
|
||||
|
||||
// We're done receiving data.
|
||||
#if defined(OMV_CSI_FSYNC_PIN)
|
||||
if (sensor->hw_flags.fsync) {
|
||||
if (sensor->frame_sync) {
|
||||
omv_gpio_write(OMV_CSI_FSYNC_PIN, 0);
|
||||
}
|
||||
#endif
|
||||
@ -527,12 +527,12 @@ int sensor_snapshot(sensor_t *sensor, image_t *image, uint32_t flags) {
|
||||
break;
|
||||
case PIXFORMAT_BAYER:
|
||||
MAIN_FB()->pixfmt = PIXFORMAT_BAYER;
|
||||
MAIN_FB()->subfmt_id = sensor->hw_flags.bayer;
|
||||
MAIN_FB()->subfmt_id = sensor->cfa_format;
|
||||
MAIN_FB()->pixfmt = imlib_bayer_shift(MAIN_FB()->pixfmt, MAIN_FB()->x, MAIN_FB()->y, sensor->transpose);
|
||||
break;
|
||||
case PIXFORMAT_YUV422: {
|
||||
MAIN_FB()->pixfmt = PIXFORMAT_YUV;
|
||||
MAIN_FB()->subfmt_id = sensor->hw_flags.yuv_order;
|
||||
MAIN_FB()->subfmt_id = sensor->yuv_format;
|
||||
MAIN_FB()->pixfmt = imlib_yuv_shift(MAIN_FB()->pixfmt, MAIN_FB()->x);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -237,8 +237,8 @@ int sensor_snapshot(sensor_t *sensor, image_t *image, uint32_t flags) {
|
||||
MAIN_FB()->pixfmt = sensor->pixformat;
|
||||
|
||||
// Swap bytes if set.
|
||||
if ((MAIN_FB()->pixfmt == PIXFORMAT_RGB565 && sensor->hw_flags.rgb_swap) ||
|
||||
(MAIN_FB()->pixfmt == PIXFORMAT_YUV422 && sensor->hw_flags.yuv_swap)) {
|
||||
if ((MAIN_FB()->pixfmt == PIXFORMAT_RGB565 && sensor->rgb_swap) ||
|
||||
(MAIN_FB()->pixfmt == PIXFORMAT_YUV422 && sensor->yuv_swap)) {
|
||||
unaligned_memcpy_rev16(buffer->data, buffer->data, _width * _height);
|
||||
}
|
||||
|
||||
|
||||
@ -233,7 +233,7 @@ int sensor_snapshot(sensor_t *sensor, image_t *image, uint32_t flags) {
|
||||
|
||||
// Configure the DMA on the first frame, for later frames only the write is changed.
|
||||
sensor_dma_config(MAIN_FB()->u, MAIN_FB()->v, MAIN_FB()->bpp,
|
||||
(void *) buffer->data, (sensor->hw_flags.rgb_swap && MAIN_FB()->bpp == 2));
|
||||
(void *) buffer->data, (sensor->rgb_swap && MAIN_FB()->bpp == 2));
|
||||
|
||||
|
||||
// Re-enable the state machine.
|
||||
|
||||
@ -182,11 +182,11 @@ int sensor_config(sensor_config_t config) {
|
||||
if (config == SENSOR_CONFIG_INIT) {
|
||||
DCMIHandle.Instance = DCMI;
|
||||
// VSYNC clock polarity
|
||||
DCMIHandle.Init.VSPolarity = sensor.hw_flags.vsync ? DCMI_VSPOLARITY_HIGH : DCMI_VSPOLARITY_LOW;
|
||||
DCMIHandle.Init.VSPolarity = sensor.vsync_pol ? DCMI_VSPOLARITY_HIGH : DCMI_VSPOLARITY_LOW;
|
||||
// HSYNC clock polarity
|
||||
DCMIHandle.Init.HSPolarity = sensor.hw_flags.hsync ? DCMI_HSPOLARITY_HIGH : DCMI_HSPOLARITY_LOW;
|
||||
DCMIHandle.Init.HSPolarity = sensor.hsync_pol ? DCMI_HSPOLARITY_HIGH : DCMI_HSPOLARITY_LOW;
|
||||
// PXCLK clock polarity
|
||||
DCMIHandle.Init.PCKPolarity = sensor.hw_flags.pixck ? DCMI_PCKPOLARITY_RISING : DCMI_PCKPOLARITY_FALLING;
|
||||
DCMIHandle.Init.PCKPolarity = sensor.pixck_pol ? DCMI_PCKPOLARITY_RISING : DCMI_PCKPOLARITY_FALLING;
|
||||
|
||||
// Setup capture parameters.
|
||||
DCMIHandle.Init.SynchroMode = DCMI_SYNCHRO_HARDWARE; // Enable Hardware synchronization
|
||||
@ -329,7 +329,7 @@ int sensor_shutdown(int enable) {
|
||||
|
||||
if (enable) {
|
||||
#if defined(OMV_CSI_POWER_PIN)
|
||||
if (sensor.pwdn_pol == ACTIVE_HIGH) {
|
||||
if (sensor.power_pol == ACTIVE_HIGH) {
|
||||
omv_gpio_write(OMV_CSI_POWER_PIN, 1);
|
||||
} else {
|
||||
omv_gpio_write(OMV_CSI_POWER_PIN, 0);
|
||||
@ -339,7 +339,7 @@ int sensor_shutdown(int enable) {
|
||||
HAL_DCMI_DeInit(&DCMIHandle);
|
||||
} else {
|
||||
#if defined(OMV_CSI_POWER_PIN)
|
||||
if (sensor.pwdn_pol == ACTIVE_HIGH) {
|
||||
if (sensor.power_pol == ACTIVE_HIGH) {
|
||||
omv_gpio_write(OMV_CSI_POWER_PIN, 0);
|
||||
} else {
|
||||
omv_gpio_write(OMV_CSI_POWER_PIN, 1);
|
||||
@ -479,7 +479,7 @@ void DCMI_DMAConvCpltUser(uint32_t addr) {
|
||||
// depth on the DCMI hardware and DMA hardware is not enough to prevent data loss.
|
||||
|
||||
if (sensor.pixformat == PIXFORMAT_JPEG) {
|
||||
if (sensor.hw_flags.jpeg_mode == 4) {
|
||||
if (sensor.jpg_format == 4) {
|
||||
// JPEG MODE 4:
|
||||
//
|
||||
// The width and height are fixed in each frame. The first two bytes are valid data
|
||||
@ -500,7 +500,7 @@ void DCMI_DMAConvCpltUser(uint32_t addr) {
|
||||
}
|
||||
unaligned_memcpy(buffer->data + buffer->offset, ((uint16_t *) addr) + 1, size);
|
||||
buffer->offset += size;
|
||||
} else if (sensor.hw_flags.jpeg_mode == 3) {
|
||||
} else if (sensor.jpg_format == 3) {
|
||||
// JPEG MODE 3:
|
||||
//
|
||||
// Compression data is transmitted with programmable width. The last line width maybe
|
||||
@ -590,8 +590,8 @@ static void mdma_config(MDMA_InitTypeDef *init, sensor_t *sensor, uint32_t bytes
|
||||
init->SourceBlockAddressOffset = 0;
|
||||
init->DestBlockAddressOffset = 0;
|
||||
|
||||
if ((sensor->pixformat == PIXFORMAT_RGB565 && sensor->hw_flags.rgb_swap)
|
||||
|| (sensor->pixformat == PIXFORMAT_YUV422 && sensor->hw_flags.yuv_swap)) {
|
||||
if ((sensor->pixformat == PIXFORMAT_RGB565 && sensor->rgb_swap) ||
|
||||
(sensor->pixformat == PIXFORMAT_YUV422 && sensor->yuv_swap)) {
|
||||
init->Endianness = MDMA_LITTLE_BYTE_ENDIANNESS_EXCHANGE;
|
||||
} else {
|
||||
init->Endianness = MDMA_LITTLE_ENDIANNESS_PRESERVE;
|
||||
@ -606,7 +606,7 @@ static void mdma_config(MDMA_InitTypeDef *init, sensor_t *sensor, uint32_t bytes
|
||||
}
|
||||
|
||||
// YUV422 Source -> Y Destination
|
||||
if ((sensor->pixformat == PIXFORMAT_GRAYSCALE) && (sensor->hw_flags.gs_bpp == 2)) {
|
||||
if ((sensor->pixformat == PIXFORMAT_GRAYSCALE) && (sensor->mono_bpp == 2)) {
|
||||
line_width_bytes /= 2;
|
||||
if (sensor->transpose) {
|
||||
init->DestBlockAddressOffset /= 2;
|
||||
@ -643,7 +643,7 @@ static void mdma_config(MDMA_InitTypeDef *init, sensor_t *sensor, uint32_t bytes
|
||||
}
|
||||
|
||||
// YUV422 Source -> Y Destination
|
||||
if ((sensor->pixformat == PIXFORMAT_GRAYSCALE) && (sensor->hw_flags.gs_bpp == 2)) {
|
||||
if ((sensor->pixformat == PIXFORMAT_GRAYSCALE) && (sensor->mono_bpp == 2)) {
|
||||
init->SourceInc = MDMA_SRC_INC_HALFWORD;
|
||||
init->SourceDataSize = MDMA_SRC_DATASIZE_BYTE;
|
||||
}
|
||||
@ -810,7 +810,7 @@ int sensor_snapshot(sensor_t *sensor, image_t *image, uint32_t flags) {
|
||||
|
||||
// Let the camera know we want to trigger it now.
|
||||
#if defined(OMV_CSI_FSYNC_PIN)
|
||||
if (sensor->hw_flags.fsync) {
|
||||
if (sensor->frame_sync) {
|
||||
omv_gpio_write(OMV_CSI_FSYNC_PIN, 1);
|
||||
}
|
||||
#endif
|
||||
@ -845,7 +845,7 @@ int sensor_snapshot(sensor_t *sensor, image_t *image, uint32_t flags) {
|
||||
sensor_abort(true, false);
|
||||
|
||||
#if defined(OMV_CSI_FSYNC_PIN)
|
||||
if (sensor->hw_flags.fsync) {
|
||||
if (sensor->frame_sync) {
|
||||
omv_gpio_write(OMV_CSI_FSYNC_PIN, 0);
|
||||
}
|
||||
#endif
|
||||
@ -863,7 +863,7 @@ int sensor_snapshot(sensor_t *sensor, image_t *image, uint32_t flags) {
|
||||
|
||||
// We're done receiving data.
|
||||
#if defined(OMV_CSI_FSYNC_PIN)
|
||||
if (sensor->hw_flags.fsync) {
|
||||
if (sensor->frame_sync) {
|
||||
omv_gpio_write(OMV_CSI_FSYNC_PIN, 0);
|
||||
}
|
||||
#endif
|
||||
@ -893,12 +893,12 @@ int sensor_snapshot(sensor_t *sensor, image_t *image, uint32_t flags) {
|
||||
break;
|
||||
case PIXFORMAT_BAYER:
|
||||
MAIN_FB()->pixfmt = PIXFORMAT_BAYER;
|
||||
MAIN_FB()->subfmt_id = sensor->hw_flags.bayer;
|
||||
MAIN_FB()->subfmt_id = sensor->cfa_format;
|
||||
MAIN_FB()->pixfmt = imlib_bayer_shift(MAIN_FB()->pixfmt, MAIN_FB()->x, MAIN_FB()->y, sensor->transpose);
|
||||
break;
|
||||
case PIXFORMAT_YUV422: {
|
||||
MAIN_FB()->pixfmt = PIXFORMAT_YUV;
|
||||
MAIN_FB()->subfmt_id = sensor->hw_flags.yuv_order;
|
||||
MAIN_FB()->subfmt_id = sensor->yuv_format;
|
||||
MAIN_FB()->pixfmt = imlib_yuv_shift(MAIN_FB()->pixfmt, MAIN_FB()->x);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -24,8 +24,8 @@ static int set_framesize(sensor_t *sensor, framesize_t framesize) {
|
||||
int frogeye2020_init(sensor_t *sensor) {
|
||||
sensor->set_pixformat = set_pixformat;
|
||||
sensor->set_framesize = set_framesize;
|
||||
sensor->hw_flags.pixck = 1;
|
||||
sensor->hw_flags.gs_bpp = 1;
|
||||
sensor->pixck_pol = 1;
|
||||
sensor->mono_bpp = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -999,14 +999,13 @@ int gc2145_init(sensor_t *sensor) {
|
||||
sensor->ioctl = ioctl;
|
||||
|
||||
// Set sensor flags
|
||||
sensor->hw_flags.vsync = 0;
|
||||
sensor->hw_flags.hsync = 0;
|
||||
sensor->hw_flags.pixck = 1;
|
||||
sensor->hw_flags.fsync = 0;
|
||||
sensor->hw_flags.jpege = 0;
|
||||
sensor->hw_flags.gs_bpp = 2;
|
||||
sensor->hw_flags.rgb_swap = 1;
|
||||
sensor->hw_flags.bayer = SENSOR_HW_FLAGS_BAYER_GBRG;
|
||||
sensor->vsync_pol = 0;
|
||||
sensor->hsync_pol = 0;
|
||||
sensor->pixck_pol = 1;
|
||||
sensor->frame_sync = 0;
|
||||
sensor->mono_bpp = 2;
|
||||
sensor->rgb_swap = 1;
|
||||
sensor->cfa_format = SUBFORMAT_ID_GBRG;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -533,12 +533,11 @@ int hm01b0_init(sensor_t *sensor) {
|
||||
sensor->ioctl = ioctl;
|
||||
|
||||
// Set sensor flags
|
||||
sensor->hw_flags.vsync = 0;
|
||||
sensor->hw_flags.hsync = 0;
|
||||
sensor->hw_flags.pixck = 0;
|
||||
sensor->hw_flags.fsync = 0;
|
||||
sensor->hw_flags.jpege = 0;
|
||||
sensor->hw_flags.gs_bpp = 1;
|
||||
sensor->vsync_pol = 0;
|
||||
sensor->hsync_pol = 0;
|
||||
sensor->pixck_pol = 0;
|
||||
sensor->frame_sync = 0;
|
||||
sensor->mono_bpp = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -762,12 +762,11 @@ int hm0360_init(sensor_t *sensor) {
|
||||
sensor->ioctl = ioctl;
|
||||
|
||||
// Set sensor flags
|
||||
sensor->hw_flags.vsync = 0;
|
||||
sensor->hw_flags.hsync = 0;
|
||||
sensor->hw_flags.pixck = 0;
|
||||
sensor->hw_flags.fsync = 0;
|
||||
sensor->hw_flags.jpege = 0;
|
||||
sensor->hw_flags.gs_bpp = 1;
|
||||
sensor->vsync_pol = 0;
|
||||
sensor->hsync_pol = 0;
|
||||
sensor->pixck_pol = 0;
|
||||
sensor->frame_sync = 0;
|
||||
sensor->mono_bpp = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -503,12 +503,11 @@ int lepton_init(sensor_t *sensor) {
|
||||
sensor->set_lens_correction = set_lens_correction;
|
||||
sensor->ioctl = ioctl;
|
||||
|
||||
sensor->hw_flags.vsync = 1;
|
||||
sensor->hw_flags.hsync = 0;
|
||||
sensor->hw_flags.pixck = 0;
|
||||
sensor->hw_flags.fsync = 0;
|
||||
sensor->hw_flags.jpege = 0;
|
||||
sensor->hw_flags.gs_bpp = 1;
|
||||
sensor->vsync_pol = 1;
|
||||
sensor->hsync_pol = 0;
|
||||
sensor->pixck_pol = 0;
|
||||
sensor->frame_sync = 0;
|
||||
sensor->mono_bpp = 1;
|
||||
|
||||
if (reset(sensor) != 0) {
|
||||
return -1;
|
||||
|
||||
@ -985,15 +985,14 @@ int mt9m114_init(sensor_t *sensor) {
|
||||
sensor->ioctl = ioctl;
|
||||
|
||||
// Set sensor flags
|
||||
sensor->hw_flags.vsync = 0;
|
||||
sensor->hw_flags.hsync = 0;
|
||||
sensor->hw_flags.pixck = 0;
|
||||
sensor->hw_flags.fsync = 0;
|
||||
sensor->hw_flags.jpege = 0;
|
||||
sensor->hw_flags.gs_bpp = 2;
|
||||
sensor->hw_flags.rgb_swap = 0;
|
||||
sensor->hw_flags.bayer = SENSOR_HW_FLAGS_BAYER_GBRG;
|
||||
sensor->hw_flags.yuv_order = SENSOR_HW_FLAGS_YVU422;
|
||||
sensor->vsync_pol = 0;
|
||||
sensor->hsync_pol = 0;
|
||||
sensor->pixck_pol = 0;
|
||||
sensor->frame_sync = 0;
|
||||
sensor->mono_bpp = 2;
|
||||
sensor->rgb_swap = 0;
|
||||
sensor->yuv_format = SUBFORMAT_ID_YVU422;
|
||||
sensor->cfa_format = SUBFORMAT_ID_GBRG;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -513,13 +513,12 @@ int mt9v0xx_init(sensor_t *sensor) {
|
||||
sensor->ioctl = ioctl;
|
||||
|
||||
// Set sensor flags
|
||||
sensor->hw_flags.vsync = 0;
|
||||
sensor->hw_flags.hsync = 0;
|
||||
sensor->hw_flags.pixck = 0;
|
||||
sensor->hw_flags.fsync = 1;
|
||||
sensor->hw_flags.jpege = 0;
|
||||
sensor->hw_flags.gs_bpp = 1;
|
||||
sensor->hw_flags.bayer = SENSOR_HW_FLAGS_BAYER_BGGR;
|
||||
sensor->vsync_pol = 0;
|
||||
sensor->hsync_pol = 0;
|
||||
sensor->pixck_pol = 0;
|
||||
sensor->frame_sync = 1;
|
||||
sensor->mono_bpp = 1;
|
||||
sensor->cfa_format = SUBFORMAT_ID_BGGR;
|
||||
|
||||
uint16_t cfa_type_reg;
|
||||
int ret = omv_i2c_readw(&sensor->i2c_bus, sensor->slv_addr, MT9V0XX_CFA_ID_REG, &cfa_type_reg);
|
||||
|
||||
@ -864,15 +864,14 @@ int ov2640_init(sensor_t *sensor) {
|
||||
sensor->set_special_effect = set_special_effect;
|
||||
|
||||
// Set sensor flags
|
||||
sensor->hw_flags.vsync = 0;
|
||||
sensor->hw_flags.hsync = 0;
|
||||
sensor->hw_flags.pixck = 1;
|
||||
sensor->hw_flags.fsync = 0;
|
||||
sensor->hw_flags.jpege = 1;
|
||||
sensor->hw_flags.jpeg_mode = 3;
|
||||
sensor->hw_flags.gs_bpp = 2;
|
||||
sensor->hw_flags.rgb_swap = 0;
|
||||
sensor->hw_flags.yuv_order = SENSOR_HW_FLAGS_YVU422;
|
||||
sensor->vsync_pol = 0;
|
||||
sensor->hsync_pol = 0;
|
||||
sensor->pixck_pol = 1;
|
||||
sensor->frame_sync = 0;
|
||||
sensor->mono_bpp = 2;
|
||||
sensor->rgb_swap = 0;
|
||||
sensor->jpg_format = 3;
|
||||
sensor->yuv_format = SUBFORMAT_ID_YVU422;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1253,7 +1253,7 @@ static int set_auto_blc(sensor_t *sensor, int enable, int *regs) {
|
||||
ret |= omv_i2c_writeb2(&sensor->i2c_bus, sensor->slv_addr, BLC_CTRL_00, (reg & 0xFE) | (enable != 0));
|
||||
|
||||
if ((enable == 0) && (regs != NULL)) {
|
||||
for (uint32_t i = 0; i < sensor->hw_flags.blc_size; i++) {
|
||||
for (uint32_t i = 0; i < sensor->blc_size; i++) {
|
||||
ret |= omv_i2c_writeb2(&sensor->i2c_bus, sensor->slv_addr, BLACK_LEVEL_00_H + i, regs[i]);
|
||||
}
|
||||
}
|
||||
@ -1264,7 +1264,7 @@ static int set_auto_blc(sensor_t *sensor, int enable, int *regs) {
|
||||
static int get_blc_regs(sensor_t *sensor, int *regs) {
|
||||
int ret = 0;
|
||||
|
||||
for (uint32_t i = 0; i < sensor->hw_flags.blc_size; i++) {
|
||||
for (uint32_t i = 0; i < sensor->blc_size; i++) {
|
||||
uint8_t reg;
|
||||
ret |= omv_i2c_readb2(&sensor->i2c_bus, sensor->slv_addr, BLACK_LEVEL_00_H + i, ®);
|
||||
regs[i] = reg;
|
||||
@ -1443,16 +1443,15 @@ int ov5640_init(sensor_t *sensor) {
|
||||
sensor->ioctl = ioctl;
|
||||
|
||||
// Set sensor flags
|
||||
sensor->hw_flags.vsync = 1;
|
||||
sensor->hw_flags.hsync = 0;
|
||||
sensor->hw_flags.pixck = 1;
|
||||
sensor->hw_flags.fsync = 0;
|
||||
sensor->hw_flags.jpege = 1;
|
||||
sensor->hw_flags.jpeg_mode = 4;
|
||||
sensor->hw_flags.gs_bpp = 1;
|
||||
sensor->hw_flags.rgb_swap = 0;
|
||||
sensor->hw_flags.yuv_order = SENSOR_HW_FLAGS_YVU422;
|
||||
sensor->hw_flags.blc_size = 8;
|
||||
sensor->vsync_pol = 1;
|
||||
sensor->hsync_pol = 0;
|
||||
sensor->pixck_pol = 1;
|
||||
sensor->frame_sync = 0;
|
||||
sensor->mono_bpp = 1;
|
||||
sensor->rgb_swap = 0;
|
||||
sensor->blc_size = 8;
|
||||
sensor->jpg_format = 4;
|
||||
sensor->yuv_format = SUBFORMAT_ID_YVU422;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -449,14 +449,13 @@ int ov7670_init(sensor_t *sensor) {
|
||||
sensor->set_vflip = set_vflip;
|
||||
|
||||
// Set sensor flags
|
||||
sensor->hw_flags.vsync = 1;
|
||||
sensor->hw_flags.hsync = 0;
|
||||
sensor->hw_flags.pixck = 1;
|
||||
sensor->hw_flags.fsync = 0;
|
||||
sensor->hw_flags.jpege = 0;
|
||||
sensor->hw_flags.gs_bpp = 2;
|
||||
sensor->hw_flags.rgb_swap = 1;
|
||||
sensor->hw_flags.yuv_order = SENSOR_HW_FLAGS_YVU422;
|
||||
sensor->vsync_pol = 1;
|
||||
sensor->hsync_pol = 0;
|
||||
sensor->pixck_pol = 1;
|
||||
sensor->frame_sync = 0;
|
||||
sensor->mono_bpp = 2;
|
||||
sensor->rgb_swap = 1;
|
||||
sensor->yuv_format = SUBFORMAT_ID_YVU422;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -610,13 +610,12 @@ int ov7690_init(sensor_t *sensor) {
|
||||
sensor->set_lens_correction = set_lens_correction;
|
||||
|
||||
// Set sensor flags
|
||||
sensor->hw_flags.vsync = 1;
|
||||
sensor->hw_flags.hsync = 0;
|
||||
sensor->hw_flags.pixck = 1;
|
||||
sensor->hw_flags.fsync = 0;
|
||||
sensor->hw_flags.jpege = 0;
|
||||
sensor->hw_flags.gs_bpp = 2;
|
||||
sensor->hw_flags.rgb_swap = 1;
|
||||
sensor->vsync_pol = 1;
|
||||
sensor->hsync_pol = 0;
|
||||
sensor->pixck_pol = 1;
|
||||
sensor->frame_sync = 0;
|
||||
sensor->mono_bpp = 2;
|
||||
sensor->rgb_swap = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -549,7 +549,7 @@ static int set_auto_blc(sensor_t *sensor, int enable, int *regs) {
|
||||
ret |= omv_i2c_writeb(&sensor->i2c_bus, sensor->slv_addr, COM13, COM13_SET_BLC(reg, (enable != 0)));
|
||||
|
||||
if ((enable == 0) && (regs != NULL)) {
|
||||
for (uint32_t i = 0; i < sensor->hw_flags.blc_size; i++) {
|
||||
for (uint32_t i = 0; i < sensor->blc_size; i++) {
|
||||
ret |= omv_i2c_writeb(&sensor->i2c_bus, sensor->slv_addr, ADOFF_B + i, regs[i]);
|
||||
}
|
||||
}
|
||||
@ -560,7 +560,7 @@ static int set_auto_blc(sensor_t *sensor, int enable, int *regs) {
|
||||
static int get_blc_regs(sensor_t *sensor, int *regs) {
|
||||
int ret = 0;
|
||||
|
||||
for (uint32_t i = 0; i < sensor->hw_flags.blc_size; i++) {
|
||||
for (uint32_t i = 0; i < sensor->blc_size; i++) {
|
||||
uint8_t reg;
|
||||
ret |= omv_i2c_readb(&sensor->i2c_bus, sensor->slv_addr, ADOFF_B + i, ®);
|
||||
regs[i] = reg;
|
||||
@ -676,16 +676,15 @@ int ov7725_init(sensor_t *sensor) {
|
||||
sensor->ioctl = ioctl;
|
||||
|
||||
// Set sensor flags
|
||||
sensor->hw_flags.vsync = 1;
|
||||
sensor->hw_flags.hsync = 0;
|
||||
sensor->hw_flags.pixck = 1;
|
||||
sensor->hw_flags.fsync = 0;
|
||||
sensor->hw_flags.jpege = 0;
|
||||
sensor->hw_flags.gs_bpp = 2;
|
||||
sensor->hw_flags.rgb_swap = 1;
|
||||
sensor->hw_flags.bayer = SENSOR_HW_FLAGS_BAYER_GBRG;
|
||||
sensor->hw_flags.yuv_order = SENSOR_HW_FLAGS_YVU422;
|
||||
sensor->hw_flags.blc_size = 8;
|
||||
sensor->vsync_pol = 1;
|
||||
sensor->hsync_pol = 0;
|
||||
sensor->pixck_pol = 1;
|
||||
sensor->frame_sync = 0;
|
||||
sensor->mono_bpp = 2;
|
||||
sensor->rgb_swap = 1;
|
||||
sensor->blc_size = 8;
|
||||
sensor->yuv_format = SUBFORMAT_ID_YVU422;
|
||||
sensor->cfa_format = SUBFORMAT_ID_GBRG;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -557,14 +557,13 @@ int ov9650_init(sensor_t *sensor) {
|
||||
sensor->set_vflip = set_vflip;
|
||||
|
||||
// Set sensor flags
|
||||
sensor->hw_flags.vsync = 1;
|
||||
sensor->hw_flags.hsync = 0;
|
||||
sensor->hw_flags.pixck = 1;
|
||||
sensor->hw_flags.fsync = 0;
|
||||
sensor->hw_flags.jpege = 0;
|
||||
sensor->hw_flags.gs_bpp = 2;
|
||||
sensor->hw_flags.rgb_swap = 1;
|
||||
sensor->hw_flags.yuv_order = SENSOR_HW_FLAGS_YVU422;
|
||||
sensor->vsync_pol = 1;
|
||||
sensor->hsync_pol = 0;
|
||||
sensor->pixck_pol = 1;
|
||||
sensor->frame_sync = 0;
|
||||
sensor->mono_bpp = 2;
|
||||
sensor->rgb_swap = 1;
|
||||
sensor->yuv_format = SUBFORMAT_ID_YVU422;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -639,12 +639,11 @@ int pag7920_init(sensor_t *sensor) {
|
||||
sensor->set_vflip = set_vflip;
|
||||
|
||||
// Set sensor flags
|
||||
sensor->hw_flags.vsync = 0;
|
||||
sensor->hw_flags.hsync = 0;
|
||||
sensor->hw_flags.pixck = 1;
|
||||
sensor->hw_flags.fsync = 1;
|
||||
sensor->hw_flags.jpege = 0;
|
||||
sensor->hw_flags.gs_bpp = 1;
|
||||
sensor->vsync_pol = 0;
|
||||
sensor->hsync_pol = 0;
|
||||
sensor->pixck_pol = 1;
|
||||
sensor->frame_sync = 1;
|
||||
sensor->mono_bpp = 1;
|
||||
|
||||
init_sensor(sensor);
|
||||
|
||||
|
||||
@ -603,6 +603,7 @@ static int set_hmirror(sensor_t *sensor, int enable) {
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int set_vflip(sensor_t *sensor, int enable) {
|
||||
int ret;
|
||||
uint8_t val;
|
||||
@ -621,9 +622,11 @@ static int set_vflip(sensor_t *sensor, int enable) {
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int set_lens_correction(sensor_t *sensor, int enable, int radi, int coef) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int reset(sensor_t *sensor) {
|
||||
int ret;
|
||||
bank_cache = -1;
|
||||
@ -709,15 +712,13 @@ int paj6100_init(sensor_t *sensor) {
|
||||
sensor->snapshot = paj6100_snapshot;
|
||||
|
||||
// Set sensor flags
|
||||
sensor->hw_flags.vsync = 1;
|
||||
sensor->hw_flags.hsync = 1;
|
||||
sensor->hw_flags.pixck = 1;
|
||||
sensor->hw_flags.fsync = 0;
|
||||
sensor->hw_flags.jpege = 0;
|
||||
sensor->hw_flags.gs_bpp = 1;
|
||||
sensor->vsync_pol = 1;
|
||||
sensor->hsync_pol = 1;
|
||||
sensor->pixck_pol = 1;
|
||||
sensor->frame_sync = 0;
|
||||
sensor->mono_bpp = 1;
|
||||
|
||||
init_sensor(sensor);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user