File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 17
17
18
18
// Overwrite default HAL functions defined as "weak"
19
19
20
+ // This variable is set to 1 at the of mbed_sdk_init function.
21
+ // The ticker_read_us function must not be called until the mbed_sdk_init is terminated.
22
+ extern int mbed_sdk_inited ;
23
+
20
24
uint32_t HAL_GetTick ()
21
25
{
22
- return ticker_read_us (get_us_ticker_data ()) / 1000 ; // 1 ms tick is required for ST HAL
26
+ // 1 ms tick is required for ST HAL driver
27
+ if (mbed_sdk_inited ) {
28
+ return (ticker_read_us (get_us_ticker_data ()) / 1000 );
29
+ }
30
+ else {
31
+ return (us_ticker_read () / 1000 );
32
+ }
23
33
}
24
34
25
35
void HAL_SuspendTick (void )
Original file line number Diff line number Diff line change 27
27
*/
28
28
#include "cmsis.h"
29
29
30
+ int mbed_sdk_inited = 0 ;
31
+
30
32
// This function is called after RAM initialization and before main.
31
33
void mbed_sdk_init ()
32
34
{
@@ -51,4 +53,6 @@ void mbed_sdk_init()
51
53
AHB/APBx prescalers and Flash settings */
52
54
SetSysClock ();
53
55
SystemCoreClockUpdate ();
56
+
57
+ mbed_sdk_inited = 1 ;
54
58
}
You can’t perform that action at this time.
0 commit comments