Init SPI Enable clock to GPIO Port A Enable the clock to the SSI module Wait for the SSI module to be ready Program the GPIO to use alternate functions for SSI pins (PA2/3/4/5) Map SSI to those pins. This is a mux value of 2 that we want to use for specifying the function on bits 2, 3, 4, & 5 Enable PA2, 3, 4, and 5 as digital pins Enable PA2, 3, and 5 as outputs Enable PA4 as an input Enable pull up resitor for clock line (PA2) Wait for the SSI0 module to be ready Disable SSI before programming mode bits Select Master mode (MS) and TXIS indicating end of transmit Configure SSI clock source to the system clock Configure clock prescaler Configure clock rate (SCR), phase and polarity (SPH, SPO), mode (FRF), data size (DSS) Locally enable interrupts(TXIM in SSIIM) Enable SSI module Globally enable interrupts Enable NVIC interrupt for SSI when starting to transmit SendCommand Write data to register Unmask the EOT interrupt ReadData Read from data register EOT ISR Mask the EOT interrupt Post EOT event to CommService