瀏覽代碼

add clear

jch12138 5 年之前
父節點
當前提交
ebfba4974c
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      components/finsh/cmd.c

+ 10 - 0
components/finsh/cmd.c

@@ -29,6 +29,7 @@
  * 2018-11-22     Jesven       list_thread add smp support
  * 2018-11-22     Jesven       list_thread add smp support
  * 2018-12-27     Jesven       Fix the problem that disable interrupt too long in list_thread 
  * 2018-12-27     Jesven       Fix the problem that disable interrupt too long in list_thread 
  *                             Provide protection for the "first layer of objects" when list_*
  *                             Provide protection for the "first layer of objects" when list_*
+ * 2020-04-07     chenhui      add clear 
  */
  */
 
 
 #include <rthw.h>
 #include <rthw.h>
@@ -48,6 +49,15 @@ long hello(void)
 }
 }
 FINSH_FUNCTION_EXPORT(hello, say hello world);
 FINSH_FUNCTION_EXPORT(hello, say hello world);
 
 
+long clear(void)
+{
+    rt_kprintf("\x1b[2J\x1b[H");
+
+    return 0;
+}
+FINSH_FUNCTION_EXPORT(clear,clear the terminal screen);
+MSH_CMD_EXPORT(clear,clear the terminal screen);
+
 extern void rt_show_version(void);
 extern void rt_show_version(void);
 long version(void)
 long version(void)
 {
 {