这是us延时函数
void delay_us(rt_uint32_t nus)
{
u32 temp;
SysTick_CLKSourceConfig(SysTick_CLKSource_HCLK); //select system clock
SysTick->LOAD=nus*(SystemCoreClock/(1000000/RT_TICK_PER_SECOND)); //time relode
SysTick->VAL=0x00; //clear timer value
SysTick->CTRL|=SysTick_CTRL_ENABLE_Msk ; //Start countdown
do
{
temp=SysTick->CTRL;
}
while(temp&0x01&&!(temp&(1<<16)));//wait for the time reach
SysTick->CTRL&=~SysTick_CTRL_ENABLE_Msk; //close the count
SysTick->VAL =0X00; //clear timer value
}
msh >[W/UART] Warning: There is no enough buffer for saving data, please increase the RT_SERIAL_RB_BUFSZ option.
list_thread
thread pri status sp stack size max used left tick error
-------- --- ------- ---------- ---------- ------ ---------- ---
serial3 9 suspend 0x000000a4 0x00000400 16% 0x0000000a 000
serial 9 suspend 0x000000b4 0x00000400 17% 0x0000000a 000
motor 9 suspend 0x000000ac 0x00000200 33% 0x0000000a 000
key 9 suspend 0x000000b4 0x00000200 35% 0x0000000a 000
read_adc 15 suspend 0x000000bc 0x00000200 46% 0x0000000a 000
tshell 20 running 0x000000cc 0x00001000 14% 0x0000000a 000
tidle0 31 ready 0x00000074 0x00000100 45% 0x00000020 000
timer 4 suspend 0x0000007c 0x00000200 24% 0x00000009 000
main 10 suspend 0x000000b8 0x00000800 17% 0x00000007 000
msh >
|