COObjGetSize

Description

This function returns the size of the given object directory entry.

Prototype

CPU_INT32U COObjGetSize(CO_OBJ *obj, CPU_INT32U width);

ParameterDescription
objpointer to the CANopen directory entry
widthExpected object size in byte (or 0 if unknown)

Returned Value

>0     object entry size in bytes

=0     an error is detected

Additional Information

The argument width is most likely given "0" (=unknown) when getting the size of an object entry. The intended use of this argument is for write access of dynamic sizes of user type objects (e.g. firmware loading with a maximum size).

Example

The following example gets the size of the hypothetical application specific object entry "[1234:56]" within the object directory of the CANopen node AppNode.


    CPU_INT32U  size;
    CO_OBJ     *entry;
    :
    entry = CODirFind    (&(AppNode.Dir), CO_DEV(0x1234,0x56));
    size  = COObjGetSize (entry, 0);
    :