-
-
Notifications
You must be signed in to change notification settings - Fork 236
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
Implement filtering for multiple CAN ids #20
base: master
Are you sure you want to change the base?
Conversation
…er for multiple can ids (standard only for now)
Hi, is this ever implemented? Thank you for this beautiful and simple for use library! |
@sandeepmistry Do you think this could be merged? I have a requirement to filter for two IDs, currently this does need to be done in the MCU, while with this PR it could be done natively in the CAN controller (if you have enough filter registers). |
|
||
// normal mode | ||
writeRegister(REG_CANCTRL, 0x00); | ||
if (readRegister(REG_CANCTRL) != 0x00) { |
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.
You should probably put this into the same mode as it previously was (read mode before setting to config?). Or document that this function explicitely puts the controller into normal mode, so users are not surprised.
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 datasheet says
In Listen-Only mode, both valid and invalid messages will
be received, regardless of filters and masks or the
Receive Buffer Operating Mode bits, RXMn.
This code matches the existing behavior implemented in filter()
that resets the mode to "normal" on lines 307-311.
i tried to keep the interface simple for the user, you simply specify a list of CAN ids you are interrested in and the library handles when the hardware does not have enough filter registers.
ref #19