9 years, 1 month ago.

Problem with CAN::attach()

Hi guys,

According to the doc of CAN API, I can use attach (void(*fptr)(void), IrqType type=RxIrq) or attach (T *tptr, void(T::*mptr)(void), IrqType type=RxIrq) to attach a function to different types of CAN interrupt. But when I compile it, compiler returns error 304, even after I update the mbed library in my program. Following is the line in my code:

include the mbed library with this snippet

can2.attach(rec, RxIrq);

What's wrong with my code?

Thanks!

1 Answer

9 years, 1 month ago.

Hi Ye, i believe the correct sintax is:

can2.attach(rec,CAN::RxIrq);

Try this and tell me if it works

Greetings

Accepted Answer

Yep, that works! Thank you very much!

posted by Ye Cheng 29 Aug 2013

you're welcome, im glad to help you

posted by Ney Palma 29 Aug 2013