MajenkoLibraries / MCP3208

Arduino library for MCP3208 8 channel, 12 bit, ADC chip
BSD 3-Clause "New" or "Revised" License
20 stars 7 forks source link

Feature Request: Use SPI transactions #1

Open mhaas opened 9 years ago

mhaas commented 9 years ago

Using SPI transactions would make the code slightly more robust: http://dorkbotpdx.org/blog/paul/spi_transactions_in_arduino

Thanks for the library, it's working great here.

majenkotech commented 9 years ago

While SPI transactions would be nice, they aren't widely supported on other platforms (or not officially yet). For instance, I only added SPI transactions to the SPI driver on the chipKIT platform last week, and it's not available in any release version yet.

Personally I much prefer the model of "Request a device from the SPI driver and do all operations on that device" which I use internally. I have a special SPIBus driver from which you request an SPIDevice object which encompasses all the mode, baud, etc settings. You then perform the transfer() operations on the device, not the bus. One day I will get round to releasing it when it's all polished and working nicely.

In due course, when all the primary platforms have SPI Transaction support in their release versions I will be using it more extensively. Until then I need to maintain compatibility.

mhaas commented 9 years ago

Thanks for the feedback! I don't really need it, I just figured I would bring it to your attention. But as I can see, you have everything under control there ;)