diff --git a/cores/arduino/delay.c b/cores/arduino/delay.c index 59189351d9069140bcfc49524123fa07a3a60809..834278413afa6a04696a2196a2992a372d79550a 100644 --- a/cores/arduino/delay.c +++ b/cores/arduino/delay.c @@ -43,22 +43,6 @@ uint32_t micros( void ) // a runtime multiplication and shift, saving a few cycles } -// original function: -// uint32_t micros( void ) -// { -// uint32_t ticks ; -// uint32_t count ; -// -// SysTick->CTRL; -// do { -// ticks = SysTick->VAL; -// count = GetTickCount(); -// } while (SysTick->CTRL & SysTick_CTRL_COUNTFLAG_Msk); -// -// return count * 1000 + (SysTick->LOAD + 1 - ticks) / (SystemCoreClock/1000000) ; -// } - - void delay( uint32_t ms ) { if ( ms == 0 ) @@ -74,6 +58,12 @@ void delay( uint32_t ms ) } while ( _ulTickCount - start < ms ) ; } +void SysTick_Handler( void ) +{ + // Increment tick count each ms + _ulTickCount++ ; +} + #ifdef __cplusplus } #endif