Hardware Configuration Files
All our current displays use the SPI interface. The alternative microcontroller bus, I2C, is about 10x slower than SPI. The SPI intrface interface typically uses 7 wires, which can get a little complex. Just a single wire broken or two wires crossed can will cause the display to not work.
We have dozens of sample programs for each kit. And the exact connections on our kits vary. Rather than hard-coding the hardware pin numbers in each example, we can move them to a separate config.py file. We can then just import that file into each of our examples.
Here is a sample config.py file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
To use this configuration file you will need to do two things:
- import the config file (don't add the .py extension)
- Add the prefix
config.
to each value you would like to reference.
1 2 3 |
|