#ifndef _I2C_H_
#define _I2C_H_

#include <unistd.h>
#include <stdint.h>
#include <memory>
#include <ostream>
#include <iostream>
#include "../../config.h"

class I2C
{
	public: 
		enum errors 
		{
			noError,
			writeFailed, 
			readFailed, 
			bufferFull, 
			falseAddrs, 
			initFailed
		}; 

		I2C();
		~I2C();
		uint8_t readByte(const uint8_t& address, const uint8_t& reg); 
		uint16_t readWord(const uint8_t& address, const uint8_t& reg); 
		uint8_t writeByte(const uint8_t& address, const uint8_t& data); 
		uint8_t writeWord(const uint8_t& address, const uint8_t& reg, const uint8_t& data);	
		void writeBuffer(const uint8_t& address, const uint8_t* buffer, uint8_t len);	
		void readBuffer(const uint8_t& address, const uint8_t* buffer, uint8_t len);	

	private:
		void throwError(errors errNo); 	
		class i2cImpl; 
		std::unique_ptr<i2cImpl> i2cPimpl; 
};
#endif // _I2C_H_
