Initial commit: CCU621_M firmware project with BLE debug link support.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* @file app_myshell.c
|
||||
* @brief 扩展 Shell 命令(与 CCU601E_D\BSP\letter_shell\app_myshell.c 对齐的串口打印开关等)
|
||||
*/
|
||||
|
||||
#include "publicdata/public_define.h"
|
||||
|
||||
#if (MY_SHELL_EN)
|
||||
|
||||
#include "letter_shell/shell_port.h"
|
||||
#include "usart.h"
|
||||
#include "shell.h"
|
||||
#include "publicdata/publicdata.h"
|
||||
|
||||
/* slot 0~6 对应:USART0, USART2, UART3, UART4, USART5, UART6, UART7(与 u16_usart_* 的 E_USART_ID 一致) */
|
||||
static const uint8_t s_usart_slot_hw_num[USART_NUM_PRINT_CNT] = { 0U, 2U, 3U, 4U, 5U, 6U, 7U };
|
||||
|
||||
void usart_printf_Func(int id, int on)
|
||||
{
|
||||
if ((id < 0) || (id >= (int)USART_NUM_PRINT_CNT)) {
|
||||
v_shell_print("usart_printf: id must be 0~6 (0=USART0,1=USART2,2=UART3,...)\r\n");
|
||||
return;
|
||||
}
|
||||
if ((on < 0) || (on > 1)) {
|
||||
v_shell_print("usart_printf: on must be 0 or 1\r\n");
|
||||
return;
|
||||
}
|
||||
u8_uasrt_print[(uint8_t)id] = (U8_T)on;
|
||||
|
||||
v_shell_print("usart slot[%d] hw=USART%u print=%d\r\n", id, (unsigned int)s_usart_slot_hw_num[(uint8_t)id], on);
|
||||
v_shell_print("flags [%d][%d][%d][%d] [%d][%d][%d]\r\n",
|
||||
(int)u8_uasrt_print[0], (int)u8_uasrt_print[1], (int)u8_uasrt_print[2], (int)u8_uasrt_print[3],
|
||||
(int)u8_uasrt_print[4], (int)u8_uasrt_print[5], (int)u8_uasrt_print[6]);
|
||||
}
|
||||
|
||||
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0) | SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC),
|
||||
usart_printf,
|
||||
usart_printf_Func,
|
||||
shell-- usart_printf slot(0-6) on(0/1) dump u16 send/recv);
|
||||
// 命令
|
||||
|
||||
static void v_reboot_func(void)
|
||||
{
|
||||
v_shell_print("Execute system reboot command\r\n");
|
||||
v_sys_reboot();
|
||||
}
|
||||
SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC), reboot, v_reboot_func, myshlle-- reboot sys);
|
||||
#endif /* MY_SHELL_EN */
|
||||
Reference in New Issue
Block a user