Software SPI (in a Gadgeteer app)

Hi, I have a relatively dumb device that has an SPI-like (read only) protocol, that I intend to use connected to a Gadgeteer mainboard. Actually, I intend to have multiple of these devices connected at once; to the same Gadgeteer socket, and sharing MISO and SCK lines but each with their own CS line. The chip is slow enough that I’m just going to bitbang it, theres no need to do actual SPI; so this can be done from a Y socket rather than just an S (a limited resource!).

There are a couple of things that I’m thinking about. First, I will want to reserve the entire socket its connected to, no matter how many “devices” there are. Second, I then want multiple devices to leverage the socket standard pins (MISO, SCK). So I am thinking a concept similar to the I2C bus + device setup; a class that manages the socket, and a class that manages the interaction with a single device. Actually that’s the only way I’m thinking about it since I can’t picture a different way to deal with it?

Anyone with thoughts or alternative stances? Or have written something that I could look at to see implementation patterns?

Interesting. Unless I missed something, I don’t see why not.

That will require two sockets for SPI module and the maximum number of modules you will be able to connect on one S socket is 4.

10 - 3(MOSI, MISO, SCK) - 3(3V3, 5V, GND) = 4