I2C Functions


Functions

bool fwSpecs_I2CCreateRegister (string pRegister, string pSPECS, int pMasterID, int pSlaveAddress, int pBus, int pAddress, int pSize, int pRefreshRate, bool pDataChange, int pType=0)
bool fwSpecs_I2CCreateRegisterSub (string pRegister, string pSPECS, int pMasterID, int pSlaveAddress, int pBus, int pAddress, int pSubAddress, int pSize, int pRefreshRate, bool pDataChange, int pType=0)
int fwSpecs_I2CWrite (string pSPECS, int pMasterID, int pSlaveAddress, int pBus, int pAddress, int pSize, dyn_char pData, bool pWaitFlag=true, int pType=0, dyn_char pMask=makeDynChar())
int fwSpecs_I2CWriteSub (string pSPECS, int pMasterID, int pSlaveAddress, int pBus, int pAddress, int pSubAddress, int pSize, dyn_char pData, bool pWaitFlag=true, int pType=0, dyn_char pMask=makeDynChar())
int fwSpecs_I2CRead (string pSPECS, int pMasterID, int pSlaveAddress, int pBus, int pAddress, int pSize, dyn_char &pData, int pType=0)
int fwSpecs_I2CReadSub (string pSPECS, int pMasterID, int pSlaveAddress, int pBus, int pAddress, int pSubAddress, int pSize, dyn_char &pData, int pType=0)
int fwSpecs_I2CWriteRead (string pSPECS, int pMasterID, int pSlaveAddress, int pBus, int pAddress, int pSize, dyn_char pDataWrite, dyn_char &pDataRead, int pType=0, dyn_char pMask=makeDynChar())
int fwSpecs_I2CWriteReadSub (string pSPECS, int pMasterID, int pSlaveAddress, int pBus, int pAddress, int pSubAddress, int pSize, dyn_char pDataWrite, dyn_char &pDataRead, int pType=0, dyn_char pMask=makeDynChar())

Detailed Description

List of functions to operate with I2C (Inter-Integrated Circuit).

Function Documentation

bool fwSpecs_I2CCreateRegister ( string  pRegister,
string  pSPECS,
int  pMasterID,
int  pSlaveAddress,
int  pBus,
int  pAddress,
int  pSize,
int  pRefreshRate,
bool  pDataChange,
int  pType = 0 
)

Create a new I2C register for read/write/monitoring use.

Parameters:
[in] pRegister name of the I2C register to be created.
[in] pSPECS name of the SPECS.
[in] pMasterID master ID.
[in] pSlaveAddress slave address.
[in] pBus bus number.
[in] pAddress address.
[in] pSize size (in bytes) of the I2C register.
[in] pRefreshRate refresh rate of the monitoring (in seconds).
[in] pDataChange data change enable/disable option. If true, the server will send data when it change, otherwise (false) the server will not send data (even if it change).
[in] pType (optional) I2C Mode (0..6): Combined, Separated, etc.
Returns:
true no error found.

false error found.

Example:

  (...)
  if (fwSpecs_I2CCreateRegister("myI2CReg", "pclbcecs03", 1, 1, 0, 64, 3, 5, true))   // create a new I2C register called 'myI2CReg'
     (...)
  else
     DebugTN("Error found!");
  (...)



bool fwSpecs_I2CCreateRegisterSub ( string  pRegister,
string  pSPECS,
int  pMasterID,
int  pSlaveAddress,
int  pBus,
int  pAddress,
int  pSubAddress,
int  pSize,
int  pRefreshRate,
bool  pDataChange,
int  pType = 0 
)

Create a new I2C register for read/write/monitoring use (same as the previous function, but now, for sub addressing).

Parameters:
[in] pRegister name of the I2C register to be created.
[in] pSPECS name of the SPECS.
[in] pMasterID master ID.
[in] pSlaveAddress slave address.
[in] pBus bus number.
[in] pAddress address.
[in] pSubAddress sub address.
[in] pSize size (in bytes) of the I2C register.
[in] pRefreshRate refresh rate of the monitoring (in seconds).
[in] pDataChange data change enable/disable option. If true, the server will send data when it change, otherwise (false) the server will not send data (even if it change).
[in] pType (optional) I2C Mode (0..6): Combined, Separated, etc.
Returns:
true no error found.

