I'm trying to connect a model B rev 2 Raspberry Pi to a whole bunch of stuff to create a MIDI foot controller:
- Adafruit touch screen
- 20 switches (some foot, some encoder buttons)
- 8 x SPI LED drivers (TLC5925 chips in 4 groups of 2)
- MIDI in / out ports
- 6 quadrature encoders (Each: 2 IO for rotation, 1 IO for button)
The screen just clicks onto the Pi without hassle.. it's already working but it eats quite a number of pins. The current pin-out of the Pi is as follows:
P1:
01: +3.3V power
02: +5V power
03: SDA i2c1: SCREEN
04: +5V power
05: SCL i2c1: SCREEN
06: GND
07: --free--
08: UART transmit: MIDI
09: GND
10: UART receive: MIDI
11: --free--
12: --free--
13: --free-- (GPIO 23)
14: GND
15: --free-- (GPIO 22)
16: --free-- (GPIO 23)
17: +3.3v power
18: GPIO: SCREEN
19: SPI MOSI: SCREEN
20: GND
21: SPI MISO: SCREEN
22: GPIO: SCREEN
23: SPI SCLK: SCREEN
24: SPI SC0: SCREEN?
25: GND
26: SPI SC1: SCREEN?
P5:
01: +5V
02: +3.3V
03: i2c0 SDA: LED ring driver (GPIO 28)
04: i2c0 SCL: LED ring driver (GPIO 29)
05: --free-- (GPIO 30)
06: --free-- (GPIO 31)
07: GND
08: GND
I already have a lot of code and experience with all of these components individually. But I'm overwhelmed with the quantity of input and output required to make this work.
There is currently 10 free GPIO pins. 2 of which could be used for hardware I2C.
By my estimate I need these GPIO pins:
Inputs:
12: Encoders x 6 @ 2 channels each
6: Encoder buttons
14: Foot switches
Outputs:
3: common SPI lines
4: SPI select lines
Or 32 inputs, 7 outputs.
Anyway. I'm assuming there isn't some nice way of addressing all those SPI devices in hardware and I'll probably have to bit bash them in software. I don't like the idea of chaining them all together into one long SPI device (although it's physically possible) because of the chance for errors to propagate down the chain and also the time taken to update all those bits just to change the state of one LED. I much prefer shorter chains where I can address things quickly. Also if there is a hardware fault in one chain it doesn't effect all the others.
Is there a break out board that I can drive via I2C maybe?
Other ideas?