BlackLib::BlackI2C Class Reference

Interacts with end user, to use I2C. More...

#include <BlackI2C.h>

Inheritance diagram for BlackLib::BlackI2C:

Public Types

enum  flags {
  openErr = 0,
  closeErr = 1,
  setSlaveErr = 2,
  readErr = 3,
  writeErr = 4
}
 

Public Member Functions

 BlackI2C (i2cName i2c, unsigned int i2cDeviceAddress)
 Constructor of BlackI2C class. More...
 
virtual ~BlackI2C ()
 Destructor of BlackI2C class. More...
 
bool open (uint openMode)
 Opens TTY file of i2c. More...
 
bool close ()
 Closes TTY file of i2c. More...
 
bool writeByte (uint8_t registerAddr, uint8_t value)
 Writes byte value to i2c smbus. More...
 
bool writeWord (uint8_t registerAddr, uint16_t value)
 Writes word value to i2c smbus. More...
 
bool writeBlock (uint8_t registerAddr, uint8_t *writeBuffer, size_t bufferSize)
 Writes block of data to i2c smbus. More...
 
bool writeLine (uint8_t *writeBuffer, size_t bufferSize)
 Writes data block to i2c line. More...
 
uint8_t readByte (uint8_t registerAddr)
 Read byte value from i2c smbus. More...
 
uint16_t readWord (uint8_t registerAddr)
 Read word value from i2c smbus. More...
 
uint8_t readBlock (uint8_t registerAddr, uint8_t *readBuffer, size_t bufferSize)
 Read data block from i2c smbus. More...
 
bool readLine (uint8_t *readBuffer, size_t bufferSize)
 Read data block from i2c line. More...
 
void setDeviceAddress (unsigned int newDeviceAddr)
 Changes device address of slave device. More...
 
int getDeviceAddress ()
 Exports device address of slave device. More...
 
std::string getPortName ()
 Exports i2c's port path. More...
 
bool isOpen ()
 Checks i2c's tty file's open state. More...
 
bool isClose ()
 Checks i2c's tty file's close state. More...
 
bool fail ()
 Is used for general debugging. More...
 
bool fail (BlackI2C::flags f)
 Is used for specific debugging. More...
 

Private Member Functions

bool loadDeviceTree ()
 Device tree loading is not necessary for using I2C feature. More...
 
bool useSmbusIOCTL (direction rwMode, uint8_t registerAddr, transactionType smbusTransaction, i2c_smbus_data &data)
 Does SMBUS kernel requests. More...
 
bool setSlave ()
 Sets slave to device. More...
 
- Private Member Functions inherited from BlackLib::BlackCore
 BlackCore ()
 Constructor of BlackCore class. More...
 
virtual ~BlackCore ()
 Destructor of BlackCore class. More...
 
std::string searchDirectoryOcp (BlackCore::ocpSearch searchThis)
 Searches ocp directory to find specified file/directory. More...
 
errorCoregetErrorsFromCore ()
 Exports errorCore struct to derived class. More...
 
std::string getCapeMgrName ()
 Exports capemgr name to derived class. More...
 
std::string getOcpName ()
 Exports ocp name to derived class. More...
 
std::string getSlotsFilePath ()
 Exports slots file path to derived class. More...
 

Private Attributes

errorI2Ci2cErrors
 is used to hold the errors of BlackI2C class More...
 
unsigned int i2cDevAddress
 is used to hold the i2c's device address More...
 
int i2cFD
 is used to hold the i2c's tty file's file descriptor More...
 
std::string i2cPortPath
 is used to hold the i2c's tty port path More...
 
bool isOpenFlag
 is used to hold the i2c's tty file's state More...
 

Additional Inherited Members

- Private Types inherited from BlackLib::BlackCore
enum  ocpSearch {
  ADC_helper = 0,
  PWM_P8_13 = 1,
  PWM_P8_19 = 2,
  PWM_P9_14 = 3,
  PWM_P9_16 = 4,
  PWM_P9_21 = 5,
  PWM_P9_22 = 6,
  PWM_P9_42 = 7,
  SPI0 = 8,
  SPI1 = 9
}
 

Detailed Description

Interacts with end user, to use I2C.

This class is end node to use i2c. End users interact with i2c from this class. It includes public functions to read and write byte, word or block datas.

