We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bd5f200 commit 4f02678Copy full SHA for 4f02678
src/linux.rs
@@ -300,8 +300,17 @@ impl<'a> I2CTransfer<'a> for LinuxI2CDevice {
300
301
/// Issue the provided sequence of I2C transactions
302
fn transfer(&mut self, messages: &'a mut [Self::Message]) -> Result<u32, LinuxI2CError> {
303
+ let msg_type = |flag: u16| flag & I2CMessageFlags::READ.bits();
304
+ let mut prev_msg_type = !msg_type(messages[0].flags);
305
for msg in messages.iter_mut() {
306
msg.addr = self.slave_address;
307
+
308
+ let cur_msg_type = msg_type(msg.flags);
309
+ if prev_msg_type == cur_msg_type {
310
+ msg.flags |= I2CMessageFlags::NO_START.bits();
311
+ } else {
312
+ prev_msg_type = cur_msg_type;
313
+ }
314
}
315
ffi::i2c_rdwr(self.as_raw_fd(), messages).map_err(From::from)
316
0 commit comments