Expand description
SPI clock modes and bit order.
SPI has no addressing and no framing of its own: a transfer is just bytes clocked in and out at the same time. What a controller and a peripheral must agree on is when the clock idles and which clock edge samples data - the two bits CPOL (clock polarity) and CPHA (clock phase) - and whether each byte travels most- or least-significant bit first. Datasheets quote the CPOL/CPHA pair as a single mode number from 0 to 3, and the commonest cause of a dead SPI link is a transposed pair or the wrong mode. This module makes the mode a checked value rather than two loose booleans a caller can swap.