user18878: 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? 

user18878: Turns out my google-fu needs work. I found this that works great using hardware SPI! Thanks everyone! 

user10794: 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 & 0b11) << 8;  // move to high-order byte
result |= SPI.transfer (0);   // lower order byte
digitalWrite (SS, HIGH);  // deselect

Untested, but this should be roughly it.

18878: <p>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 <a href="https://github.com/nodesign/MCP3008" rel="nofollow">here</a> the library is ported from Adafruit's Raspberry Pi library <a href="https://learn.adafruit.com/reading-a-analog-in-and-controlling-audio-volume-with-the-raspberry-pi/script" rel="nofollow">here</a>. 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? </p>
 18878: <p>Turns out my google-fu needs work. I found <a href="https://rheingoldheavy.com/mcp3008-tutorial-02-sampling-dc-voltage/" rel="nofollow">this</a> that works great using hardware SPI! Thanks everyone! </p>
 10794: <p>The standard AVR library has SPI handling. See, for example: <a href="http://www.gammon.com.au/spi" rel="nofollow noreferrer">http://www.gammon.com.au/spi</a></p>

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

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

<p><a href="https://i.stack.imgur.com/Djtxp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Djtxp.png" alt="MCP3008 timings"></a></p>

<p>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:</p>

<pre><code>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
</code></pre>

<p>Untested, but this should be roughly it.</p>
