1
0
mirror of https://github.com/NevermindZZT/letter-shell.git synced 2025-01-21 10:02:54 +08:00

优化 使用伴生对象时hexdump命令的调用

This commit is contained in:
Letter 2021-05-16 16:41:25 +08:00
parent d8ea842719
commit 80ec62eb4e
3 changed files with 11 additions and 4 deletions

View File

@ -246,9 +246,16 @@ void logHexDump(Log *log, LogLevel level, void *base, unsigned int length)
}
#endif /* SHELL_USING_LOCK == 1 */
}
#if SHELL_USING_COMPANION == 1
SHELL_EXPORT_CMD_AGENCY(
SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_DISABLE_RETURN,
hexdump, logHexDump, hex dump\r\n hexdump [base] [len],
(void *)shellCompanionGet(shellGetCurrent(), SHELL_COMPANION_ID_LOG), (void *)LOG_NONE, p1, p2);
#else
SHELL_EXPORT_CMD(
SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC)|SHELL_CMD_DISABLE_RETURN,
hexdump, logHexDump, hex dump\r\n hexdump [log] [level] [base] [len]);
#endif /** SHELL_USING_COMPANION == 1 */
#if SHELL_USING_COMPANION == 1
void logSwitchLevel(Shell *shell)
@ -259,5 +266,4 @@ void logSwitchLevel(Shell *shell)
logPrintln("set log level: %d", log->level);
}
SHELL_EXPORT_KEY(SHELL_CMD_PERMISSION(0), 0x04000000, logSwitchLevel, switch log level);
#endif /** SHELL_USING_COMPANION == 1 */

View File

@ -13,7 +13,7 @@
#include "shell.h"
#define LOG_VERSION "1.0.0"
#define LOG_VERSION "1.0.1"
#define SHELL_COMPANION_ID_LOG -2

View File

@ -1,6 +1,6 @@
# log
![version](https://img.shields.io/badge/version-1.0.0-brightgreen.svg)
![version](https://img.shields.io/badge/version-1.0.1-brightgreen.svg)
![standard](https://img.shields.io/badge/standard-c99-brightgreen.svg)
![build](https://img.shields.io/badge/build-2020.08.02-brightgreen.svg)
![license](https://img.shields.io/badge/license-MIT-brightgreen.svg)
@ -160,11 +160,12 @@ void logSetLevel(Log *log, LogLevel level)
数据16进制打印
```C
void logHexDump(Log *log, void *base, unsigned int length)
void logHexDump(Log *log, LogLevel level, void *base, unsigned int length)
```
- 参数
- `log` log对象
- `level` 日志级别
- `base` 数据基址
- `length` 数据长度