-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
modules: canopennode: add rxmsg callback #79472
modules: canopennode: add rxmsg callback #79472
Conversation
Hello @chgabriel79, and thank you very much for your first pull request to the Zephyr project! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks. A few minor comments.
modules/canopennode/canopennode.h
Outdated
* | ||
* Setting a new callback will overwrite any existing callback. | ||
* | ||
* @param callback the callbak to set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* @param callback the callbak to set | |
* @param callback the callback to set |
modules/canopennode/CO_driver.c
Outdated
@@ -31,6 +31,8 @@ K_MUTEX_DEFINE(canopen_send_mutex); | |||
K_MUTEX_DEFINE(canopen_emcy_mutex); | |||
K_MUTEX_DEFINE(canopen_co_mutex); | |||
|
|||
static canopen_rxmsg_callback rxmsg_callback; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static canopen_rxmsg_callback rxmsg_callback; | |
static canopen_rxmsg_callback rxmsg_callback = NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The compliance check does not seem to like this change. Shall I revert it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, sorry about that.
17fc160
to
e8b9ba9
Compare
I added your suggestions, and also clarified that the callback is run in interrupt context (CAN rx callback). And I had some problems with my client not adding the files to the commit, sorry for the noise... |
e8b9ba9
to
191d99b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Just a thought:
Is a callback disable function necessary?
Or maybe in the API description that a NULL ptr disables the callback?
It states "Setting a new callback will replace any existing callback." I used a similar wording to other callbacks, e.g. |
Implement callback for incoming CAN messages for any of the configured filters for CANopenNode. This can be used to wake the loop calling CO_process when a new message was received which needs processing. Signed-off-by: Christian Gabriel <[email protected]>
a49ccb8
191d99b
to
a49ccb8
Compare
Commenting to see if that's enough to get the PR to show as green in the merge dashboard 🤷🏼 |
@henrikbrixandersen do you want to try rebasing in case (unlikely IMO) merge dashboard is right by saying something is wrong with CI somehow? |
It was missing my approval after the latest force-push, so no - the merge-list had it correctly listed. |
Hi @chgabriel79! To celebrate this milestone and showcase your contribution, we'd love to award you the Zephyr Technical Contributor badge. If you're interested, please claim your badge by filling out this form: Claim Your Zephyr Badge. Thank you for your valuable input, and we look forward to seeing more of your contributions in the future! 🪁 |
Implement callback for incoming CAN messages for any of the configured filters for CANopenNode.
This can be used to wake the loop calling CO_process when a new message was received which needs processing.