Re-implement readRect to avoid RX FIFO overflow #40
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.
This fixes #29
The implementation of readRect had an issue where it would not correctly read
the last pixel from the screen. This was caused by an overflow in the RX FIFO
while waiting for the EOQ flag in the last transmitted byte. The loop only
counted transmitted bytes, so it would fill up the TX FIFO and not wait until
the transfer actually happened. Waiting for EOQ competed the queued transfers
and overflowed the RX FIFO since nothing was reading from it.
The new implementation explicitly tracks the number of RX and TX bytes to
ensure that all bytes are correctly transmitted and received. A few ideas
have been borrowed from KurtE/ILI9341_t3n as well:
converted and written to the buffer once all 3 colors have been received.
the dummy byte and the first pixel byte. Instead of using EOQ for the dummy
byte, the results from queued commands and the dummy byte are skipped.