false error found.

Example:

  (...)
  if (fwSpecs_I2CCreateRegisterSub("myI2CReg", "pclbcecs03", 1, 1, 0, 64, 128, 3, 5, true))   // create a new I2C register called 'myI2CReg',
     (...)                                                                                    // but now, for sub addressing
  else
     DebugTN("Error found!");
  (...)



int fwSpecs_I2CRead ( string  pSPECS,
int  pMasterID,
int  pSlaveAddress,
int  pBus,
int  pAddress,
int  pSize,
dyn_char &  pData,
int  pType = 0 
)

Read data from the specified I2C register.

Parameters:
[in] pSPECS name of the SPECS.
[in] pMasterID master ID.
[in] pSlaveAddress slave address.
[in] pBus bus number.
[in] pAddress address.
[in] pSize size (in bytes) of the data to be read.
[out] pData data read.
[in] pType (optional) I2C Mode (0..6): Combined, Separated, etc.
Returns:
= 0 no error found.

> 0 error found (related with SpecsUser; see error codes).

= -1 error found (related with PVSS).

Example:

  (...)
  dyn_char myData;

  if (fwSpecs_I2CRead("pclbcecs03", 1, 1, 0, 64, 3, myData) == 0)   // read 3 chars from I2C
     DebugTN(myData);
  else
     DebugTN("Error found!");
  (...)



int fwSpecs_I2CReadSub ( string  pSPECS,
int  pMasterID,
int  pSlaveAddress,
int  pBus,
int  pAddress,
int  pSubAddress,
int  pSize,
dyn_char &  pData,
int  pType = 0 
)

Read data from the specified I2C register (same as the previous function, but now, for sub addressing).

Parameters:
[in] pSPECS name of the SPECS.
[in] pMasterID master ID.
[in] pSlaveAddress slave address.
[in] pBus bus number.
[in] pAddress address.
[in] pSubAddress sub address.
[in] pSize size (in bytes) of the data to be read.
[out] pData data read.
[in] pType (optional) I2C Mode (0..6): Combined, Separated, etc.
Returns:
= 0 no error found.

> 0 error found (related with SpecsUser; see error codes).

= -1 error found (related with PVSS).

Example:

  (...)
  dyn_char myData;

  if (fwSpecs_I2CReadSub("pclbcecs03", 1, 1, 0, 64, 128, 3, myData) == 0)   // read 3 chars from I2C
     DebugTN(myData);
  else
     DebugTN("Error found!");
  (...)



int fwSpecs_I2CWrite ( string  pSPECS,
int  pMasterID,
int  pSlaveAddress,
int  pBus,
int  pAddress,
int  pSize,
dyn_char  pData,
bool  pWaitFlag = true,
int  pType = 0,
dyn_char  pMask = makeDynChar() 
)

Write data into the specified I2C register.

Parameters:
[in] pSPECS name of the SPECS.
[in] pMasterID master ID.
[in] pSlaveAddress slave address.
[in] pBus bus number.
[in] pAddress address.
[in] pSize size (in bytes) of the data to be written.
[in] pData data to be written.
[in] pWaitFlag if true, the function will wait for the return value, otherwise (false) the function will not wait for the return value (in this case, the return value will be always equal to 0 or -1). Note: this parameter is optional (if not specified, the default will be true).
[in] pType (optional) I2C Mode (0..6): Combined, Separated, etc.
[in] pMask (optional) mask to be applied to the data.
Returns:
= 0 no error found.

> 0 error found (related with SpecsUser; see error codes).

= -1 error found (related with PVSS).

Example:

  (...)
  if (fwSpecs_I2CWrite("pclbcecs03", 1, 1, 0, 64, 3, makeDynChar(65, 66, 67), true) == 0)   // write 3 chars (65, 66, 67) into I2C
     (...)
  else
     DebugTN("Error found!");
  (...)



int fwSpecs_I2CWriteRead ( string  pSPECS,
int  pMasterID,
int  pSlaveAddress,
int  pBus,
int  pAddress,
int  pSize,
dyn_char  pDataWrite,
dyn_char &  pDataRead,
int  pType = 0,
dyn_char  pMask = makeDynChar() 
)

