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

Add support for 29 bit identifier #1

Open
danjo133 opened this issue Jan 25, 2016 · 6 comments
Open

Add support for 29 bit identifier #1

danjo133 opened this issue Jan 25, 2016 · 6 comments

Comments

@danjo133
Copy link

Hi,

I need to have support for 29 bit identifiers in a project I'm working on.

I have working code for it that I would like to contribute, but I'm unsure what the best way of handling the 11 vs 29 bit difference.

I have added a bool for keeping track of if it's a 29 or 11 bit identifier
typedef struct
{
uint32_t id;
struct {
int8_t rtr : 1;
uint8_t length : 4;
} header;
uint8_t data[8];
bool extended;
} tCAN;

I would like to keep all old code working though, and I have two suggestions. Either change the mcp2515.c to .cpp which would allow constructors that set default extended=false or add a new struct for extended messages. Do you have any other suggestion?

@wellsa1
Copy link

wellsa1 commented Jun 7, 2018

Same problem here. Do you still have this code?

@danjo133
Copy link
Author

danjo133 commented Jun 7, 2018

I have a 29 bit branch here, also changed to c++, but it should be split into separate commits. Haven't touched it for a couple years though.

https://github.com/danjo133/SparkFun_CAN-Bus_Arduino_Library

@wellsa1
Copy link

wellsa1 commented Jun 7, 2018

Thanks for the reply!! I'll give it a go. I'm assuming the usage hasn't changed.

@danjo133
Copy link
Author

danjo133 commented Jun 8, 2018

Not that I remember, just check extended flag in tCAN on receive and set it on send.

@bessman
Copy link

bessman commented Jan 8, 2019

@danjo133 Your implementation misidentifies all incoming frames as extended. I've fixed it in my branch: https://github.com/bessman/SparkFun_CAN-Bus_Arduino_Library

@danjo133
Copy link
Author

danjo133 commented Jan 8, 2019

Good to know, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants