I'm trying to program the SPI in Python but the documentation is terrible. SPI Docs
I found some sites that show how to get started but I need to know how to change modes, set clock polarity, and set clock idle state. I can't find anything on the internet that shows how to do this in Python. One site showed code for mode = 0, but what is mode 0?
Here is the code I have for setting it up.
# We only have SPI bus 0 available to us on the Pi bus = 0 #Device is the chip select pin. Set to 0 or 1, depending on the connections device = 0 #worked on 0 and 1 # Enable SPI spi = spidev.SpiDev() # Open a connection to a specific bus and device (chip select pin) spi.open(bus, device) # Set SPI speed and mode spi.max_speed_hz = 500000 spi.mode = 1