Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
11 years, 7 months ago.
How can I block interrupts for ONE of two can busses
I have two can busses being monitored and sleep when both are idle using the can interrupt to wake.
Ideally, though, I would sleep whenever CAN1 is idle independent of activity on CAN2 and only wake when I see activity on CAN1.
Is there a way I can disable CAN2 from generating an interrupt without disabling interrupts from CAN1? I still need to monitor CAN2 (but only when CAN1 is also active). The NVIC_SetPriority(CAN_IRQn, xx) command, for example, appears to apply to both.
1 Answer
11 years, 7 months ago.
You can disable the can interrupts the standard way that afaik all official libraries use, also some unofficial ones:
can2.attach(NULL);
Re-attach your function once you want it enabled again.
(Btw it seems device specific code for can is in the C++ layer instead of C layer, guess they forgot something since only some LPC's currently have CAN and they use the same peripheral, but still).