Functions | |
int | fwCcpc_I2CWrite (string pCCPC, int pBus, int pAddress, int pSize, int pPageSize, int pType, bool pNACK, dyn_char pData, dyn_char pMask=makeDynChar(), bool pWaitFlag=true) |
int | fwCcpc_I2CWriteSub (string pCCPC, int pBus, int pAddress, int pSubAddress, int pSize, int pPageSize, int pType, bool pNACK, dyn_char pData, dyn_char pMask=makeDynChar(), bool pWaitFlag=true) |
int | fwCcpc_I2CRead (string pCCPC, int pBus, int pAddress, int pSize, int pPageSize, int pType, bool pNACK, dyn_char &pData) |
int | fwCcpc_I2CReadSub (string pCCPC, int pBus, int pAddress, int pSubAddress, int pSize, int pPageSize, int pType, bool pNACK, dyn_char &pData) |
int | fwCcpc_I2CWriteRead (string pCCPC, int pBus, int pAddress, int pSize, int pPageSize, int pType, bool pNACK, dyn_char pDataWrite, dyn_char pMask, dyn_char &pDataRead) |
int | fwCcpc_I2CWriteReadSub (string pCCPC, int pBus, int pAddress, int pSubAddress, int pSize, int pPageSize, int pType, bool pNACK, dyn_char pDataWrite, dyn_char pMask, dyn_char &pDataRead) |
bool | fwCcpc_I2CScan (string pCCPC, int pBus, int pStartAddress, int pStopAddress, int pMode, dyn_bool &pStatusList) |
int fwCcpc_I2CRead | ( | string | pCCPC, | |
int | pBus, | |||
int | pAddress, | |||
int | pSize, | |||
int | pPageSize, | |||
int | pType, | |||
bool | pNACK, | |||
dyn_char & | pData | |||
) |
Read data from the specified I2C register. This function reads from a register wihtout subaddressing. The specification of pType is thus meaningless. However in order to not break the interface this parameter is kept and 'something' has to be entered.
[in] | pCCPC | name of the CCPC. |
[in] | pBus | bus number. |
[in] | pAddress | address. |
[in] | pSize | size (in bytes) of the data to be read. |
[in] | pPageSize | page size (in bytes) of the data to be written. Note: if the page size is "infinite", then the value -1 should be provided. |
[in] | pType | type of I2C (SEPARATED, COMBINED, SHIFT REGISTER or PREDEFINED). Note: these types are represented by the constants FWCCPC_I2C_SEPARATED, FWCCPC_I2C_COMBINED, FWCCPC_I2C_SHIFT_REGISTER and FWCCPC_I2C_PREDEFINED. |
[in] | pNACK | enable/disable I2C NACK on address. |
[out] | pData | data read. |
> 0 error found (related with CCPC Server).
= -1 error found (related with PVSS).
(...) dyn_char myData; if (fwCcpc_I2CRead("pclbcecs03", 0, 0x50, 3, -1, FWCCPC_I2C_SEPARATED, true, myData) == 0) // read 3 chars from I2C DebugTN(fwCcpc_convertByteToHex(myData)); else DebugTN("Error found!"); (...)
int fwCcpc_I2CReadSub | ( | string | pCCPC, | |
int | pBus, | |||
int | pAddress, | |||
int | pSubAddress, | |||
int | pSize, | |||
int | pPageSize, | |||
int | pType, | |||
bool | pNACK, | |||
dyn_char & | pData | |||
) |
Read data from the specified I2C register (same as the previous function, but now, for sub addressing). If the subaddress is left empty or smaller than zero, the server recognizes it as an access without subaddressing.
[in] | pCCPC | name of the CCPC. |
[in] | pBus | bus number. |
[in] | pAddress | address. |
[in] | pSubAddress | sub address. |
[in] | pSize | size (in bytes) of the data to be read. |
[in] | pPageSize | page size (in bytes) of the data to be written. Note: if the page size is "infinite", then the value -1 should be provided. |
[in] | pType | type of I2C (SEPARATED, COMBINED, SHIFT REGISTER or PREDEFINED). Note: these types are represented by the constants FWCCPC_I2C_SEPARATED, FWCCPC_I2C_COMBINED, FWCCPC_I2C_SHIFT_REGISTER and FWCCPC_I2C_PREDEFINED. |
[in] | pNACK | enable/disable I2C NACK on address. |
[out] | pData | data read. |
> 0 error found (related with CCPC Server).
= -1 error found (related with PVSS).
(...) dyn_char myData; if (fwCcpc_I2CReadSub("pclbcecs03", 0, 0x50, 0x0, 3, -1, FWCCPC_I2C_SEPARATED, true, myData) == 0) // read 3 chars from I2C DebugTN(fwCcpc_convertByteToHex(myData)); else DebugTN("Error found!"); (...)
bool fwCcpc_I2CScan | ( | string | pCCPC, | |
int | pBus, | |||
int | pStartAddress, | |||
int | pStopAddress, | |||
int | pMode, | |||
dyn_bool & | pStatusList | |||
) |
This function performs a I2C scan operation on the specified CCPC. The specified I2C bus is accessed. After the address is put on the bus an ackknowledgement is sent which allows to recognize if the address is existing.
[in] | pCCPC | name of the CCPC. |
[in] | pBus | bus number. |
[in] | pStartAddress | I2C scan starting address. |
[in] | pStopAddress | I2C scan ending address. |
[in] | pMode | I2C scan mode (READ or WRITE). Note: these modes are represented by the constants FWCCPC_I2C_SCAN_READ and FWCCPC_I2C_SCAN_WRITE. |
[in] | pStatusList | list containing the status of the I2C scan operation. If the address exists the status will be true, otherwise it will be false. |
false error found.
(...) dyn_bool myList; int i; if (fwCcpc_I2CScan("pclbcecs03", 1, 0x0, 0x100, FWCCPC_I2C_SCAN_READ, myList) == 0) // perform a I2C scan operation on 'pclbcecs03' for(i = 1; i <= dynlen(myList); i++) if (myList[i]) DebugTN("Address " + (string) i + " exists"); else DebugTN("Address " + (string) i + " doesn't exists"); else DebugTN("Error found!"); (...)
int fwCcpc_I2CWrite | ( | string | pCCPC, | |
int | pBus, | |||
int | pAddress, | |||
int | pSize, | |||
int | pPageSize, | |||
int | pType, | |||
bool | pNACK, | |||
dyn_char | pData, | |||
dyn_char | pMask = makeDynChar() , |
|||
bool | pWaitFlag = true | |||
) |
Write data into the specified I2C register. This function writes to a register wihtout subaddressing. The specification of pType is thus meaningless. However in order to not break the interface this parameter is kept and something has to be entered.
[in] | pCCPC | name of the CCPC. |
[in] | pBus | bus number. Note: there are 4 buses from 0 to 3 |
[in] | pAddress | address. Note: PVSS recognizes the 0x... notation |
[in] | pSize | size (in bytes) of the data to be written. |
[in] | pPageSize | page size (in bytes) of the data to be written. Note: if the page size is "infinite", then the value -1 should be provided. |
[in] | pType | type of I2C (SEPARATED, COMBINED, SHIFT REGISTER or PREDEFINED). Note: these types are represented by the constants FWCCPC_I2C_SEPARATED, FWCCPC_I2C_COMBINED, FWCCPC_I2C_SHIFT_REGISTER and FWCCPC_I2C_PREDEFINED. |
[in] | pNACK | enable/disable I2C NACK on address. Note: for long distance drivers the acknowledgement is ignored |
[in] | pData | data to be written. Note: If the data is greater than the specified size, then the data will be truncated to that size. If the data is shorter than the specified size, than it will be filled up with leading zeroes. |
[in] | pMask | mask that is going to be used for the writing. Note: if the mask is empty, then no masking operation will be performed. |
[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). |
> 0 error found (related with CCPC Server).
= -1 error found (related with PVSS).
(...) if (fwCcpc_I2CWrite("pctell07", 0, 0x50, 4, -1, FWCCPC_I2C_SEPARATED, true, fwCcpc_convertHexToByte("feedbabe")); (...) else DebugTN("Error found!"); (...)
int fwCcpc_I2CWriteRead | ( | string | pCCPC, | |
int | pBus, | |||
int | pAddress, | |||
int | pSize, | |||
int | pPageSize, | |||
int | pType, | |||
bool | pNACK, | |||
dyn_char | pDataWrite, | |||
dyn_char | pMask, | |||
dyn_char & | pDataRead | |||
) |
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.
[in] | pCCPC | name of the CCPC. |
[in] | pBus | bus number. |
[in] | pAddress | address. |
[in] | pSize | size (in bytes) of the data to be written. |
[in] | pPageSize | page size (in bytes) of the data to be written. Note: if the page size is "infinite", then the value -1 should be provided. |
[in] | pType | type of I2C (SEPARATED, COMBINED, SHIFT REGISTER or PREDEFINED). Note: these types are represented by the constants FWCCPC_I2C_SEPARATED, FWCCPC_I2C_COMBINED, FWCCPC_I2C_SHIFT_REGISTER and FWCCPC_I2C_PREDEFINED. |
[in] | pNACK | enable/disable I2C NACK on address. |
[in] | pDataWrite | data to be written. Note: If the data is greater than the specified size, then the data will be truncated to that size. If the data is shorter than the specified size, than it will be filled up with leading zeroes. |
[in] | pMask | mask that is going to be used for the writing. Note: if the mask is empty, then no masking operation will be performed. |
[out] | pDataRead | data read. |
> 0 error found (related with CCPC Server).
= -1 error found (related with PVSS).
(...) dyn_char myData; if (fwCcpc_I2CWriteRead("pclbcecs03", 0, 0x50, 3, -1, FWCCPC_I2C_SEPARATED, true,fwCcpc_convertHexToByte("feedbabe"), myData) == 0) // write 4 chars and then DebugTN(fwCcpc_convertByteToHex(myData)); // read back data from I2C else DebugTN("Error found!"); (...)
int fwCcpc_I2CWriteReadSub | ( | string | pCCPC, | |
int | pBus, | |||
int | pAddress, | |||
int | pSubAddress, | |||
int | pSize, | |||
int | pPageSize, | |||
int | pType, | |||
bool | pNACK, | |||
dyn_char | pDataWrite, | |||
dyn_char | pMask, | |||
dyn_char & | pDataRead | |||
) |
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.
[in] | pCCPC | name of the CCPC. |
[in] | pBus | bus number. |
[in] | pAddress | address. |
[in] | pSubAddress | sub address. |
[in] | pSize | size (in bytes) of the data to be written. |
[in] | pPageSize | page size (in bytes) of the data to be written. Note: if the page size is "infinite", then the value -1 should be provided. |
[in] | pType | type of I2C (SEPARATED, COMBINED, SHIFT REGISTER or PREDEFINED). Note: these types are represented by the constants FWCCPC_I2C_SEPARATED, FWCCPC_I2C_COMBINED, FWCCPC_I2C_SHIFT_REGISTER and FWCCPC_I2C_PREDEFINED. |
[in] | pNACK | enable/disable I2C NACK on address. |
[in] | pDataWrite | data to be written. Note: If the data is greater than the specified size, then the data will be truncated to that size. If the data is shorter than the specified size, than it will be filled up with leading zeroes. |
[in] | pMask | mask that is going to be used for the writing. Note: if the mask is empty, then no masking operation will be performed. |
[out] | pDataRead | data read. |
> 0 error found (related with CCPC Server).
= -1 error found (related with PVSS).
(...) dyn_char myData; if (fwCcpc_I2CWriteReadSub("pclbcecs03", 0, 0x50, 0x0, 3, -1, FWCCPC_I2C_SEPARATED, true,fwCcpc_convertHexToByte("feedbabe"), myData) == 0) // write 4 chars and then DebugTN(fwCcpc_convertByteToHex(myData)); // read back data from I2C else DebugTN("Error found!"); (...)
int fwCcpc_I2CWriteSub | ( | string | pCCPC, | |
int | pBus, | |||
int | pAddress, | |||
int | pSubAddress, | |||
int | pSize, | |||
int | pPageSize, | |||
int | pType, | |||
bool | pNACK, | |||
dyn_char | pData, | |||
dyn_char | pMask = makeDynChar() , |
|||
bool | pWaitFlag = true | |||
) |
Write data into the specified I2C register (same as the previous function, but now, for sub addressing). If the subaddress is left empty or smaller than zero, the server recognizes it as an access without subaddressing.
[in] | pCCPC | name of the CCPC. |
[in] | pBus | bus number. Note: PVSS recognizes the 0x... notation |
[in] | pAddress | address. |
[in] | pSubAddress | sub address. |
[in] | pSize | size (in bytes) of the data to be written. |
[in] | pPageSize | page size (in bytes) of the data to be written. Note: if the page size is "infinite", then the value -1 should be provided. |
[in] | pType | type of I2C (SEPARATED, COMBINED, SHIFT REGISTER or PREDEFINED). Note: these types are represented by the constants FWCCPC_I2C_SEPARATED, FWCCPC_I2C_COMBINED, FWCCPC_I2C_SHIFT_REGISTER and FWCCPC_I2C_PREDEFINED. |
[in] | pNACK | enable/disable I2C NACK on address. |
[in] | pData | data to be written. Note: If the data is greater than the specified size, then the data will be truncated to that size. If the data is shorter than the specified size, than it will be filled up with leading zeroes. |
[in] | pMask | mask that is going to be used for the writing. Note: if the mask is empty, then no masking operation will be performed. |
[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). |
> 0 error found (related with CCPC Server).
= -1 error found (related with PVSS).
(...) if (fwCcpc_I2CWrite("pctell07", 0, 0x50, 0x0, 4, -1, FWCCPC_I2C_SEPARATED, true, fwCcpc_convertHexToByte("feedbabe")); (...) else DebugTN("Error found!"); (...)