Skip to content

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

Closed
@WBosonic

Description

@WBosonic

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions