Skip to content

Add solarize effect #6

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

Merged
merged 1 commit into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion sensors/ov5640.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
static const char *TAG = "ov5640";
#endif

#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))

//#define REG_DEBUG_ON

static int read_reg(uint8_t slv_addr, const uint16_t reg){
Expand Down Expand Up @@ -790,7 +792,7 @@ static int set_awb_gain_dsp(sensor_t *sensor, int enable)
static int set_special_effect(sensor_t *sensor, int effect)
{
int ret=0;
if (effect < 0 || effect > 6) {
if (effect < 0 || effect >= ARRAY_SIZE(sensor_special_effects)) {
return -1;
}

Expand Down
3 changes: 2 additions & 1 deletion sensors/private_include/ov5640_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,14 +248,15 @@ static const DRAM_ATTR uint8_t sensor_saturation_levels[9][11] = {
{0x1d, 0x60, 0x03, 0x11, 0xa8, 0xb9, 0xaf, 0x96, 0x19, 0x01, 0x98},//+4
};

static const DRAM_ATTR uint8_t sensor_special_effects[7][4] = {
static const DRAM_ATTR uint8_t sensor_special_effects[][4] = {
{0x06, 0x40, 0x2c, 0x08},//Normal
{0x46, 0x40, 0x28, 0x08},//Negative
{0x1e, 0x80, 0x80, 0x08},//Grayscale
{0x1e, 0x80, 0xc0, 0x08},//Red Tint
{0x1e, 0x60, 0x60, 0x08},//Green Tint
{0x1e, 0xa0, 0x40, 0x08},//Blue Tint
{0x1e, 0x40, 0xa0, 0x08},//Sepia
{0x06, 0x40, 0x2c, 0x09},//Solarize
};

static const DRAM_ATTR uint16_t sensor_regs_gamma0[][2] = {
Expand Down