I found that readRect will never read the last pixel.
The below sketch reproduces the problem using the Teensy 3.1, the Adafruit shield and the latest stable Teensyduino.
I fixed it by just incrementing c in readRect, but that's probably not the correct solution.
It seems on the last byte you clear the SR register, which makes the check if there are 3 bytes in the FIFO fail, but not knowing the meaning of all the SPI registers I was unable to quickly see the correct solution.
I found that
readRect
will never read the last pixel.The below sketch reproduces the problem using the Teensy 3.1, the Adafruit shield and the latest stable Teensyduino.
I fixed it by just incrementing
c
inreadRect
, but that's probably not the correct solution. It seems on the last byte you clear theSR
register, which makes the check if there are 3 bytes in the FIFO fail, but not knowing the meaning of all the SPI registers I was unable to quickly see the correct solution.