From 56f17cc3127cb78a8e64c022574adf4c30a4660b Mon Sep 17 00:00:00 2001 From: Mike O'Driscoll Date: Wed, 23 Mar 2016 11:22:15 -0400 Subject: [PATCH] Make MillisecondTimer::delay weak Made MillisecondTimer delay() member function a weak attribute. This will allow for those integrating with an RTOS to yield rather than busy-wait. This solves issue #149. --- lib/include/timing/MillisecondTimer.h | 16 +--------------- lib/src/timing/MillisecondTimer.cpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/include/timing/MillisecondTimer.h b/lib/include/timing/MillisecondTimer.h index 6ef82e15..f3e9090b 100644 --- a/lib/include/timing/MillisecondTimer.h +++ b/lib/include/timing/MillisecondTimer.h @@ -24,7 +24,7 @@ namespace stm32plus { public: static void initialise(); - static void delay(uint32_t millis_); + static void __attribute__ ((weak)) delay(uint32_t millis_); static uint32_t millis(); static void reset(); static bool hasTimedOut(uint32_t start,uint32_t timeout); @@ -42,20 +42,6 @@ namespace stm32plus { } - /** - * Delay for given time. Waits for the current value of the systick counter to reach a target. - * @param millis The amount of time to wait. - */ - - inline void MillisecondTimer::delay(uint32_t millis) { - - uint32_t target; - - target=_counter+millis; - while(_counter