Skip to content

Safer i2c#125

Open
Uthedris wants to merge 12 commits intouraimo:masterfrom
Uthedris:Safe-I2C
Open

Safer i2c#125
Uthedris wants to merge 12 commits intouraimo:masterfrom
Uthedris:Safe-I2C

Conversation

@Uthedris
Copy link
Contributor

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.
@Uthedris
Copy link
Contributor Author

Uthedris 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

2 participants