Skip to content

Readregion api change #29

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 20 commits into from
Dec 14, 2023
Merged

Readregion api change #29

merged 20 commits into from
Dec 14, 2023

Conversation

SFE-Brudnerd
Copy link
Contributor

Adds in gitignore and gitattributes files.
Rework readRegisterRegion to return error type and have an output argument for the number of bytes read.
Makes default stop value false so as to not send a stop mid-read.
Make readRegisterRegion take in a reference rather than a pointer.
Rev to 0.9.0.

@SFE-Brudnerd
Copy link
Contributor Author

SFE-Brudnerd commented Dec 13, 2023

This matches most implementations of modern I2C devices. By sending a stop command after sending the device register address rather than a repeat start, you end the transaction early and leave the bus in an odd state. This corrects this and also corrects how the continued read of values in the requestFrom function operates. Prior to this, it would always send a stop if it was done, or send stop() (default to true, aka the same thing).

In ADS1219 datasheet:
image

In AS7331 datasheet:
image

In my experience this is the default behavior, and less capable devices should setStop() to true if they need it.

Add include directive.
PaulZC
PaulZC previously requested changes Dec 14, 2023
Add to docs for pointing out enabling repeat start.
@SFE-Brudnerd SFE-Brudnerd requested a review from PaulZC December 14, 2023 15:03
@SFE-Brudnerd
Copy link
Contributor Author

Should we use readRegisterRegion in readRegisterByte()?

Copy link
Contributor

@PaulZC PaulZC left a comment

Choose a reason for hiding this comment

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

Looking good!

Should we use region in byte? Nah... ;-)

Copy link
Member

@gigapod gigapod left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@gigapod gigapod merged commit 39a44e1 into main Dec 14, 2023
@gigapod gigapod deleted the readregion_api_change branch December 14, 2023 18:44
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.

3 participants