Skip to content
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

Feature/support sccb handle 16bit val #474

Merged

Conversation

WangYuxin-esp
Copy link
Contributor

No description provided.

@WangYuxin-esp
Copy link
Contributor Author

@me-no-dev Some sensor registers need to read and write 16 bit values, so two APIs have been added. PTAL,Thanks.

if(ret != ESP_OK) {
ESP_LOGE(TAG, "W [%04x]=%04x fail\n", reg, data);
}
return ret == ESP_OK ? 0 : -1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe switch return type to esp_err_t, because currently you have it as uint8_t, but here you are returning -1

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this would need to be done for the other write methods as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current sensor driver code has many expressions similar to if(SCCB_Write() < 0), so although the return value type can be defined as esp_err_t in the function declaration, in the relevant code, we only check whether the return value of the function is less than 0. Therefore, there are two options.

  1. We only define the return value type of the function as esp_err_t in the function declaration, and do not really return the return value of the i2c_master_cmd_begin().
  2. Or we can directly define the return value of this function as type int.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in that case, using int or int8_t would also do the job

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return value of sccb_write() has been changed to type int.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@me-no-dev ,At present, it is not easy to buy some cameras that support JPEG encoding. A new sensor driver can work normally, but the current submission is required. If there is no problem, please help merge the submission. We will submit the driver code of the new camera as soon as possible. thanks.

@me-no-dev me-no-dev merged commit c3eacc8 into espressif:master Nov 10, 2022
@me-no-dev
Copy link
Member

It's in :)

@WangYuxin-esp WangYuxin-esp deleted the feature/support_sccb_handle_16bit_val branch November 11, 2022 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants