Skip to content

Commit 7503531

Browse files
authored
Merge pull request #6 from adafruit/solarize
Add solarize effect
2 parents 6843260 + 2758089 commit 7503531

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

sensors/ov5640.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
static const char *TAG = "ov5640";
2525
#endif
2626

27+
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
28+
2729
//#define REG_DEBUG_ON
2830

2931
static int read_reg(uint8_t slv_addr, const uint16_t reg){
@@ -790,7 +792,7 @@ static int set_awb_gain_dsp(sensor_t *sensor, int enable)
790792
static int set_special_effect(sensor_t *sensor, int effect)
791793
{
792794
int ret=0;
793-
if (effect < 0 || effect > 6) {
795+
if (effect < 0 || effect >= ARRAY_SIZE(sensor_special_effects)) {
794796
return -1;
795797
}
796798

sensors/private_include/ov5640_settings.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,14 +248,15 @@ static const DRAM_ATTR uint8_t sensor_saturation_levels[9][11] = {
248248
{0x1d, 0x60, 0x03, 0x11, 0xa8, 0xb9, 0xaf, 0x96, 0x19, 0x01, 0x98},//+4
249249
};
250250

251-
static const DRAM_ATTR uint8_t sensor_special_effects[7][4] = {
251+
static const DRAM_ATTR uint8_t sensor_special_effects[][4] = {
252252
{0x06, 0x40, 0x2c, 0x08},//Normal
253253
{0x46, 0x40, 0x28, 0x08},//Negative
254254
{0x1e, 0x80, 0x80, 0x08},//Grayscale
255255
{0x1e, 0x80, 0xc0, 0x08},//Red Tint
256256
{0x1e, 0x60, 0x60, 0x08},//Green Tint
257257
{0x1e, 0xa0, 0x40, 0x08},//Blue Tint
258258
{0x1e, 0x40, 0xa0, 0x08},//Sepia
259+
{0x06, 0x40, 0x2c, 0x09},//Solarize
259260
};
260261

261262
static const DRAM_ATTR uint16_t sensor_regs_gamma0[][2] = {

0 commit comments

Comments
 (0)