replacing usart module with SPI function