First, can I choose any data pin for CS?
Second, I want to make sure I'm doing this right. D/C is still needed, and just like CS, I can choose an arbitrary data pin...?
Depends, which Teensy are you using?
If it is a Teensy 3.x, then for some of these libraries like ILI9341_t3 may require special pins to be used, especially for the DC pin.
However on the Teensy 4.x any digital pin should work. Some of these libraries might get a slight boost in performance if the DC pin is
on one of the Hardware CS pins.
Shortish version of why: When you do things like lets say set a pixel:
The code needs to set the address, followed, by the data. This can look something like:
Code:
<caset>x1 x2 <paset> y1 y2 <write mem> color...
the parts within <> are commands. For these we need to set DC low output the command and set it High again before we we
write out the non command bytes like x1 and x2 (which are two bytes each).
Without DC being on special CS pin, the code has to wait until all data has been output over the SPI pins, before it can change
the state of the DC pin, which introduces gaps in the output of data. Where as with DC on hardware CS pin we can tell the
SPI subsystem to update the state of that pin after the data has output and already queue up the next data to be output.
On T3.x - SPI allows multiple CS pins to be updated at the same time, where as on T4.x you can only choose one (by index)
of the CS pins to be updated. So on T3.x some libraries only would run if both were on CS pins. Later in some of them I relaxed
it slightly to only require DC. And on T4.x would run regardless...