mirror of https://github.com/ARMmbed/mbed-os.git
Add default implementation of timer info
Add weak implementations of *_ticker_get_info which returns 1MHz and a width of 32 bits. This allows the updated Ticker API to work with existing devices. Note - in the future when all targets have implemented *_ticker_get_info these weak functions will be removed.pull/5028/head
parent
0d3714e9b7
commit
6452821e2e
|
|
@ -27,6 +27,8 @@
|
||||||
#include "platform/mbed_stats.h"
|
#include "platform/mbed_stats.h"
|
||||||
#include "platform/mbed_critical.h"
|
#include "platform/mbed_critical.h"
|
||||||
#include "platform/PlatformMutex.h"
|
#include "platform/PlatformMutex.h"
|
||||||
|
#include "us_ticker_api.h"
|
||||||
|
#include "lp_ticker_api.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
@ -1063,3 +1065,23 @@ extern "C" clock_t clock()
|
||||||
_mutex->unlock();
|
_mutex->unlock();
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// temporary - Default to 1MHz at 32 bits if target does not have us_ticker_get_info
|
||||||
|
MBED_WEAK const ticker_info_t* us_ticker_get_info()
|
||||||
|
{
|
||||||
|
static const ticker_info_t info = {
|
||||||
|
1000000,
|
||||||
|
32
|
||||||
|
};
|
||||||
|
return &info;
|
||||||
|
}
|
||||||
|
|
||||||
|
// temporary - Default to 1MHz at 32 bits if target does not have lp_ticker_get_info
|
||||||
|
MBED_WEAK const ticker_info_t* lp_ticker_get_info()
|
||||||
|
{
|
||||||
|
static const ticker_info_t info = {
|
||||||
|
1000000,
|
||||||
|
32
|
||||||
|
};
|
||||||
|
return &info;
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue