Skip to content

Commit

Permalink
stm32/i2c: define NACK
Browse files Browse the repository at this point in the history
Signed-off-by: Timofey Titovets <[email protected]>
  • Loading branch information
nefelim4ag committed Sep 13, 2024
1 parent 30ff869 commit abe2716
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/stm32/i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ i2c_wait(I2C_TypeDef *i2c, uint32_t set, uint32_t clear, uint32_t timeout)
uint32_t sr1 = i2c->SR1;
if ((sr1 & set) == set && (sr1 & clear) == 0)
return sr1;
if (sr1 & I2C_SR1_AF)
shutdown("I2C NACK error encountered");
if (!timer_is_before(timer_read_time(), timeout))
shutdown("i2c timeout");
}
Expand Down

0 comments on commit abe2716

Please sign in to comment.