Skip to content

Commit 6452821

Browse files
committed
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.
1 parent 0d3714e commit 6452821

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

platform/mbed_retarget.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
#include "platform/mbed_stats.h"
2828
#include "platform/mbed_critical.h"
2929
#include "platform/PlatformMutex.h"
30+
#include "us_ticker_api.h"
31+
#include "lp_ticker_api.h"
3032
#include <stdlib.h>
3133
#include <string.h>
3234
#include <limits.h>
@@ -1063,3 +1065,23 @@ extern "C" clock_t clock()
10631065
_mutex->unlock();
10641066
return t;
10651067
}
1068+
1069+
// temporary - Default to 1MHz at 32 bits if target does not have us_ticker_get_info
1070+
MBED_WEAK const ticker_info_t* us_ticker_get_info()
1071+
{
1072+
static const ticker_info_t info = {
1073+
1000000,
1074+
32
1075+
};
1076+
return &info;
1077+
}
1078+
1079+
// temporary - Default to 1MHz at 32 bits if target does not have lp_ticker_get_info
1080+
MBED_WEAK const ticker_info_t* lp_ticker_get_info()
1081+
{
1082+
static const ticker_info_t info = {
1083+
1000000,
1084+
32
1085+
};
1086+
return &info;
1087+
}

0 commit comments

Comments
 (0)