Warning
BlackI2C uses SMBUS. Device and register addresses vary by slave device.
Example
EXAMPLE PROJECT FILE TREE:

   myI2cProject
   |-> src
       |-> BlackLib
           |-> BlackDirectory
               |-> BlackDirectory.cpp
               |-> BlackDirectory.h
           |-> BlackThread
               |-> BlackThread.cpp
               |-> BlackThread.h
           |-> BlackMutex
               |-> BlackMutex.cpp
               |-> BlackMutex.h
           |-> BlackTime
               |-> BlackTime.cpp
               |-> BlackTime.h
           |-> BlackADC
               |-> BlackADC.cpp
               |-> BlackADC.h
           |-> BlackGPIO
               |-> BlackGPIO.cpp
               |-> BlackGPIO.h
           |-> BlackI2C
               |-> BlackI2C.cpp
               |-> BlackI2C.h
           |-> BlackPWM
               |-> BlackPWM.cpp
               |-> BlackPWM.h
           |-> BlackSPI
               |-> BlackSPI.cpp
               |-> BlackSPI.h
           |-> BlackUART
               |-> BlackUART.cpp
               |-> BlackUART.h
           |-> BlackCore.cpp
           |-> BlackCore.h
           |-> BlackDef.h
           |-> BlackErr.h
           |-> BlackLib.h
       |-> myI2cProject.cpp


If BlackLib source files are located in your project like above example project file tree, you have to include BlackI2C.h or another source files with adding this line to your project file (myI2cProject.cpp at the example):
#include "BlackLib/BlackI2C/BlackI2C.h"


If BlackLib source files are located at same level with your project file (myI2cProject.cpp at the example), you have to include BlackI2C.h or another source files with adding this line to your project file:

// Filename: myI2cProject.cpp
// Author: Yiğit Yüce - ygtyce@gmail.com
#include <iostream>
#include "BlackLib/BlackI2C/BlackI2C.h"
int main()
{
uint8_t who_am_i = myI2c.readByte(0x28);
std::cout << "0x28: " << std::hex << (int)who_am_i << std::endl;
return 0;
}


You can use "using namespace BlackLib" also. You can get rid of writing "BlackLib::", with using this method.
// Filename: myI2cProject.cpp
// Author: Yiğit Yüce - ygtyce@gmail.com
#include <iostream>
#include "BlackLib/BlackI2C/BlackI2C.h"
using namespace BlackLib;
int main()
{
BlackI2C myI2c(I2C_1, 0x53);
myI2c.open( ReadWrite|NonBlock );
uint8_t who_am_i = myI2c.readByte(0x28);
std::cout << "0x28: " << std::hex << (int)who_am_i << std::endl;
return 0;
}

Member Enumeration Documentation

This enum is used to define I2C debugging flags.

Enumerator
openErr 

enumeration for errorI2C::openError status

closeErr 

enumeration for errorI2C::closeError status

setSlaveErr 

enumeration for errorI2C::setSlaveError status

readErr 

enumeration for errorI2C::readError status

writeErr 

enumeration for errorI2C::writeError status

Constructor & Destructor Documentation

BlackLib::BlackI2C::BlackI2C ( i2cName  i2c,
unsigned int  i2cDeviceAddress 
)

Constructor of BlackI2C class.

This function initializes errorI2C struct and sets local variables.

Parameters
[in]i2cname of i2c (enum),(I2C_x)
[in]i2cDeviceAddressaddress of device
Example
See also
i2cName
BlackLib::BlackI2C::~BlackI2C ( )
virtual

Destructor of BlackI2C class.

This function closes TTY file and deletes errorI2C struct pointer.

Member Function Documentation

bool BlackLib::BlackI2C::close ( )

Closes TTY file of i2c.

This function closes i2c's TTY file and changes isOpenFlag's value.

Returns
True if tty file closing successful, else false.
Example
myI2c.close();
See also
BlackSPI::isOpenFlag
bool BlackLib::BlackI2C::fail ( )

Is used for general debugging.

Returns
True if any error occured, else false.
Example
if( myI2c.fail() )
{
std::cout << "ERROR OCCURED" << std::endl;
}
else
{
std::cout << "EVERYTHING IS OK" << std::endl;
}
// Possible Output:
// EVERYTHING IS OK
See also
errorUART
bool BlackLib::BlackI2C::fail ( BlackI2C::flags  f)

Is used for specific debugging.

You can use this function, after call BlackI2C member functions in your code. The input parameter is used for finding out status of selected error.

Parameters
[in]fspecific error type (enum)
Returns
Value of selected error.
Example
if( myI2c.fail(BlackLib::BlackI2C::openErr) )
{
std::cout << "OPENNING ERROR OCCURED" << std::endl;
}
else
{
std::cout << "OPENNING IS OK" << std::endl;
{
std::cout << "SETTING SLAVE ERROR OCCURED" << std::endl;
}
else
{
std::cout << "SETTING SLAVE IS OK" << std::endl;
}
}
uint8_t powerCtl_Addr = 0x2D;
uint8_t measureMode = 0x08;
uint8_t powerCtlReg = myI2c.readByte(powerCtl_Addr);
if( myI2c.fail(BlackLib::BlackI2C::readErr) )
{
std::cout << "READ DATA ERROR OCCURED" << std::endl;
}
else
{
std::cout << "READ DATA IS OK" << std::endl;
}
powerCtlReg |= (measureMode);
bool resultOfWrite = myI2c.writeByte(powerCtl_Addr, powerCtlReg);
{
std::cout << "WRITE DATA ERROR OCCURED" << std::endl;
}
else
{
std::cout << "WRITE DATA IS OK" << std::endl;
}
// Possible Output:
// OPENNING IS OK
// SETTING SLAVE IS OK
// READ DATA IS OK
// WRITE DATA IS OK
See also
errorI2C
int BlackLib::BlackI2C::getDeviceAddress ( )

Exports device address of slave device.

Returns
address of current slave device.
Example
Example usage is shown in BlackI2C::setDeviceAddress() function's example.
std::string BlackLib::BlackI2C::getPortName ( )

Exports i2c's port path.

Returns
i2c's port path as string.
Example
std::cout << "Port path: " << myI2c.getPortName();
// Possible Output:
// Port path: /dev/i2c-1
See also
i2cPortPath
bool BlackLib::BlackI2C::isClose ( )

Checks i2c's tty file's close state.

Returns
true if tty file is close, else false.
Example
std::cout << "Is close?: " << std::boolalpha << myI2c.isClose() << std::endl;
std::cout << "Is close?: " << std::boolalpha << myI2c.isClose();
// Possible Output:
// Is close?: true
// Is close?: false
See also
BlackI2C::isOpenFlag
bool BlackLib::BlackI2C::isOpen ( )

Checks i2c's tty file's open state.

Returns
true if tty file is open, else false.
Example
std::cout << "Is open?: " << std::boolalpha << myI2c.isOpen() << std::endl;
std::cout << "Is open?: " << std::boolalpha << myI2c.isOpen();
// Possible Output:
// Is open?: false
// Is open?: true
See also
BlackI2C::isOpenFlag
bool BlackLib::BlackI2C::loadDeviceTree ( )
privatevirtual

Device tree loading is not necessary for using I2C feature.

But this function have to declare in this class again. Because it is a pure virtual function. It does nothing.

Returns
false all time.

Implements BlackLib::BlackCore.

bool BlackLib::BlackI2C::open ( uint  openMode)

Opens TTY file of i2c.

This function opens i2c's TTY file with selected open mode. Users can send "or"ed BlackLib::openMode enums as parameter to this function.

Warning
After initialization of BlackI2C class, this function must call. Otherwise users could not use any of data transfering functions.
Parameters
[in]openModefile opening mode
Returns
True if tty file opening successful, else false.
Example
See also
openMode
uint8_t BlackLib::BlackI2C::readBlock ( uint8_t  registerAddr,
uint8_t *  readBuffer,
size_t  bufferSize 
)

Read data block from i2c smbus.

This function reads data block from i2c smbus. Register address of device sent to this function as uint8_t type.

Parameters
[in]registerAddrregister address
[out]readBufferbuffer pointer
[in]bufferSizebuffer size
Returns
size of read data block if reading successfull, else 0x00.
Example
Example usage is shown in BlackI2C::writeBlock() function's example.
uint8_t BlackLib::BlackI2C::readByte ( uint8_t  registerAddr)

Read byte value from i2c smbus.

This function reads byte value from i2c smbus. Register address of device sent to this function as uint8_t type.

Parameters
[in]registerAddrregister address
Returns
read value if reading successfull, else 0x00.
Example
Example usage is shown in BlackI2C::writeByte() function's example.
bool BlackLib::BlackI2C::readLine ( uint8_t *  readBuffer,
size_t  bufferSize 
)

Read data block from i2c line.

This function reads data block from i2c line directly.

