Arduino library to wrap SPI device classes
While writing several supoport libraries for several devices it became cumbersome to keep implementing the read/write functions and sorting out the byte order for each device. That is what this libary supports.
It's major features are:
- Wrap the SPI functions such that:
- Set the specific SPI parameters on a per device basis
- Handle the CS pin, whether software or hardware controlled
There is a twin: lib-TwoWireDevice
Inherited your devices from SPIDevice:
[TODO]
[TODO]
Personally I find it good practice to, at first, disable copy constructors and assignment operators until I've thought about them. In TwoWireDevices this is seldom something you want to support, I guess.. So I've disabled them in TwoWireDevice.h. Implement your own in your (inherited) device to re-enable them after you have done the thinking ;)
private:
TwoWireDevice(const TwoWireDevice&);
TwoWireDevice& operator=(const TwoWireDevice&);
I'm an advocate of Platform-IO. To use this library with your PlatformIO project, add this to you platformio.ini environment:
lib_deps =
https://github.com/knifter/lib-SPIDevice
Some example devices are between my github repositories, like: