mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Add frogeye sensor driver
This commit is contained in:
parent
1812a35c18
commit
7f84ce5010
@ -39,6 +39,7 @@ SRCS += $(addprefix sensors/, \
|
|||||||
hm01b0.c \
|
hm01b0.c \
|
||||||
gc2145.c \
|
gc2145.c \
|
||||||
paj6100.c \
|
paj6100.c \
|
||||||
|
frogeye2020.c \
|
||||||
)
|
)
|
||||||
|
|
||||||
SRCS += $(addprefix imlib/, \
|
SRCS += $(addprefix imlib/, \
|
||||||
|
|||||||
@ -44,6 +44,7 @@
|
|||||||
#define OMV_ENABLE_LEPTON (0)
|
#define OMV_ENABLE_LEPTON (0)
|
||||||
#define OMV_ENABLE_HM01B0 (0)
|
#define OMV_ENABLE_HM01B0 (0)
|
||||||
#define OMV_ENABLE_PAJ6100 (0)
|
#define OMV_ENABLE_PAJ6100 (0)
|
||||||
|
#define OMV_ENABLE_FROGEYE2020 (0)
|
||||||
|
|
||||||
// Set which OV767x sensor is used
|
// Set which OV767x sensor is used
|
||||||
#define OMV_OV7670_VERSION (75)
|
#define OMV_OV7670_VERSION (75)
|
||||||
|
|||||||
@ -57,6 +57,7 @@
|
|||||||
#define OMV_ENABLE_LEPTON (0)
|
#define OMV_ENABLE_LEPTON (0)
|
||||||
#define OMV_ENABLE_HM01B0 (0)
|
#define OMV_ENABLE_HM01B0 (0)
|
||||||
#define OMV_ENABLE_PAJ6100 (0)
|
#define OMV_ENABLE_PAJ6100 (0)
|
||||||
|
#define OMV_ENABLE_FROGEYE2020 (0)
|
||||||
|
|
||||||
// Enable sensor features
|
// Enable sensor features
|
||||||
#define OMV_ENABLE_OV5640_AF (0)
|
#define OMV_ENABLE_OV5640_AF (0)
|
||||||
|
|||||||
@ -57,6 +57,7 @@
|
|||||||
#define OMV_ENABLE_LEPTON (0)
|
#define OMV_ENABLE_LEPTON (0)
|
||||||
#define OMV_ENABLE_HM01B0 (0)
|
#define OMV_ENABLE_HM01B0 (0)
|
||||||
#define OMV_ENABLE_PAJ6100 (0)
|
#define OMV_ENABLE_PAJ6100 (0)
|
||||||
|
#define OMV_ENABLE_FROGEYE2020 (0)
|
||||||
|
|
||||||
// Enable sensor features
|
// Enable sensor features
|
||||||
#define OMV_ENABLE_OV5640_AF (0)
|
#define OMV_ENABLE_OV5640_AF (0)
|
||||||
|
|||||||
@ -64,6 +64,7 @@
|
|||||||
#define OMV_ENABLE_LEPTON (1)
|
#define OMV_ENABLE_LEPTON (1)
|
||||||
#define OMV_ENABLE_HM01B0 (0)
|
#define OMV_ENABLE_HM01B0 (0)
|
||||||
#define OMV_ENABLE_PAJ6100 (1)
|
#define OMV_ENABLE_PAJ6100 (1)
|
||||||
|
#define OMV_ENABLE_FROGEYE2020 (1)
|
||||||
|
|
||||||
// Set which OV767x sensor is used
|
// Set which OV767x sensor is used
|
||||||
#define OMV_OV7670_VERSION (70)
|
#define OMV_OV7670_VERSION (70)
|
||||||
|
|||||||
@ -67,6 +67,7 @@
|
|||||||
#define OMV_ENABLE_LEPTON (1)
|
#define OMV_ENABLE_LEPTON (1)
|
||||||
#define OMV_ENABLE_HM01B0 (0)
|
#define OMV_ENABLE_HM01B0 (0)
|
||||||
#define OMV_ENABLE_PAJ6100 (1)
|
#define OMV_ENABLE_PAJ6100 (1)
|
||||||
|
#define OMV_ENABLE_FROGEYE2020 (1)
|
||||||
|
|
||||||
// Enable sensor features
|
// Enable sensor features
|
||||||
#define OMV_ENABLE_OV5640_AF (0)
|
#define OMV_ENABLE_OV5640_AF (0)
|
||||||
|
|||||||
@ -64,6 +64,7 @@
|
|||||||
#define OMV_ENABLE_LEPTON (0)
|
#define OMV_ENABLE_LEPTON (0)
|
||||||
#define OMV_ENABLE_HM01B0 (0)
|
#define OMV_ENABLE_HM01B0 (0)
|
||||||
#define OMV_ENABLE_PAJ6100 (0)
|
#define OMV_ENABLE_PAJ6100 (0)
|
||||||
|
#define OMV_ENABLE_FROGEYE2020 (0)
|
||||||
|
|
||||||
// Enable sensor features
|
// Enable sensor features
|
||||||
#define OMV_ENABLE_OV5640_AF (1)
|
#define OMV_ENABLE_OV5640_AF (1)
|
||||||
|
|||||||
@ -22,6 +22,7 @@
|
|||||||
#define LEPTON_SLV_ADDR (0x54)
|
#define LEPTON_SLV_ADDR (0x54)
|
||||||
#define HM01B0_SLV_ADDR (0x48)
|
#define HM01B0_SLV_ADDR (0x48)
|
||||||
#define GC2145_SLV_ADDR (0x78)
|
#define GC2145_SLV_ADDR (0x78)
|
||||||
|
#define FROGEYE2020_SLV_ADDR (0x6E)
|
||||||
|
|
||||||
// Chip ID Registers
|
// Chip ID Registers
|
||||||
#define OV5640_CHIP_ID (0x300A)
|
#define OV5640_CHIP_ID (0x300A)
|
||||||
@ -44,6 +45,7 @@
|
|||||||
#define GC2145_ID (0x21)
|
#define GC2145_ID (0x21)
|
||||||
// Wide ID
|
// Wide ID
|
||||||
#define PAJ6100_ID (0x6100)
|
#define PAJ6100_ID (0x6100)
|
||||||
|
#define FROGEYE2020_ID (0x2020)
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
FRAMESIZE_INVALID = 0,
|
FRAMESIZE_INVALID = 0,
|
||||||
|
|||||||
@ -27,6 +27,7 @@
|
|||||||
#include "lepton.h"
|
#include "lepton.h"
|
||||||
#include "hm01b0.h"
|
#include "hm01b0.h"
|
||||||
#include "paj6100.h"
|
#include "paj6100.h"
|
||||||
|
#include "frogeye2020.h"
|
||||||
#include "gc2145.h"
|
#include "gc2145.h"
|
||||||
#include "framebuffer.h"
|
#include "framebuffer.h"
|
||||||
#include "omv_boardconfig.h"
|
#include "omv_boardconfig.h"
|
||||||
@ -156,13 +157,9 @@ __weak int sensor_reset()
|
|||||||
// Re-enable the bus.
|
// Re-enable the bus.
|
||||||
cambus_enable(&sensor.bus, true);
|
cambus_enable(&sensor.bus, true);
|
||||||
|
|
||||||
// Check if the control is supported.
|
|
||||||
if (sensor.reset == NULL) {
|
|
||||||
return SENSOR_ERROR_CTL_UNSUPPORTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call sensor-specific reset function
|
// Call sensor-specific reset function
|
||||||
if (sensor.reset(&sensor) != 0) {
|
if (sensor.reset != NULL
|
||||||
|
&& sensor.reset(&sensor) != 0) {
|
||||||
return SENSOR_ERROR_CTL_FAILED;
|
return SENSOR_ERROR_CTL_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,6 +283,14 @@ int sensor_probe_init(uint32_t bus_id, uint32_t bus_speed)
|
|||||||
break;
|
break;
|
||||||
#endif //(OMV_ENABLE_GC2145 == 1)
|
#endif //(OMV_ENABLE_GC2145 == 1)
|
||||||
|
|
||||||
|
#if (OMV_ENABLE_FROGEYE2020 == 1)
|
||||||
|
case FROGEYE2020_SLV_ADDR:
|
||||||
|
sensor.chip_id_w = FROGEYE2020_ID;
|
||||||
|
sensor.pwdn_pol = ACTIVE_HIGH;
|
||||||
|
sensor.reset_pol = ACTIVE_HIGH;
|
||||||
|
break;
|
||||||
|
#endif // (OMV_ENABLE_FROGEYE2020 == 1)
|
||||||
|
|
||||||
#if (OMV_ENABLE_PAJ6100 == 1)
|
#if (OMV_ENABLE_PAJ6100 == 1)
|
||||||
case 0:
|
case 0:
|
||||||
if (paj6100_detect(&sensor)) {
|
if (paj6100_detect(&sensor)) {
|
||||||
@ -403,6 +408,15 @@ int sensor_probe_init(uint32_t bus_id, uint32_t bus_speed)
|
|||||||
break;
|
break;
|
||||||
#endif // (OMV_ENABLE_PAJ6100 == 1)
|
#endif // (OMV_ENABLE_PAJ6100 == 1)
|
||||||
|
|
||||||
|
#if (OMV_ENABLE_FROGEYE2020 == 1)
|
||||||
|
case FROGEYE2020_ID:
|
||||||
|
if (sensor_set_xclk_frequency(FROGEYE2020_XCLK_FREQ) != 0) {
|
||||||
|
return SENSOR_ERROR_TIM_INIT_FAILED;
|
||||||
|
}
|
||||||
|
init_ret = frogeye2020_init(&sensor);
|
||||||
|
break;
|
||||||
|
#endif // (OMV_ENABLE_FROGEYE2020 == 1)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return SENSOR_ERROR_ISC_UNSUPPORTED;
|
return SENSOR_ERROR_ISC_UNSUPPORTED;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -154,6 +154,7 @@ FIRM_OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/sensors/, \
|
|||||||
hm01b0.o \
|
hm01b0.o \
|
||||||
gc2145.o \
|
gc2145.o \
|
||||||
paj6100.o \
|
paj6100.o \
|
||||||
|
frogeye2020.o \
|
||||||
)
|
)
|
||||||
|
|
||||||
FIRM_OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/imlib/, \
|
FIRM_OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/imlib/, \
|
||||||
@ -511,6 +512,7 @@ UVC_OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/sensors/, \
|
|||||||
hm01b0.o \
|
hm01b0.o \
|
||||||
gc2145.o \
|
gc2145.o \
|
||||||
paj6100.o \
|
paj6100.o \
|
||||||
|
frogeye2020.o \
|
||||||
)
|
)
|
||||||
|
|
||||||
UVC_OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/imlib/,\
|
UVC_OBJ += $(addprefix $(BUILD)/$(OMV_DIR)/imlib/,\
|
||||||
|
|||||||
35
src/omv/sensors/frogeye2020.c
Normal file
35
src/omv/sensors/frogeye2020.c
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the OpenMV project.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013-2021 Ibrahim Abdelkader <iabdalkader@openmv.io>
|
||||||
|
* Copyright (c) 2013-2021 Kwabena W. Agyeman <kwagyeman@openmv.io>
|
||||||
|
*
|
||||||
|
* This work is licensed under the MIT license, see the file LICENSE for details.
|
||||||
|
*
|
||||||
|
* FrogEye2020 driver.
|
||||||
|
*/
|
||||||
|
#include "omv_boardconfig.h"
|
||||||
|
#if (OMV_ENABLE_FROGEYE2020 == 1)
|
||||||
|
|
||||||
|
#include "sensor.h"
|
||||||
|
|
||||||
|
static int set_pixformat(sensor_t *sensor, pixformat_t pixformat)
|
||||||
|
{
|
||||||
|
return (pixformat == PIXFORMAT_GRAYSCALE) ? 0 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int set_framesize(sensor_t *sensor, framesize_t framesize)
|
||||||
|
{
|
||||||
|
return (framesize == FRAMESIZE_QVGA) ? 0 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // (OMV_ENABLE_FROGEYE2020 == 1)
|
||||||
15
src/omv/sensors/frogeye2020.h
Normal file
15
src/omv/sensors/frogeye2020.h
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the OpenMV project.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013-2021 Ibrahim Abdelkader <iabdalkader@openmv.io>
|
||||||
|
* Copyright (c) 2013-2021 Kwabena W. Agyeman <kwagyeman@openmv.io>
|
||||||
|
*
|
||||||
|
* This work is licensed under the MIT license, see the file LICENSE for details.
|
||||||
|
*
|
||||||
|
* FrogEye2020 driver.
|
||||||
|
*/
|
||||||
|
#ifndef __FROGEYE2020_H__
|
||||||
|
#define __FROGEYE2020_H__
|
||||||
|
#define FROGEYE2020_XCLK_FREQ (5000000)
|
||||||
|
int frogeye2020_init(sensor_t *sensor);
|
||||||
|
#endif // __FROGEYE2020_H__
|
||||||
Loading…
Reference in New Issue
Block a user