Parameters
[out]readBufferbuffer pointer
[in]bufferSizebuffer size
Warning
For reading something from i2c line, firstly users must write register address data to line.
Returns
true reading successfull, else false.
Example
Example usage is shown in BlackI2C::writeLine() function's example.
uint16_t BlackLib::BlackI2C::readWord ( uint8_t  registerAddr)

Read word value from i2c smbus.

This function reads word value from i2c smbus. Register address of device sent to this function as uint8_t type.

Parameters
[in]registerAddrregister address
Returns
read value if reading successfull, else 0x0000.
Example
Example usage is shown in BlackI2C::writeWord() function's example.
void BlackLib::BlackI2C::setDeviceAddress ( unsigned int  newDeviceAddr)

Changes device address of slave device.

This function changes device address of slave device and sets this device to slave.

Parameters
[in]newDeviceAddrnew slave device address
Example
std::cout << "Current slave address: " << std::hex << myI2c.getDeviceAddress() << std::endl;
myI2c.setDeviceAddress(0x69);
std::cout << "Current slave address: " << std::hex << myI2c.getDeviceAddress() << std::endl;
// Possible Output:
// Current slave address: 53
// Current slave address: 69
bool BlackLib::BlackI2C::setSlave ( )
inlineprivate

Sets slave to device.

This function does ioctl kernel request with "I2C_SLAVE" command.

Returns
If kernel request is finished successfully, this function returns true, else false.
bool BlackLib::BlackI2C::useSmbusIOCTL ( direction  rwMode,
uint8_t  registerAddr,
transactionType  smbusTransaction,
i2c_smbus_data &  data 
)
inlineprivate

Does SMBUS kernel requests.

This function generates I2C SMBUS IOCTL DATA PACKAGE with read/write mode selection, register address, transaction type and I2C SMBUS DATA. Then this function does ioctl kernel request with using this smbus package.

Parameters
[in]rwModewrite or read mode selection (enum)
[in]registerAddrregister address which will access
[in]smbusTransactiontransaction type (enum)
[in]datadata
Returns
If kernel request is finished successfully, this function returns true, else false.
bool BlackLib::BlackI2C::writeBlock ( uint8_t  registerAddr,
uint8_t *  writeBuffer,
size_t  bufferSize 
)

Writes block of data to i2c smbus.

This function writes block of data to i2c smbus. Data block sent to this function as pointer of uint8_t type.

Parameters
[in]registerAddrregister address
[in]writeBufferbuffer pointer
[in]bufferSizebuffer size
Warning
Maximum block size is 32.
Returns
true if writing successful, else false.
Example
// ___ ___ ___ ___|___ ___ ___ ___
uint8_t offsetX_Addr = 0x1E; // |_0_|_0_|_0_|_1_|_1_|_1_|_1_|_0_|
uint8_t offsetY_Addr = 0x1F; // |_0_|_0_|_0_|_1_|_1_|_1_|_1_|_1_|
uint8_t offsetZ_Addr = 0x20; // |_0_|_0_|_1_|_0_|_0_|_0_|_0_|_0_|
uint8_t offsetValues[3] = { 0x00, 0x00, 0x00 };
uint8_t readBlockSize = myI2c.readBlock(offsetX_Addr, offsetValues, sizeof(offsetValues) );
std::cout << "Total read block size: " << (int)readBlockSize << std::endl;
std::cout << "Offset X's current value: " << std::hex << (int)offsetValues[0] << std::dec << std::endl;
std::cout << "Offset Y's current value: " << std::hex << (int)offsetValues[1] << std::dec << std::endl;
std::cout << "Offset Z's current value: " << std::hex << (int)offsetValues[2] << std::dec << std::endl;
offsetValues[0] = 0x1A;
offsetValues[1] = 0x2B;
offsetValues[2] = 0x3C;
bool resultOfWrite = myI2c.writeBlock(offsetX_Addr, offsetValues, sizeof(offsetValues) );
std::cout << "Offsets' new values are wrote?: " << std::boolalpha << resultOfWrite << std::dec << std::endl;
memset(offsetValues, 0, sizeof(offsetValues)); // clear buffer
readBlockSize = myI2c.readBlock(offsetX_Addr, offsetValues, sizeof(offsetValues) );
std::cout << "Total read block size: " << (int)readBlockSize << std::endl;
std::cout << "Offset X's current value: " << std::hex << (int)offsetValues[0] << std::dec << std::endl;
std::cout << "Offset Y's current value: " << std::hex << (int)offsetValues[1] << std::dec << std::endl;
std::cout << "Offset Z's current value: " << std::hex << (int)offsetValues[2] << std::dec << std::endl;
// Possible Output:
// Total read block size: 3
// Offset X's current value: 00
// Offset Y's current value: 00
// Offset Z's current value: 00
// Offsets' new values are wrote?: true
// Total read block size: 3
// Offset X's current value: 1A
// Offset Y's current value: 2B
// Offset Z's current value: 3C
bool BlackLib::BlackI2C::writeByte ( uint8_t  registerAddr,
uint8_t  value 
)

