File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed
libraries/SrcWrapper/src/stm32 Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -28,16 +28,17 @@ extern "C" {
2828 */
2929uint32_t getCurrentMicros (void )
3030{
31- /* Ensure COUNTFLAG is reset by reading SysTick control and status register */
32- LL_SYSTICK_IsActiveCounterFlag ();
33- uint32_t m = HAL_GetTick ();
31+ uint32_t m0 = HAL_GetTick ();
32+ __IO uint32_t u0 = SysTick -> VAL ;
33+ uint32_t m1 = HAL_GetTick ();
34+ __IO uint32_t u1 = SysTick -> VAL ;
3435 const uint32_t tms = SysTick -> LOAD + 1 ;
35- __IO uint32_t u = tms - SysTick -> VAL ;
36- if (LL_SYSTICK_IsActiveCounterFlag ()) {
37- m = HAL_GetTick ();
38- u = tms - SysTick -> VAL ;
36+
37+ if (m1 != m0 ) {
38+ return ( m1 * 1000 + ((tms - u1 ) * 1000 ) / tms );
39+ } else {
40+ return ( m0 * 1000 + ((tms - u0 ) * 1000 ) / tms );
3941 }
40- return (m * 1000 + (u * 1000 ) / tms );
4142}
4243
4344/**
You can’t perform that action at this time.
0 commit comments