Convert library from using bitbanging to hardware SPI I'm using a MCP3008 8ch 10bit ADC to expand the Analog Inputs for the project I'm working on. The only library I can find for it is here the library is ported from Adafruit's Raspberry Pi library here. From what I can tell the library uses bitbanging as opposed to hardware SPI in order to communicate. I would like to use hardware SPI, but don't have the skills to write a library to communicate with it myself. Are there any resources for how to write a library like that, or anything I can read about on how to convert a library from bitbanging to hardware SPI?
The standard AVR library has SPI handling. See, for example: http://www.gammon.com.au/spi

You don't have to write a library if you don't want, just communicate directly using SPI.

The datasheet for the MCP3008 has some tips for using an 8-bit SPI system to communicate with the device. In particular this chart:



You can see from that, that you will need 3 x SPI.transfer. I don't have one here to test with, but the code would look like this:

digitalWrite (SS, LOW);  // select device
int result;
SPI.transfer (0x01);  // start bit
result = SPI.transfer (0b10000000);  // single, ch0
result = (result &amp; 0b11) &lt;&lt; 8;  // move to high-order byte
result |= SPI.transfer (0);   // lower order byte
digitalWrite (SS, HIGH);  // deselect


Untested, but this should be roughly it.