Commit 120cea1
[I2C] Fix error reporting on I2C timeout
When this timeout is triggered, I2C_OK was returned. This happens because in the
loop above, it checks for `(delta < I2C_TIMEOUT_TICK)`, so it breaks out of the
loop as soon as `delta == I2C_TIMEOUT_TICK`. Then, the if below checks for
`(delta > I2C_TIMEOUT_TICK)`, which is not yet false. Since the hardware reports
no errors either, I2C_OK was returned.
By using `>=` in the if rather than `>`, this is fixed and I2C_TIMEOUT is now
returned instead.1 parent c4b96a7 commit 120cea1
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
813 | 813 | | |
814 | 814 | | |
815 | 815 | | |
816 | | - | |
| 816 | + | |
817 | 817 | | |
818 | 818 | | |
819 | 819 | | |
| |||
887 | 887 | | |
888 | 888 | | |
889 | 889 | | |
890 | | - | |
| 890 | + | |
891 | 891 | | |
892 | 892 | | |
893 | 893 | | |
| |||
0 commit comments