Skip to content

Conversation

@rureverek
Copy link

Changes

  • Small change: defines receive notification queue sizing constant

Related Issue(s)

Closes #15

@rureverek rureverek requested a review from t-bre February 17, 2023 12:09
@rureverek rureverek changed the title Define receive queue sizing constant feat: define receive queue sizing constant Feb 17, 2023
@t-bre t-bre self-assigned this Feb 17, 2023
@t-bre t-bre added the feature New feature or request label Feb 17, 2023
@t-bre t-bre added this to the STAG 9 milestone 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@rureverek rureverek requested a review from t-bre February 27, 2023 13:20
@Avdieienko Avdieienko removed this from the STAG 9 milestone Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: define receive queue item sizing constant in rtcan.h

4 participants