#include "LetterShell.h" #include "shell.h" /* 板级BSP头文件 */ #include "Bsp.h" #define WR_BUFFER_SIZE 512 /* 1. 创建shell对象,开辟shell缓冲区 */ Shell Host; //Shell实例化 char HostBuffer[WR_BUFFER_SIZE]; //读写缓冲区 uint32_t HostId; //串口号 // /** // * @brief Shell写函数 // * @param ComId 串口号,ch 数据 // * @retval void // * @note void // * @example void // */ // signed short ShellWrite(char* ch, unsigned short Len) // { // UsartSendStr(HostId, (uint8_t* )ch,Len); // return Len; // } // /** // * @brief Shell读函数 - 中断回调实现 // * @param Vector 中断向量号 // * @retval void // * @note void // * @example void // */ // void LetterShellIrqFunc(uint32_t Vector) // { // uint8_t ch = 0x00; // ch = UsartReceiveChar(Vector); // // shellHandler(&Host, ch); // } // // // /** // * @brief 初始化Shell // * @param ComId 串口号,baud 波特率 // * @retval void // * @note void // * @example void // */ // void LetterShellInit(uint32_t ComId, uint32_t baud) // { // HostId = ComId; // // //初始化串口 // UsartStdConfig(ComId, baud); // //设置串口回调函数 // InterruptRegister(TTY_COM_IRQN, LetterShellIrqFunc); // //设置中断等级 // InterruptSetLevel(TTY_COM_IRQN,1,1); // //注册写函数 // Host.write = ShellWrite; // // shellInit(&Host, HostBuffer, WR_BUFFER_SIZE); // } // // /** // * @brief 打印版本号 // * @param void // * @retval void // * @note void // * @example void // */ // void version(void) // { // printf("%s,%s\r\n",HARDWARE_VERSION,SOFTWARE_VERSION); // } // // /** // * @brief 重启单片机 // * @param void // * @retval void // * @note void // * @example void // */ // void reboot(void) // { // SystemReboot(); // } // // /** // * @brief 串口测试程序 // * @param void // * @retval void // * @note void // * @example void // */ // // void comTest(uint8_t ComId) // { // } // // //打印版本号 // SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC), version, version, version); // //软重启单片机 // SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC), reboot, reboot, reboot); // //串口测试 // SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC), comTest, comTest, comTest);