rtlabs-com / c-open

CANopen stack for embedded devices
http://www.rt-labs.com
Other
79 stars 40 forks source link

Pass the network handle to callback functions instead of cb_arg #45

Closed nattgris closed 3 years ago

nattgris commented 3 years ago

It's currently impossible to reach the network handle from callbacks that are called during co_init(), because even if the cb_arg is already set up to point to a global object that is going to hold the network handle, co_init() must return the handle before it can be stored there.

Add a function to retrieve the cb_arg opaque argument from the network handle when needed. This is also useful to reach application specific context in the object access functions.

Also add a function to get the node ID, which may differ from the default because of LSS.