This function searches the given key within the given object directory.
CO_OBJ *COObjOpen(CO_DIR *cod, CPU_INT32U key);
Parameter | Description |
---|---|
cod | pointer to the CANopen object directory |
key | object entry key; should be generated with the macro CO_DEV() |
>0
The pointer to the identified object entry
=0
Addressed object was not found
The function CODirFind()
is often called from the application to get an object directory entry. The following example checks the existence of the mandatory object entry "[1017:00] - Heartbeat" within the object directory of the CANopen node AppNode.
CO_OBJ *obj; : obj = CODirFind (&(AppNode.Dir), CO_DEV(0x1017, 0x00)); if (obj == 0) { /* object [1017:00] is missing */ } else { /* object [1017:00] is available */ } : |
Note: When using static object directories, the pointer to the identified object entry can be stored and reused with the object entry API functions. The object entry address will NOT change.