SPI transmission protocol in C