added mode select and SPI helper functions