Open
Conversation
t-bre
suggested changes
Feb 17, 2023
inc/rtcan.h
Outdated
|
|
||
| #define RTCAN_RX_NOTIF_QUEUE_LENGTH 10 | ||
| #define RTCAN_RX_NOTIF_QUEUE_ITEM_SIZE 1 // one pointer = 1x ULONG | ||
| #define RTCAN_RX_NOTIF_QUEUE_ITEM_SIZE (sizeof(rtcan_msg_t*) / sizeof(ULONG)) // one pointer = 1x ULONG |
Contributor
There was a problem hiding this comment.
This is the right constant value, but I don't think this should be the name of the constant that users use in their code. This particular group of constants is internal to RTCAN (used to send pointers to received messages to the RTCAN Rx thread for dispatch to subscribers).
I suggest:
// user constant
#define RTCAN_RX_QUEUE_ITEM_SIZE (sizeof(rtcan_msg_t*) / sizeof(ULONG))
// internal constant
#define RTCAN_RX_NOTIF_QUEUE_ITEM_SIZE (RTCAN_RX_QUEUE_ITEM_SIZE)I think we should perhaps rename all of the internal constants, or #undef them at the end of the header so they don't get exposed to users and potentially cause confusion. Maybe they should be prefixed with an underscore if they are internal?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Related Issue(s)
Closes #15