andysworkshop / stm32plus

The C++ library for the STM32 F0, F100, F103, F107 and F4 microcontrollers
http://www.andybrown.me.uk
Other
745 stars 224 forks source link

Pluggable delay method? #149

Closed mikepurvis closed 8 years ago

mikepurvis commented 8 years ago

I raised this briefly here, but I'd like to file a separate issue— when integrating with an RTOS, it's critical that stm32plus's delay method be a yield rather than just a busy-wait. A few thoughts for how to implement this:

Thoughts?

hellow554 commented 8 years ago

Maybe use the weak-attribute or weak pragma of gcc?

mikepurvis commented 8 years ago

I'm interested in this. Would you entertain a PR for a weak-attribute based solution?

It's unclear to me if weak linking can work for a static class method like MillisecondTimer, or if it would need to pass through to a separate free function. Either way, the inline is going to be gone, whether effectively or explicitly.

andysworkshop commented 8 years ago

weak could work. The only problem with weak is that when multiple implementations are weak then it's undefined who wins. That shouldn't be an issue here though.

andysworkshop commented 8 years ago

closed by #169