Skip to content

Commit

Permalink
Add reference to objectlist in SM mappings
Browse files Browse the repository at this point in the history
Rationale, users might need more info on what
object it is that is mapped. Having a reference to
objectlist enable the user to know what index it is
and got a reference to the entire object. The obj
only know what subindex it is.

fixes #137
  • Loading branch information
Andreas Karlsson authored and hefloryd committed Feb 27, 2023
1 parent fd6dbdf commit 9747210
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions soes/esc_coe.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,15 @@ uint16_t sizeOfPDO (uint16_t index, int * nmappings, _SMmap * mappings,
}

mappings[mapIx].obj = mapping;
/* Save object list reference */
if(mapping != NULL)
{
mappings[mapIx].objectlistitem = &SDOobjects[nidx];
}
else
{
mappings[mapIx].objectlistitem = NULL;
}
mappings[mapIx++].offset = offset;
}

Expand Down
1 change: 1 addition & 0 deletions soes/esc_coe.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ typedef struct
typedef struct
{
const _objd * obj;
const _objectlist * objectlistitem;
uint16_t offset;
} _SMmap;

Expand Down

0 comments on commit 9747210

Please sign in to comment.