During MODE_LISTEN, the timeout counter is only incremented/checked if the input level is low. If the input level stays high, the code will alternate between MODE_LISTEN and MODE_READ forever.
This means that the code would be stuck in a loop if the slave keeps the bus in such state that the input pin is high, which is unlikely during normal operation but can happen if the connections are wrong.
Moreover, this condition is impossible to detect without circumventing the library. Perhaps an additional error code could be added instead of just going back to MODE_LISTEN when something goes wrong during MODE_READ
During
MODE_LISTEN
, the timeout counter is only incremented/checked if the input level is low. If the input level stays high, the code will alternate betweenMODE_LISTEN
andMODE_READ
forever.This means that the code would be stuck in a loop if the slave keeps the bus in such state that the input pin is high, which is unlikely during normal operation but can happen if the connections are wrong.
Moreover, this condition is impossible to detect without circumventing the library. Perhaps an additional error code could be added instead of just going back to
MODE_LISTEN
when something goes wrong duringMODE_READ