I'm working on a project where I'm emulating a TSC2046 Touchscreen driver (https://www.ti.com/product/TSC2046) which is an SPI Slave using the Teensy 4.1 board. The master polls the slave ~60 times per second, with gaps in between each polling frame.

The SPI CLK oscillates at ~2 Mhz.

The first 8-bit command checks if the touchscreen is pressed, followed by a 16 bit response from the slave (though the last 4 bits aren't used, so it's only sending 12 bits of data over). Depending on the response, the master may or may not continue polling for more info in the polling frame. If it continues, it will poll 4 times, the first two for the X coordinates, and the second two for the Y coordinates. The commands are 8 bits, and it expects 16 bits. There is a time when both MISO and MOSI are active.

For each polling frame, I would have set responses given the command.

Between polling frames, there is around 16 ms, which should be more than enough for me to update what the responses are depending on the SPI command.

Below is a zoomed out logic analyzer image as well as one of a single polling frame, and one zoomed in a bit more of the first part of a polling frame.

What's the best way to go about doing this project?

Click image for larger version. 

Name:	logic1.jpg 
Views:	7 
Size:	46.1 KB 
ID:	20945

Click image for larger version. 

Name:	logic2.jpg 
Views:	5 
Size:	47.1 KB 
ID:	20951

Click image for larger version. 

Name:	logic3.jpg 
Views:	9 
Size:	44.8 KB 
ID:	20952