Skip to content

Commit f60a914

Browse files
suslic2012o-marshmallow
authored andcommitted
I2C: Fix I2C Master operation with repeated start condition
* Closes #8353
1 parent 4758377 commit f60a914

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

components/driver/i2c.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1342,7 +1342,9 @@ static void IRAM_ATTR i2c_master_cmd_begin_static(i2c_port_t i2c_num)
13421342
p_i2c->cmd_idx = 0;
13431343
if (i2c_cmd_is_single_byte(cmd) || cmd->total_bytes == cmd->bytes_used) {
13441344
p_i2c->cmd_link.head = p_i2c->cmd_link.head->next;
1345-
p_i2c->cmd_link.head->cmd.bytes_used = 0;
1345+
if(p_i2c->cmd_link.head) {
1346+
p_i2c->cmd_link.head->cmd.bytes_used = 0;
1347+
}
13461348
}
13471349
p_i2c->status = I2C_STATUS_WRITE;
13481350
break;

0 commit comments

Comments
 (0)