#include "../../io/GPIO.h" #include "../../Debug.h" template class MCP42xxx { private: SPI& spi; public: /** ctor */ MCP42xxx(SPI& spi) : spi(spi) { ; } void setVolume(const uint8_t vol) { debugMod1(TAG, "setVolume(%d)", vol); MyGPIO::setOutput(PIN_CS); MyGPIO::clear(PIN_CS); const uint8_t cmd = 0b00010011; // xx 01=write xx 11=both spi.writeByte(cmd); spi.writeByte(vol); MyGPIO::set(PIN_CS); } };