Writes byte value to i2c smbus.

This function writes byte value to i2c smbus. Register address of device and values sent to this function as uint8_t type.

Parameters
[in]registerAddrregister address
[in]valuebyte data
Returns
true if writing successful, else false.
Example
// ___ ___ ___ ___|___ ___ ___ ___
uint8_t powerCtl_Addr = 0x2D; // |_0_|_0_|_1_|_0_|_1_|_1_|_0_|_1_|
uint8_t measureMode = 0x08; // |_0_|_0_|_0_|_0_|_1_|_0_|_0_|_0_|
uint8_t powerCtlReg = myI2c.readByte(powerCtl_Addr);
std::cout << "Power Ctrl's current value: " << std::hex << (int)powerCtlReg << std::dec << std::endl;
powerCtlReg |= (measureMode); // ___ ___ ___ ___|___ ___ ___ ___
// powerCtlReg: |_x_|_x_|_x_|_x_|_x_|_x_|_x_|_x_|
// measureMode: |_0_|_0_|_0_|_0_|_1_|_0_|_0_|_0_|
// ___ ___ ___ ___|___ ___ ___ ___ or these
// result: |_x_|_x_|_x_|_x_|_1_|_x_|_x_|_x_|
bool resultOfWrite = myI2c.writeByte(powerCtl_Addr, powerCtlReg);
std::cout << "Power Ctrl's new value is wrote?: " << std::boolalpha << resultOfWrite << std::dec << std::endl;
powerCtlReg = myI2c.readByte(powerCtl_Addr);
std::cout << "Power Ctrl's new value: " << std::hex << (int)powerCtlReg << std::dec << std::endl;
// Possible Output:
// Power Ctrl's current value: 00
// Power Ctrl's new value is wrote?: true
// Power Ctrl's new value: 08
bool BlackLib::BlackI2C::writeLine ( uint8_t *  writeBuffer,
size_t  bufferSize 
)

Writes data block to i2c line.

This function writes data block to i2c line directly. Data block sent to this function as pointer of uint8_t type.

Parameters
[in]writeBufferbuffer pointer
[in]bufferSizebuffer size
Warning
Data block's first element must be the address of register which will write datas.
Returns
true if writing successful, else false.
Example
// ___ ___ ___ ___|___ ___ ___ ___
uint8_t offsetX_Addr = 0x1E; // |_0_|_0_|_0_|_1_|_1_|_1_|_1_|_0_|
uint8_t offsetY_Addr = 0x1F; // |_0_|_0_|_0_|_1_|_1_|_1_|_1_|_1_|
uint8_t offsetZ_Addr = 0x20; // |_0_|_0_|_1_|_0_|_0_|_0_|_0_|_0_|
uint8_t offsetValues[3] = { 0x00, 0x00, 0x00 };
myI2c.writeLine(&offsetX_Addr, 1); // address of register which will read datas
myI2c.readLine( offsetValues, sizeof(offsetValues) ); // read three data from "offsetX_Addr"
std::cout << "Offset X's current value: " << std::hex << (int)offsetValues[0] << std::dec << std::endl;
std::cout << "Offset Y's current value: " << std::hex << (int)offsetValues[1] << std::dec << std::endl;
std::cout << "Offset Z's current value: " << std::hex << (int)offsetValues[2] << std::dec << std::endl;
offsetValues[0] = 0xD4;
offsetValues[1] = 0xE5;
offsetValues[2] = 0xF6;
uint8_t tempBufWithAddr[4] = { offsetX_Addr, offsetValues[0], offsetValues[1], offsetValues[2] };
bool resultOfWrite = myI2c.writeLine(tempBufWithAddr, sizeof(tempBufWithAddr) );
std::cout << "Offsets' new values are wrote?: " << std::boolalpha << resultOfWrite << std::dec << std::endl;
memset(offsetValues, 0, sizeof(offsetValues)); // clear buffer
myI2c.writeLine(&offsetX_Addr, 1); // address of register which will read datas
myI2c.readLine( offsetValues, sizeof(offsetValues) ); // read three data from "offsetX_Addr"
std::cout << "Offset X's current value: " << std::hex << (int)offsetValues[0] << std::dec << std::endl;
std::cout << "Offset Y's current value: " << std::hex << (int)offsetValues[1] << std::dec << std::endl;
std::cout << "Offset Z's current value: " << std::hex << (int)offsetValues[2] << std::dec << std::endl;
// Possible Output:
// Offset X's current value: 00
// Offset Y's current value: 00
// Offset Z's current value: 00
// Offsets' new values are wrote?: true
// Offset X's current value: D4
// Offset Y's current value: E5
// Offset Z's current value: F6
bool BlackLib::BlackI2C::writeWord ( uint8_t  registerAddr,
uint16_t  value 
)

