Out-of-line LowPowerTimeout etc, lock

To match Timer etc, make LowPowerTimer et al out-of-line.

Correct LowPowerTimeout to not lock deep sleep.
pull/12425/head
Kevin Bracey 2020-04-03 16:07:08 +03:00
parent 8e3e19837a
commit 58388b7e5e
5 changed files with 24 additions and 15 deletions

View File

@ -40,11 +40,8 @@ namespace mbed {
* @note Synchronization level: Interrupt safe
*/
class LowPowerTicker : public TickerBase {
public:
LowPowerTicker() : TickerBase(get_lp_ticker_data())
{
}
LowPowerTicker();
};
/** @}*/

View File

@ -37,12 +37,8 @@ namespace mbed {
* @note Synchronization level: Interrupt safe
*/
class LowPowerTimer : public TimerBase {
public:
LowPowerTimer() : TimerBase(get_lp_ticker_data())
{
}
LowPowerTimer();
};
/** @}*/

View File

@ -15,8 +15,10 @@
* limitations under the License.
*/
#include "drivers/Ticker.h"
#include "drivers/LowPowerTicker.h"
#include "hal/us_ticker_api.h"
#include "hal/lp_ticker_api.h"
#include "platform/CriticalSectionLock.h"
#include "platform/mbed_power_mgmt.h"
@ -103,4 +105,10 @@ Ticker::Ticker() : TickerBase(get_us_ticker_data(), true)
{
}
#if DEVICE_LPTICKER
LowPowerTicker::LowPowerTicker() : TickerBase(get_lp_ticker_data(), false)
{
}
#endif
} // namespace mbed

View File

@ -39,6 +39,12 @@ Timeout::Timeout() : TimeoutBase(get_us_ticker_data(), true)
{
}
#if DEVICE_LPTICKER
LowPowerTimeout::LowPowerTimeout() : TimeoutBase(get_lp_ticker_data(), false)
{
}
#endif
/* A few miscellaneous out-of-line static members from various related classes,
* just to save them getting needing their own cpp file for one line.
* (In C++17 could avoid the need for this by making the members inline).
@ -49,10 +55,4 @@ const bool LowPowerClock::is_steady;
#endif
const bool RealTimeClock::is_steady;
#if DEVICE_LPTICKER
LowPowerTimeout::LowPowerTimeout() : TimeoutBase(get_lp_ticker_data(), true)
{
}
#endif
} // namespace mbed

View File

@ -15,8 +15,10 @@
* limitations under the License.
*/
#include "drivers/Timer.h"
#include "drivers/LowPowerTimer.h"
#include "hal/ticker_api.h"
#include "hal/us_ticker_api.h"
#include "hal/lp_ticker_api.h"
#include "platform/CriticalSectionLock.h"
#include "platform/mbed_critical.h"
#include "platform/mbed_power_mgmt.h"
@ -121,4 +123,10 @@ Timer::Timer() : TimerBase(get_us_ticker_data(), true)
{
}
#if DEVICE_LPTICKER
LowPowerTimer::LowPowerTimer() : TimerBase(get_lp_ticker_data(), false)
{
}
#endif
} // namespace mbed