Good day.
MBED OS 6. The program is compiled,
Code: Timer_gen.attach_us (& gen, Gen1));
The compiler gives the message: ‘attach_us’ is derecated: Pass a Chrono Duration, Not An Integer Microcecond Count. For example USE 10ms
Rather Than 10000
. [SINCE MBED-OS-6.0.0].
I can not understand what’s wrong?
Explain, please
Hello,
second parameter of attach/attach_us method (and more) is time. In older versions of Mbed OS it was like integer value, but now it is using chrono duration from STD.
Old:
ticker.attach_us(5);
ThisThread::sleep_for(10000);
Current:
ticker.attach(5us);
ThisThread::sleep_for(10ms);
So you probably need to modify your Gen1 variable to the chrono duration format.
BR, Jan
Hello Sergey,
Jan is right. However, nothing is wrong with the attach_us
yet. It works so you can still use it and ignore the warning.
For me “is deprecated
” means it works but there is no guarantee that it will work in the next revision of Mbed OS. So if you want your program to be compatible with future revisions of Mbe OS it’s not commended to use it.
Yes, I checked it, it works.
Thank you.