Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sdo callbacks #18

Closed
IzidorM opened this issue Dec 12, 2016 · 6 comments
Closed

sdo callbacks #18

IzidorM opened this issue Dec 12, 2016 · 6 comments

Comments

@IzidorM
Copy link

IzidorM commented Dec 12, 2016

Hi,
I want to trigger some events via canopen sdo messages, like writting to index 0x2000 should start some measurement. As I can see, there is no callback functionality per OD entry, so I wonder what is the recomended way to figure out which OD entry has changed and call right handler?

@jensnielsen
Copy link
Contributor

Hi

Check out CO_OD_configure()

You can register a callback function for a specific index, which seems to be exactly what you want. There are examples throughout the code for how to use it.

//Jens

@IzidorM
Copy link
Author

IzidorM commented Dec 12, 2016

Hi,
thanks for the fast replay. That is exactly what I need :) I was searching for this feature in the OD files, didnt expect that there is an extension of the OD implemented in the SDO files.

@IzidorM IzidorM closed this as completed Dec 12, 2016
@Simon-Thome
Copy link

It seems the function CO_OD_configure() is not available in CANopenNode V4, or I am I missing something?

@CANopenNode
Copy link
Owner

In V4 there is completely new Object Dictionary interface. See example in https://github.com/CANopenNode/CANopenSocket.

@Simon-Thome
Copy link

So if I understand correctly. To create a callback function on an SDO write, using OD_extension_init a custom write function can be created which can call a callback function and OD_writeOriginal can then be used to perform the actual write. Is this the best approach?

@CANopenNode
Copy link
Owner

In general you don't need OD_writeOriginal, you also don't need variable to be stored in OD memory, if you have custom write callback.
OD_writeOriginal only writes data to the original location in OD memory. It is useful, if (part of) OD memory is stored to non-volatile memory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants