标签:core col code bsp HAL库 amp 延时 style nbsp
//利用已有的SysTick配置,读取计数判断延迟 void delay_us(uint32_t udelay) { uint32_t startval,tickn,delays,wait; startval = SysTick->VAL; tickn = HAL_GetTick(); //sysc = 72000; //SystemCoreClock / (1000U / uwTickFreq); delays =udelay * 72; //sysc / 1000 * udelay; if(delays > startval) { while(HAL_GetTick() == tickn) { } wait = 72000 + startval - delays; while(wait < SysTick->VAL) { } } else { wait = startval - delays; while(wait < SysTick->VAL && HAL_GetTick() == tickn) { } } }
标签:core col code bsp HAL库 amp 延时 style nbsp
原文地址:https://www.cnblogs.com/nsss/p/13172443.html