Code Monkey home page Code Monkey logo

Comments (4)

michael-hillmann avatar michael-hillmann commented on July 24, 2024

Hi, you are welcome to ask your questions at this place.

If I understand you right, you need a callback function that is called after a synchronized RPDO is processed?
Unfortunately, there is no callback today.

We could add a callback in file co_sync.c in function COSyncHandler().

May I ask, what you want to achieve with the callback function?

from canopen-stack.

jcatsong avatar jcatsong commented on July 24, 2024

Hi Michael,

Thanks for the quick reply. Yes as I understand it I'd like an application callback that occurs after a synchronized RPDO is processed and written to the OD. I see the COSyncHandler() function you mentioned and I imagine a callback would be fit right at the end of the function call and then need to be implemented by the user.

Regarding what I'm hoping to achieve, I'd like to allow my application firmware to be notified when the CANOpen master updates a value in the object dictionary via synchronized PDO (potentially the callback would just signal a semaphore, place a message in a queue, etc). This is my first application with CANOpen so maybe there's another way to achieve this. I dont believe polling the object dictionary would work as the master could send the same value via synchronized PDO and the node would still need to act on it (in our application).

from canopen-stack.

michael-hillmann avatar michael-hillmann commented on July 24, 2024

Ok, let us prepare a callback for the next version like:

    for (i = 0; i < CO_RPDO_N; i++) {
        if (sync->RPdo[i] != 0) {
            CORPdoWrite(sync->RPdo[i], &sync->RFrm[i]);
            COPdoSyncUpdate(sync->RPdo[i]);   /* new callback */
        }
    }

With this enhancement, you can notify the RPDO identifier in a queue (or just set a semaphore). I think the CAN frame is not needed in this callback function, because we should always use the data out of the object dictionary. Will this change cover your needs?

from canopen-stack.

jcatsong avatar jcatsong commented on July 24, 2024

Hi Michael,

This sound like exactly what we need, thank you for the quick response and quick suggestion. I'll add your suggested changes locally and let you know if I have any issues, but I think it will work for our needs.

Agreed we should use the object dictionary data rather than the CAN frame directly here. Thanks again!

from canopen-stack.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.