teachop / FlexCAN_Library

Arduino library for CAN on Teensy 3.1
The Unlicense
155 stars 122 forks source link

Add support for listen only mode #26

Open ThyMYthOS opened 7 years ago

collin80 commented 7 years ago

Listen only mode can only be entered while the canbus hardware is in the frozen state. You did note this in the documentation but it might be better to detect if the bus is frozen or not and go into freeze mode, set LOM, and exit freeze rather than just assume everything will go according to plan. A quick way would be to call end() in the beginning of the function, set LOM, then copy the bus starting code found in begin().

But, you did document the behavior so I guess my suggestion would just be a "it'd be nice if..." sort of thing.

ThyMYthOS commented 7 years ago

Any other opinion about this? Otherwise I'd like to keep it and avoid the overhead (code and runtime) and let the user decide to do the right thing.

pawelsky commented 7 years ago

I agree with collin80 that it would be nicer to not introduce the "only before begin/after end" limitation. People tend to forget such details and then spend hours debugging.

The overhead is not that big...