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

feat: automatic CAN filter configuration #20

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix can_ids
  • Loading branch information
rureverek committed May 10, 2023
commit aaf21fda6a99ace4b50a28101af52977dafe23ce
2 changes: 1 addition & 1 deletion inc/rtcan.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ typedef struct
uint32_t subscriber_number;

/**
* @brief Variable that holds 4 consecutive can_ids for filter bank configuration
* @brief Table that holds 4 consecutive can_ids for filter bank configuration
*/
uint32_t can_ids[4];

Expand Down
8 changes: 4 additions & 4 deletions src/rtcan.c
Original file line number Diff line number Diff line change
Expand Up @@ -577,10 +577,10 @@ rtcan_status_t rtcan_subscribe(rtcan_handle_t* rtcan_h,

/* Configure Filter IDs for each filter bank */

filter.FilterIdHigh = can_ids[0] << 5U;
filter.FilterIdLow = can_ids[1] << 5U;
filter.FilterMaskIdHigh = can_ids[2] << 5U;
filter.FilterMaskIdLow = can_ids[3] << 5U;
filter.FilterIdHigh = rtcan_h->can_ids[0] << 5U;
filter.FilterIdLow = rtcan_h->can_ids[1] << 5U;
filter.FilterMaskIdHigh = rtcan_h->can_ids[2] << 5U;
filter.FilterMaskIdLow = rtcan_h->can_ids[3] << 5U;
filter.FilterBank = bank_number;

/* Alternate between FIFO0 and FIFO1 to share the load evenly */
Expand Down