Writes word value to i2c smbus.

This function writes word value to i2c smbus. Values sent to this function as uint16_t type.

Parameters
[in]registerAddrregister address
[in]valueword data
Warning
Word data operations use little-endian system. This means, it stores the most significant byte of a word in the largest address and the least significant byte is stored in the smallest address.
Returns
true if writing successful, else false.
Example
// ___ ___ ___ ___|___ ___ ___ ___
uint8_t offsetX_Addr = 0x1E; // |_0_|_0_|_0_|_1_|_1_|_1_|_1_|_0_|
uint8_t offsetY_Addr = 0x1F; // |_0_|_0_|_0_|_1_|_1_|_1_|_1_|_1_|
// Example: Register Map of slave device(0x53), Little-Endian System
// ----------------------------------
// | | 0 | 1 | .......... | e | f |
// ----------------------------------
// |00 |...|...| .......... |...|...|
// ----------------------------------
// |10 |...|...| .......... | 1 | 4 | ==> 0x1E = 0x01 , 0x1F = 0x04
// ----------------------------------
// | : | : | : | .......... | : | : |
// | : | : | : | .......... | : | : |
// | : | : | : | .......... | : | : |
// ----------------------------------
// |f0 |...|...| .......... |...|...|
// ----------------------------------
//
// When users read word data from 0x1E address, word value is 0x0401.
// This means smallest address(0x1E) will be least significant byte(LSB, 0x01)
// and largest address(0x1F) will be most significant byte(MSB, 0x04)
uint16_t tempRead = myI2c.readWord(offsetX_Addr);
uint8_t offsetX = static_cast<uint8_t>(tempRead & 0xFF);
uint8_t offsetY = static_cast<uint8_t>(tempRead >> 8);
std::cout << "Offset X's current value: " << std::hex << (int)offsetX << std::dec << std::endl;
std::cout << "Offset Y's current value: " << std::hex << (int)offsetY << std::dec << std::endl;
offsetX = 0xA0;
offsetY = 0x0B;
uint16_t tempWrite = ((static_cast<uint16_t>(offsetY) << 8) | static_cast<uint16_t>(offsetX));
bool resultOfWrite = myI2c.writeWord(offsetX_Addr, tempWrite);
std::cout << "Offset X&Y's new value is wrote?: " << std::boolalpha << resultOfWrite << std::dec << std::endl;
tempRead = myI2c.readWord(offsetX_Addr);
offsetX = static_cast<uint8_t>(tempRead & 0xFF);
offsetY = static_cast<uint8_t>(tempRead >> 8);
std::cout << "Offset X's new value: " << std::hex << (int)offsetX << std::dec << std::endl;
std::cout << "Offset Y's new value: " << std::hex << (int)offsetY << std::dec << std::endl;
// Possible Output:
// Offset X's current value: 00
// Offset Y's current value: 00
// Offset X&Y's new value is wrote?: true
// Offset X's new value: A0
// Offset Y's new value: 0B

Member Data Documentation

unsigned int BlackLib::BlackI2C::i2cDevAddress
private

is used to hold the i2c's device address

errorI2C* BlackLib::BlackI2C::i2cErrors
private

is used to hold the errors of BlackI2C class

int BlackLib::BlackI2C::i2cFD
private

is used to hold the i2c's tty file's file descriptor

std::string BlackLib::BlackI2C::i2cPortPath
private

is used to hold the i2c's tty port path

bool BlackLib::BlackI2C::isOpenFlag
private

is used to hold the i2c's tty file's state


The documentation for this class was generated from the following files: