#ifndef _I2C_HPP_ #define _I2C_HPP_ #include #include #include #include #if 0 // i2c channels enum i2c_ch { i2c_ch0, i2c_ch1 }; #endif // // template // template class I2C { public: I2C(); void writeByte(const uint8_t& address, const uint8_t& byte) { pimpl->writeByte(address, byte); } private: //struct pimpl_T; std::unique_ptr pimpl; }; template I2C::I2C():pimpl(new impl()){} template I2C::~I2C(){} template void I2C::readByte(const uint8_t& address, const uint8_t& reg) { return pimpl->writeByte(address,byte); } #if 0 // // implementation CH0 // template<> I2C<>::I2C() { } template<> void I2C::writeByte(uint8_t address, uint8_t byte) { std::cout << "wrtiteByte() of i2c CH0 has been called!" << std::endl; } // // implementation CH1 // template<> I2C::I2C() { std::cout << "i2c_ch1 has been created" << std::endl; } template<> void I2C::writeByte(uint8_t address, uint8_t byte) { std::cout << "wrtiteByte() of i2c CH1 has been called!" << std::endl; } #endif #endif // _I2C_HPP_