Description: CANfestival - an open source CANopen framework
You are viewing an out of date revision of canopen_slavenode! View latest revision
Object Dictionary Management
The Object Dictionary is the heart of each CANopen device containing all communication and application objects. More...
Data Structures | |
| struct | struct_CO_Data |
| This structure contains all necessary informations to define a CANOpen node. More... | |
Defines | |
| #define | getODentry(OD, wIndex, bSubindex, pDestData, pExpectedSize, pDataType,checkAccess) |
| getODentry() to read from object and endianize | |
| #define | readLocalDict(OD, wIndex, bSubindex, pDestData, pExpectedSize, pDataType,checkAccess) |
| readLocalDict() reads an entry from the object dictionary, but in contrast to getODentry(), readLocalDict() doesn't endianize entry and reads entry in machine native endianness. | |
| #define | setODentry(d, wIndex, bSubindex, pSourceData, pExpectedSize, checkAccess) |
| setODentry converts SourceData from network byte order to machine native format, and writes that to OD. | |
| #define | writeLocalDict(d, wIndex, bSubindex, pSourceData, pExpectedSize, checkAccess) |
| Writes machine native SourceData to OD. | |
Detailed Description
The Object Dictionary is the heart of each CANopen device containing all communication and application objects.
Define Documentation
| #define getODentry | ( | OD, | |
| wIndex, | |||
| bSubindex, | |||
| pDestData, | |||
| pExpectedSize, | |||
| pDataType, | |||
| checkAccess | |||
| ) |
_getODentry( OD, wIndex, bSubindex, pDestData, pExpectedSize, \
pDataType, checkAccess, 1)
getODentry() to read from object and endianize
- Parameters:
-
OD Pointer to a CAN object data structure wIndex The index in the object dictionary where you want to read an entry bSubindex The subindex of the Index. e.g. mostly subindex 0 is used to tell you how many valid entries you can find in this index. Look at the canopen standard for further information *pDestData Pointer to the pointer which points to the variable where the value of this object dictionary entry should be copied pExpectedSize This function writes the size of the copied value (in Byte) into this variable. *pDataType Pointer to the type of the data. See objdictdef.h checkAccess Flag that indicate if a check rights must be perfomed (0 : no , other than 0 : yes) endianize Set to 1 : endianized into network byte order
- Returns:
- OD_SUCCESSFUL is returned upon success.
- SDO abort code is returned if error occurs . (See file def.h)
Definition at line 144 of file objacces.h.
| #define readLocalDict | ( | OD, | |
| wIndex, | |||
| bSubindex, | |||
| pDestData, | |||
| pExpectedSize, | |||
| pDataType, | |||
| checkAccess | |||
| ) |
_getODentry( OD, wIndex, bSubindex, pDestData, pExpectedSize, \
pDataType, checkAccess, 0)
readLocalDict() reads an entry from the object dictionary, but in contrast to getODentry(), readLocalDict() doesn't endianize entry and reads entry in machine native endianness.
- Parameters:
-
OD Pointer to a CAN object data structure wIndex The index in the object dictionary where you want to read an entry bSubindex The subindex of the Index. e.g. mostly subindex 0 is used to tell you how many valid entries you can find in this index. Look at the canopen standard for further information *pDestData Pointer to the pointer which points to the variable where the value of this object dictionary entry should be copied pExpectedSize This function writes the size of the copied value (in Byte) into this variable. *pDataType Pointer to the type of the data. See objdictdef.h checkAccess if other than 0, do not read if the data is Write Only [Not used today. Put always 0]. endianize Set to 0, data is not endianized and copied in machine native endianness
- Returns:
- OD_SUCCESSFUL is returned upon success.
- SDO abort code is returned if error occurs . (See file def.h)
Definition at line 174 of file objacces.h.
| #define setODentry | ( | d, | |
| wIndex, | |||
| bSubindex, | |||
| pSourceData, | |||
| pExpectedSize, | |||
| checkAccess | |||
| ) |
_setODentry( d, wIndex, bSubindex, pSourceData, pExpectedSize, \
checkAccess, 1)
setODentry converts SourceData from network byte order to machine native format, and writes that to OD.
// Example usage: UNS8 B; B = 0xFF; // set transmission type retcode = setODentry( (UNS16)0x1800, (UNS8)2, &B, sizeof(UNS8), 1 );
- Parameters:
-
d Pointer to a CAN object data structure wIndex The index in the object dictionary where you want to write an entry bSubindex The subindex of the Index. e.g. mostly subindex 0 is used to tell you how many valid entries you can find in this index. Look at the canopen standard for further information *pSourceData Pointer to the variable that holds the value that should be copied into the object dictionary *pExpectedSize The size of the value (in Byte). checkAccess Flag that indicate if a check rights must be perfomed (0 : no , other than 0 : yes) endianize Set to 1 : endianized into network byte order
- Returns:
- OD_SUCCESSFUL is returned upon success.
- SDO abort code is returned if error occurs . (See file def.h)
Definition at line 233 of file objacces.h.
| UNS32 writeLocalDict | ( | d, | |
| wIndex, | |||
| bSubindex, | |||
| pSourceData, | |||
| pExpectedSize, | |||
| checkAccess | |||
| ) |
Writes machine native SourceData to OD.
- Parameters:
-
d Pointer to a CAN object data structure wIndex The index in the object dictionary where you want to write an entry bSubindex The subindex of the Index. e.g. mostly subindex 0 is used to tell you how many valid entries you can find in this index. Look at the canopen standard for further information *pSourceData Pointer to the variable that holds the value that should be copied into the object dictionary *pExpectedSize The size of the value (in Byte). checkAccess Flag that indicate if a check rights must be perfomed (0 : no , other than 0 : yes) endianize Data is not endianized and copied in machine native endianness
- Returns:
- OD_SUCCESSFUL is returned upon success.
- SDO abort code is returned if error occurs . (See file def.h)
// Example usage: UNS8 B; B = 0xFF; // set transmission type retcode = writeLocalDict( (UNS16)0x1800, (UNS8)2, &B, sizeof(UNS8), 1 );
Definition at line 266 of file objacces.h.
