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

Conflicting prototypes for can_init #23

Open
onitake opened this issue Jan 10, 2021 · 0 comments
Open

Conflicting prototypes for can_init #23

onitake opened this issue Jan 10, 2021 · 0 comments

Comments

@onitake
Copy link

onitake commented Jan 10, 2021

The prototype for can_init in can.h and the source files is not the same, leading to compilation errors when compiling without -fshort-enums.

It would be better to not depend on this compiler flag and simply uint8_t everywhere, but at the very least, both can.h and the driver code should use the same prototype. If avr-can-lib is compiled with -fshort-enums while the application code is not, there will be a mismatch between the data types used for the bitrate argument, leading to problems.

I suggest either replacing the following in can.h:

extern bool can_init(can_bitrate_t bitrate);

with

extern bool can_init(uint8_t bitrate);

or (less preferred) replacing the driver routines

bool at90can_init(uint8_t bitrate)
bool sja1000_init(uint8_t bitrate)

with

bool at90can_init(can_bitrate_t bitrate)
bool sja1000_init(can_bitrate_t bitrate)

Apparently, this was already done for bool mcp2515_init(can_bitrate_t bitrate), so someone must have run into the same problem before.

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

1 participant