Merge pull request #1425 from openmv/fix_read_reg

Fix sensor.read_reg
This commit is contained in:
Ibrahim Abd Elkader 2021-08-06 18:05:52 +02:00 committed by GitHub
commit af5fecf88a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -482,17 +482,19 @@ __weak int sensor_shutdown(int enable)
__weak int sensor_read_reg(uint16_t reg_addr)
{
int ret;
// Check if the control is supported.
if (sensor.read_reg == NULL) {
return SENSOR_ERROR_CTL_UNSUPPORTED;
}
// Call the sensor specific function.
if (sensor.read_reg(&sensor, reg_addr) == -1) {
if ((ret = sensor.read_reg(&sensor, reg_addr)) == -1) {
return SENSOR_ERROR_IO_ERROR;
}
return 0;
return ret;
}
__weak int sensor_write_reg(uint16_t reg_addr, uint16_t reg_data)