修改can总线上传延时算法

This commit is contained in:
ranchuan
2024-01-23 18:13:09 +08:00
parent c3c172717d
commit caa4e61b89
9 changed files with 52 additions and 16 deletions

View File

@@ -46,6 +46,7 @@ typedef struct{
struct rt_mutex mutex;
#endif
uart_def *uart;
int enable;
}self_def;
static self_def g_data;
@@ -89,12 +90,29 @@ void debug_log(const char *file,const char *fun,int line,int level,const char *f
va_end(args);
memcpy(&log_buf[length],"\r\n",2);
length+=2;
DBG_DEV_WRITE((const uint8_t *)log_buf,length);
if(g_data.enable!=0){
DBG_DEV_WRITE((const uint8_t *)log_buf,length);
}
#ifdef RT_THREAD
rt_mutex_release(&g_data.mutex);
#endif
}
void debug_enable(int enable)
{
g_data.enable=enable;
}
#else
void debug_enable(int enable)
{
}
#endif

View File

@@ -61,6 +61,8 @@ int debug_init(void);
void debug_log(const char *file,const char *fun,int line,int level,const char *fmt, ...);
void debug_enable(int enable);
#else
#define debug_init()