Skip to content

Commit 732b815

Browse files
ydamigosioannisg
authored andcommitted
i2c_ll_stm32: Allow to send zero length message
Some applications, like i2c_scanner, require to send zero length messages. Signed-off-by: Yannis Damigos <[email protected]>
1 parent bb66b29 commit 732b815

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/i2c/i2c_ll_stm32.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static int i2c_stm32_transfer(struct device *dev, struct i2c_msg *msg,
119119
next = current + 1;
120120
next_msg_flags = &(next->flags);
121121
}
122-
while (current->len > 0) {
122+
do {
123123
u32_t temp_len = current->len;
124124
u8_t tmp_msg_flags = current->flags & ~I2C_MSG_RESTART;
125125
u8_t tmp_next_msg_flags = next_msg_flags ?
@@ -152,7 +152,7 @@ static int i2c_stm32_transfer(struct device *dev, struct i2c_msg *msg,
152152
current->buf += current->len;
153153
current->flags = tmp_msg_flags;
154154
current->len = temp_len - current->len;
155-
}
155+
} while (current->len > 0);
156156
current++;
157157
num_msgs--;
158158
}

0 commit comments

Comments
 (0)