added code for interfacing with spi