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

Safer i2c #125

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Safer i2c #125

wants to merge 12 commits into from

Conversation

curuvar
Copy link
Contributor

@curuvar curuvar commented Nov 22, 2021

What's in this pull request?

Update I2C functions that don't abort when communication errors occur.

Is there something you want to discuss?

I have been working on a project using the Qwiic cables to communicate with a slave device. The problem is that the current functions cause the master application to abort whenever the slave goes into debug.

I modified the various write functions to return a discardable Bool result, and added variants of the read functions that return optional results. I left the current read functions that return actual values intact, so as not to break anyones existing code.

Pull Request Checklist

  • [ x] I've added the default copyright header to every new file.
  • [ x] Every new file has been correctly indented, no tabs, 4 spaces (you can use swiftlint).
  • [ x] Verify that you only import what's necessary, this reduces compilation time.
  • [ x] Try to declare the type of every variable and constant, not using type inference greatly reduces compilation time.
  • [ x] Verify that your code compiles with the currently supported Swift version (currently 4.1.3)
  • [ x] You've read the contribution guidelines.

@curuvar
Copy link
Contributor Author

curuvar commented Dec 7, 2021

I added the readRaw function to allow multi-byte reads without sending a register number

@ea7kir
Copy link

ea7kir commented Mar 1, 2022

I wish someone would get this fixed so it can be merged. It works fine on the official 64bit Raspberry OS.

@ea7kir
Copy link

ea7kir commented Jun 2, 2022

Please merge this necessary request. I've been using it for months without issue. The only problem I see is that here its called "Safer i2C" whereas curuva calls it "Safe-I2C". The failed details say "The log was not found. It may have been deleted based on retention settings". I think this means "don't worry about it".

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