Refactored SPI buffer conversion