diff options
author | Timofey Titovets <nefelim4ag@gmail.com> | 2024-09-23 01:24:29 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-22 19:24:29 -0400 |
commit | d9236f1c20ea603e456f959d0914b72b1d730e86 (patch) | |
tree | 59435347421e9b39a17f9a511e4ce58aac0b4941 /src/stm32/i2c.c | |
parent | 8a5801a204a2491bcf64127e6ade1c24875c7b74 (diff) | |
download | kutter-d9236f1c20ea603e456f959d0914b72b1d730e86.tar.gz kutter-d9236f1c20ea603e456f959d0914b72b1d730e86.tar.xz kutter-d9236f1c20ea603e456f959d0914b72b1d730e86.zip |
STM32: Check for NACK (#6687)
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
Diffstat (limited to 'src/stm32/i2c.c')
-rw-r--r-- | src/stm32/i2c.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/stm32/i2c.c b/src/stm32/i2c.c index f5bbd01d..4bb8b105 100644 --- a/src/stm32/i2c.c +++ b/src/stm32/i2c.c @@ -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"); } |