Skip to content

Commit

Permalink
serial: 从外部定义 TRACE_DATA 和 TRACE_SLIP 开关
Browse files Browse the repository at this point in the history
  • Loading branch information
xychen committed May 30, 2023
1 parent 66f0e36 commit 2ac5c42
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions libcskburn_serial/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,13 @@ target_link_libraries(${PROJECT_NAME} portable)
target_link_libraries(${PROJECT_NAME} serial)
target_link_libraries(${PROJECT_NAME} io)

if($ENV{TRACE_DATA})
target_compile_options(${PROJECT_NAME} PRIVATE -DTRACE_DATA=$ENV{TRACE_DATA})
endif()

if($ENV{TRACE_SLIP})
target_compile_options(${PROJECT_NAME} PRIVATE -DTRACE_SLIP=$ENV{TRACE_SLIP})
endif()

add_subdirectory(test)
add_test(NAME ${PROJECT_NAME} COMMAND libcskburn_serial_test)
5 changes: 5 additions & 0 deletions libcskburn_serial/src/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@
#include "slip.h"
#include "time_monotonic.h"

#ifndef TRACE_DATA
#define TRACE_DATA 0
#endif

#ifndef TRACE_SLIP
#define TRACE_SLIP 0
#endif

#define DIR_REQ 0x00
#define DIR_RES 0x01
Expand Down

0 comments on commit 2ac5c42

Please sign in to comment.