Added SPI read/write functions.