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

[embassy-rp] I2C transaction sends SR between operations of equal type #3254

Closed
WBosonic opened this issue Aug 13, 2024 · 1 comment
Closed

Comments

@WBosonic
Copy link

I encountered this bug in rp-rs/rp-hal#825, and a look at the I2C code in embassy-rp shows that it has the same bug.

In essence an SR is sent between operations of equal type, this can cause unexpected behavior in e.g:

fn write(&mut self, mut reg: u16, data: &[u8]) -> Result<(), Error<I2C::Error>> {
    self.i2c.transaction(self.address, &mut [Operation::Write(&reg.to_be_bytes()), Operation::Write(data)])?;
}

as to avoid the SR all data must be copied into a single slice.

@WBosonic
Copy link
Author

It turns out the bug wasn't in the place I thought it was, and embassy-rp seems to handle it correctly, my bad.

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

No branches or pull requests

1 participant