#include "delay.h" /* @ brief 延时函数 @ param @ return @ note 2022-5-23 */ void delay_us(int us) { uint32_t start, now, delta, reload, us_tick; start = SysTick->VAL; reload = SysTick->LOAD; us_tick = SystemCoreClock / 1000000UL; do { now = SysTick->VAL; delta = start > now ? start - now : reload + start - now; } while (delta < us_tick * us); } void delay_ms(int ms)//封装了,不能直接替换,不知道为什么 { rt_thread_mdelay(ms); }