mirror of https://github.com/ARMmbed/mbed-os.git
Use us_ticker_read while SDK is not ready
parent
a65e92ea95
commit
878ce6f72a
|
@ -17,9 +17,19 @@
|
||||||
|
|
||||||
// Overwrite default HAL functions defined as "weak"
|
// Overwrite default HAL functions defined as "weak"
|
||||||
|
|
||||||
|
// This variable is set to 1 at the of mbed_sdk_init function.
|
||||||
|
// The ticker_read_us function must not be called until the mbed_sdk_init is terminated.
|
||||||
|
extern int mbed_sdk_inited;
|
||||||
|
|
||||||
uint32_t HAL_GetTick()
|
uint32_t HAL_GetTick()
|
||||||
{
|
{
|
||||||
return ticker_read_us(get_us_ticker_data()) / 1000; // 1 ms tick is required for ST HAL
|
// 1 ms tick is required for ST HAL driver
|
||||||
|
if (mbed_sdk_inited) {
|
||||||
|
return (ticker_read_us(get_us_ticker_data()) / 1000);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return (us_ticker_read() / 1000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HAL_SuspendTick(void)
|
void HAL_SuspendTick(void)
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
*/
|
*/
|
||||||
#include "cmsis.h"
|
#include "cmsis.h"
|
||||||
|
|
||||||
|
int mbed_sdk_inited = 0;
|
||||||
|
|
||||||
// This function is called after RAM initialization and before main.
|
// This function is called after RAM initialization and before main.
|
||||||
void mbed_sdk_init()
|
void mbed_sdk_init()
|
||||||
{
|
{
|
||||||
|
@ -51,4 +53,6 @@ void mbed_sdk_init()
|
||||||
AHB/APBx prescalers and Flash settings */
|
AHB/APBx prescalers and Flash settings */
|
||||||
SetSysClock();
|
SetSysClock();
|
||||||
SystemCoreClockUpdate();
|
SystemCoreClockUpdate();
|
||||||
|
|
||||||
|
mbed_sdk_inited = 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue