5 years, 5 months ago.

When using Ticker, must attached function's return type be void?

/media/uploads/TakujiMatsumoto/---------_2018-11-21_1.03.50.png

When I changed MotorDriver::communication's return type to void , build succeeds. But when I using int, build would fail. Is this a specification or my mistake? The compiler says "no matching function for call to 'mbed::Ticker::attach(mbed::Callback<int()>, float&)'" on Ticker.h 95

/media/uploads/TakujiMatsumoto/main.cpp /media/uploads/TakujiMatsumoto/motordriver.cpp /media/uploads/TakujiMatsumoto/motordriver.h

1 Answer

5 years, 5 months ago.

Yes, return type must be void as the function signature shows:

attach(Callback<void()> func, IrqType type=RxIrq)

Accepted Answer