Fix default OV5640 SYSTEM_CTROL0 value in sleep()

This commit is contained in:
iabdalkader 2021-01-21 19:41:27 +02:00
parent a24a9b6202
commit 6954b6d858

View File

@ -644,6 +644,7 @@ static const uint8_t saturation_regs[NUM_SATURATION_LEVELS][6] = {
static int reset(sensor_t *sensor) static int reset(sensor_t *sensor)
{ {
int ret = 0;
readout_x = 0; readout_x = 0;
readout_y = 0; readout_y = 0;
@ -653,7 +654,7 @@ static int reset(sensor_t *sensor)
hts_target = 0; hts_target = 0;
// Reset all registers // Reset all registers
int ret = cambus_writeb2(&sensor->bus, sensor->slv_addr, SCCB_SYSTEM_CTRL_1, 0x11); ret |= cambus_writeb2(&sensor->bus, sensor->slv_addr, SCCB_SYSTEM_CTRL_1, 0x11);
ret |= cambus_writeb2(&sensor->bus, sensor->slv_addr, SYSTEM_CTROL0, 0x82); ret |= cambus_writeb2(&sensor->bus, sensor->slv_addr, SYSTEM_CTROL0, 0x82);
// Delay 5 ms // Delay 5 ms
@ -699,9 +700,9 @@ static int sleep(sensor_t *sensor, int enable)
int ret = cambus_readb2(&sensor->bus, sensor->slv_addr, SYSTEM_CTROL0, &reg); int ret = cambus_readb2(&sensor->bus, sensor->slv_addr, SYSTEM_CTROL0, &reg);
if (enable) { if (enable) {
reg |= 0x40; reg |= 0x42;
} else { } else {
reg &= ~0x40; reg &= ~0x42;
} }
return cambus_writeb2(&sensor->bus, sensor->slv_addr, SYSTEM_CTROL0, reg) | ret; return cambus_writeb2(&sensor->bus, sensor->slv_addr, SYSTEM_CTROL0, reg) | ret;