Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The pn532 states in its datasheet that the i2c stop and start conditions require atleast 1.3 ms between them. Currently, there is a nanosleep of 90 ms which seems arbitrarily chosen (nothing in the comments/git log from it). A delay however is always needed, as otherwise we write to fast for sure.
Additionally, this delay is not always added everywhere, so we still sometimes send data way to fast for the pn532. This patch creates wrappers around i2c_read and i2c_write to ensure proper timing of read and write commands.
Additionally we clarify the preamble/start condition a bit, as there was a bug in the text. No code changes where done in that regard.
Note, I have tested it on one board on one machine and not yet endlessly. So I'd like to first properly review this first before merging :)
edit: I cleaned some more on the preamble bit, and added a retry mechamism to the pn532_send() routine.