Closed Phonog closed 3 years ago
I've pushed a new version which I believe fixes this problem. I've used one of the methods you suggested and have credited you as a contributor.
Another user also highlighted the need to configure buffers. I have added a new example which shows this and also improved the README.
Many thanks.
I have implemented a I2C master on a STM32F103 and it works correctly. However, while performing tests, I did an experiment: I shorted the scl line to ground, to see whether this was correctly handled. My application then crashed. After a long examination, I found that in such a case there is an infinite indirect recursion, thus the crash. The problem lies in the function
sclHighAndStretch
. In case of a timeout, it calls the functionstop
which itself callssclHighAndStretch
. We need a way to break this recursion. I see two ways:sclHighAndStretch
to hold it from callingstop
again. orstop2
code for this instance, that does not callsclHighAndStretch
again.PS : advice : in the description of the library, it would be useful to specify that the user needs to supply a read and a write buffer at initialisation time. I had a hard time figuring out what was wrong until I discovered this. I used to use a library from Roger Clark's package that was very close, but that did not require buffers to be supplied, so I was not aware of the need of buffers.