SSD1306 via Hardware SPI

Just to make things even clearer than @kennethlimcp has already done:

The DC or D/C pin is needed by some devices to distinguish between commands or data for the controler.
Since SPI only pushes out anonymous bitsreams the user code has to “tell” the controler if this will be a command (e.g. D/C LOW) or a data (e.g. D/C HIGH) bitstream. And so D/C is not actually an SPI pin, but this gives you freedom which Core pin to choose.

Similarly the Reset pin can be chosen freely or even pulled high or left open if it’s pulled high on the board already, if you don’t need to reset the device via user code.

The CS pin is a kind of hybrid here. While SPI brings its own version of it (SS) you might want to use any other free digital pin if you’d like to attach multiple SPI devices, selecting each individual one via its own designated chip select pin.
For each SPI stream only one CS should be active to ensure that only the meant device listens to it.
And since only user code “knows” who is meant at a given time you have to decide which Core pin to use as CS for which device.

2 Likes