SysTimer: default to us ticker if lp ticker is unavailable

pull/10597/head
Lingkai Dong 2019-05-13 15:21:58 +01:00
parent 8e44a75a75
commit 9f12e55340
2 changed files with 12 additions and 4 deletions

View File

@ -21,8 +21,9 @@
*/
#include "rtos/TARGET_CORTEX/SysTimer.h"
#if DEVICE_LPTICKER
#if MBED_TICKLESS
#include "hal/us_ticker_api.h"
#include "hal/lp_ticker_api.h"
#include "mbed_critical.h"
#include "mbed_assert.h"
@ -58,7 +59,12 @@ namespace rtos {
namespace internal {
SysTimer::SysTimer() :
TimerEvent(get_lp_ticker_data()), _time_us(0), _tick(0)
#if DEVICE_LPTICKER
TimerEvent(get_lp_ticker_data()),
#else
TimerEvent(get_us_ticker_data()),
#endif
_time_us(0), _tick(0)
{
_time_us = ticker_read_us(_ticker_data);
_suspend_time_passed = true;
@ -69,6 +75,8 @@ SysTimer::SysTimer(const ticker_data_t *data) :
TimerEvent(data), _time_us(0), _tick(0)
{
_time_us = ticker_read_us(_ticker_data);
_suspend_time_passed = true;
_suspended = false;
}
void SysTimer::setup_irq()
@ -194,4 +202,4 @@ void SysTimer::handler()
}
}
#endif
#endif // MBED_TICKLESS

View File

@ -22,7 +22,7 @@
#ifndef MBED_SYS_TIMER_H
#define MBED_SYS_TIMER_H
#if DEVICE_LPTICKER || defined(DOXYGEN_ONLY)
#if MBED_TICKLESS || defined(DOXYGEN_ONLY)
#include "platform/NonCopyable.h"
#include "drivers/TimerEvent.h"