Write and, then, read data from the specified I2C register. This function should be used whenever possible, since it will optimize speed. Note: if the write operation fails, then the read operation will not be performed.

Parameters:
[in] pSPECS name of the SPECS.
[in] pMasterID master ID.
[in] pSlaveAddress slave address.
[in] pBus bus number.
[in] pAddress address.
[in] pSize size (in bytes) of the data to be written.
[in] pDataWrite data to be written.
[out] pDataRead data read.
[in] pType (optional) I2C Mode (0..6): Combined, Separated, etc.
[in] pMask (optional) mask to be applied to the data when writing.
Returns:
= 0 no error found.

> 0 error found (related with SpecsUser; see error codes).

= -1 error found (related with PVSS).

Example:

  (...)
  dyn_char myData;

  if (fwSpecs_I2CWriteRead("pclbcecs03", 1, 1, 0, 64, 3, makeDynChar(65, 66, 67), myData) == 0)   // write 3 chars (65, 66 & 67)
     DebugTN(myData);                                                                             // and, then, read data from I2C
  else
     DebugTN("Error found!");
  (...)



int fwSpecs_I2CWriteReadSub ( string  pSPECS,
int  pMasterID,
int  pSlaveAddress,
int  pBus,
int  pAddress,
int  pSubAddress,
int  pSize,
dyn_char  pDataWrite,
dyn_char &  pDataRead,
int  pType = 0,
dyn_char  pMask = makeDynChar() 
)

Write and, then, read data from the specified I2C register (same as the previous function, but now, for sub addressing). This function should be used whenever possible, since it will optimize speed. Note: if the write operation fails, then the read operation will not be performed.

Parameters:
[in] pSPECS name of the SPECS.
[in] pMasterID master ID.
[in] pSlaveAddress slave address.
[in] pBus bus number.
[in] pAddress address.
[in] pSubAddress sub address.
[in] pSize size (in bytes) of the data to be written.
[in] pDataWrite data to be written.
[out] pDataRead data read.
[in] pType (optional) I2C Mode (0..6): Combined, Separated, etc.
[in] pMask (optional) mask to be applied to the data when writing.
Returns:
= 0 no error found.

> 0 error found (related with SpecsUser; see error codes).

= -1 error found (related with PVSS).

Example:

  (...)
  dyn_char myData;

  if (fwSpecs_I2CWriteReadSub("pclbcecs03", 1, 1, 0, 64, 128, 3, makeDynChar(65, 66, 67), myData) == 0)   // write 3 chars (65, 66 & 67)
     DebugTN(myData);                                                                                     // and, then, read data from I2C
  else
     DebugTN("Error found!");
  (...)



int fwSpecs_I2CWriteSub ( string  pSPECS,
int  pMasterID,
int  pSlaveAddress,
int  pBus,
int  pAddress,
int  pSubAddress,
int  pSize,
dyn_char  pData,
bool  pWaitFlag = true,
int  pType = 0,
dyn_char  pMask = makeDynChar() 
)

Write data into the specified I2C register (same as the previous function, but now, for sub addressing).

Parameters:
[in] pSPECS name of the SPECS.
[in] pMasterID master ID.
[in] pSlaveAddress slave address.
[in] pBus bus number.
[in] pAddress address.
[in] pSubAddress sub address.
[in] pSize size (in bytes) of the data to be written.
[in] pData data to be written.
[in] pWaitFlag if true, the function will wait for the return value, otherwise (false) the function will not wait for the return value (in this case, the return value will be always equal to 0 or -1). Note: this parameter is optional (if not specified, the default will be true).
[in] pType (optional) I2C Mode (0..6): Combined, Separated, etc.
[in] pMask (optional) mask to be applied to the data.
Returns:
= 0 no error found.

> 0 error found (related with SpecsUser; see error codes).

= -1 error found (related with PVSS).

Example:

  (...)
  if (fwSpecs_I2CWriteSub("pclbcecs03", 1, 1, 0, 64, 128, 3, makeDynChar(65, 66, 67), true) == 0)   // write 3 chars (65, 66, 67) into I2C
     (...)
  else
     DebugTN("Error found!");
  (...)




Generated on Fri Mar 28 13:36:50 2008 for FwSpecs by  doxygen 1.4.7