File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 14
14
* limitations under the License.
15
15
*/
16
16
#include "hal/us_ticker_api.h"
17
+ #include "hal_tick.h"
17
18
18
19
// Overwrite default HAL functions defined as "weak"
19
20
20
21
// This variable is set to 1 at the of mbed_sdk_init function.
21
22
// The ticker_read_us function must not be called until the mbed_sdk_init is terminated.
22
23
extern int mbed_sdk_inited ;
23
24
25
+ #if TIM_MST_16BIT
24
26
// Variables also reset in HAL_InitTick()
25
27
uint32_t prev_time = 0 ;
26
28
uint32_t elapsed_time = 0 ;
29
+ #endif
27
30
28
31
// 1 ms tick is required for ST HAL driver
29
32
uint32_t HAL_GetTick ()
30
33
{
34
+ #if TIM_MST_16BIT
31
35
uint32_t new_time ;
32
36
if (mbed_sdk_inited ) {
33
37
// Apply the latest time recorded just before the sdk is inited
@@ -41,6 +45,14 @@ uint32_t HAL_GetTick()
41
45
prev_time = new_time ;
42
46
return (elapsed_time / 1000 );
43
47
}
48
+ #else // 32-bit timer
49
+ if (mbed_sdk_inited ) {
50
+ return (ticker_read_us (get_us_ticker_data ()) / 1000 );
51
+ }
52
+ else {
53
+ return (us_ticker_read () / 1000 );
54
+ }
55
+ #endif
44
56
}
45
57
46
58
void HAL_SuspendTick (void )
You can’t perform that action at this time.
0 commit comments