3 changed files with 50 additions and 1 deletions
@ -0,0 +1,29 @@ |
|||||
|
#include "VK_Log.h" |
||||
|
#include <ulog.h> |
||||
|
|
||||
|
static struct ulog_backend dev_backend; |
||||
|
|
||||
|
static rt_device_t log_dev = RT_NULL; |
||||
|
|
||||
|
|
||||
|
static void dev_log_output(struct ulog_backend *backend, |
||||
|
rt_uint32_t level, |
||||
|
const char *tag, |
||||
|
rt_bool_t is_raw, |
||||
|
const char *log, |
||||
|
size_t len) |
||||
|
{ |
||||
|
if (log_dev != RT_NULL && len > 0) |
||||
|
{ |
||||
|
rt_device_write(log_dev, 0, log, len); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
int dev_log_backend_init(rt_device_t dev){ |
||||
|
log_dev = dev; |
||||
|
rt_memset(&dev_backend, 0 , sizeof(dev_backend)); |
||||
|
dev_backend.output = dev_log_output; |
||||
|
|
||||
|
return ulog_backend_register(&dev_backend, "uart3", RT_FALSE); |
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
#pragma once |
||||
|
|
||||
|
#include "rtthread.h" |
||||
|
#include "rtdevice.h" |
||||
|
|
||||
|
#ifdef __cplusplus |
||||
|
extern "C"{ |
||||
|
#endif |
||||
|
|
||||
|
|
||||
|
int dev_log_backend_init(rt_device_t dev); |
||||
|
|
||||
|
|
||||
|
|
||||
|
#ifdef __cplusplus |
||||
|
} |
||||
|
#endif |
||||
Loading…
Reference in new issue