TFT Display with SPI, blocking while updating

I wasnt quite sure where to ask this.

I've got a project using the adafruit 1.8" tft display with the adafruit libraries (the basis of the current arduino tft library). Its all working fine, but when you update the display over SPI, the code is effectively blocking. Writing say 16 characters has a loop execution time of ~70 milli seconds.

Now, Im also using a button to control a menu, capturing two events; short press & long press, with a debounce function in both software and hardware.

My worry is that as my display gets busier, theres a risk the SPI activity could block my ability to detect short button press events (ie two successive short presses could be mistaken for a single long press).

Has anyone come across this before? If so, how did you resolve it?

Im starting to think I might have to capture button events using interrupts, rather than just using the interrupt as a 'wake up' function....of course that then begs the question would the interrupt actually pause the SPI activity. questions... always questions ;)

Yes, it is a problem, and it will always be a problem the way the Arduino SPI works.

Ways to help solve it are:

  1. Use interrupt driven SPI, so you can do other things while the SPI data is being transmitted by the hardware
  2. Use a board that can run SPI considerably faster
  3. Don't use SPI.

Personally I use a combination of all three. I use a PIC32 board, or a Due board, and use the parallel interface module to communicate with a parallel interfaced TFT screen using interrupt based code.

I can achieve a full frame refresh rate at 320x240 (storing an 8-bit frame buffer in memory and expanding to 332 to 565 on the fly) of around 10 to 15 frames per second.

You'll never get that kind of speed with SPI, and certainly not on a board that has an upper limit of 8 MHz SPI clock using code that waits in a while loop for each byte to finish transmitting.

Thanks, at least Im not going insane (well, no more so than usual).

I just tried a quick googling on interrupt driven SPI but didnt find much in the way of explanation. I dont suppose you have a pointer/link/document/fag packet diagram for further reading?