Re-posting of a package I put together last year on XMOSlinkers.
The MCP3208 is a 12-bit SAR ADC from MicroChip. The 3208 has 8 input pins, multiplexed to a 100 ksps ADC. The MCP3204 uses the same instructions, but has 4 input pins.
This is a short library to allow running the ADC over SPI; I've implemented in-thread functions, but also a separate thread that periodically sends samples from any/all multiplexed pins through a channel.