仓库迁移
This commit is contained in:
49
source/task/commend.h
Normal file
49
source/task/commend.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#ifndef commend_h__
|
||||
#define commend_h__
|
||||
|
||||
|
||||
#include "list.h"
|
||||
#include "bytearray.h"
|
||||
#include "signal.h"
|
||||
|
||||
|
||||
// 执行命令函数不能调用延时函数
|
||||
typedef int (*cmd_fun_def)(list_def *argv /* str */);
|
||||
|
||||
|
||||
|
||||
typedef struct{
|
||||
const char *name;
|
||||
const char *help;
|
||||
cmd_fun_def fun;
|
||||
}commend_def;
|
||||
|
||||
|
||||
|
||||
|
||||
#define commend_export(name_,fun_,help_) \
|
||||
const static char __cmd_##name_##_name[] SECTION(".rodata.cmdstr") = #name_; \
|
||||
const static char __cmd_##name_##_help[] SECTION(".rodata.cmdstr") = help_; \
|
||||
RT_USED static commend_def _cmd_##name_ SECTION("cmdstruct")= \
|
||||
{\
|
||||
.name=__cmd_##name_##_name,\
|
||||
.help=__cmd_##name_##_help,\
|
||||
.fun=fun_,\
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int cmd_print(const char *fmt,...);
|
||||
|
||||
|
||||
|
||||
signal cmd_reply_signal(void *obj,uint8_t cmd,array_def *data);
|
||||
|
||||
void cmd_recv_slot(void *obj,uint8_t cmd,array_def *data,char *err_str);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user