V2.13 使用新的can帧回复数据
解决ew自检模式 8导致小板死机的bug,自检返回值除以400,单位0.1ms
This commit is contained in:
@@ -46,7 +46,29 @@ static uint32_t delay_get_tick(void)
|
||||
}
|
||||
|
||||
|
||||
// 获取当前微妙数
|
||||
uint32_t delay_get_us(void)
|
||||
{
|
||||
return ((uint32_t)DWT_CYCCNT/(get_sys_clocks_freq()/1000000));
|
||||
}
|
||||
|
||||
// 判断延时是否到,返回1已到,0未到
|
||||
int delay_check(uint32_t old,uint32_t wnd)
|
||||
{
|
||||
uint32_t now=delay_get_us();
|
||||
if(now>=old){
|
||||
if((now-old)>=wnd){
|
||||
return 1;
|
||||
}
|
||||
}else{
|
||||
if((UINT32_MAX - old + now)>=wnd){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 最长可以延时59s
|
||||
// 低于1ms的精确延时
|
||||
void delay_us(uint32_t us)
|
||||
{
|
||||
|
Reference in New Issue
Block a user