Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed
Fork of ICE by
Diff: src/CommandParser/cmd.cpp
- Revision:
- 14:cc916fa8dd11
- Parent:
- 13:c80c283f9db2
- Child:
- 17:dfa2c53b3f38
- Child:
- 18:9cf694a764c0
--- a/src/CommandParser/cmd.cpp Wed Sep 07 13:52:25 2016 +0000 +++ b/src/CommandParser/cmd.cpp Wed Sep 07 14:51:00 2016 +0000 @@ -39,6 +39,8 @@ Serial serial(USBTX, USBRX); ntshell_t ntshell; +extern mDot *GLOBAL_mdot; + typedef struct { char *command; // command (from shell) char *description; // descrption @@ -52,8 +54,10 @@ {"destroy", "destroy a control", cmd_destroy }, {"heap", "show heap statistics", cmd_heap }, {"help", "help command", cmd_help }, + {"ls", "list user files", cmd_ls }, {"modify", "modify a control", cmd_modify }, {"reset", "reset the controller", cmd_reset }, + {"rm", "remove a user file", cmd_rm }, {"showControls", "display active controls", cmd_ShowControls }, {NULL, NULL, NULL} }; @@ -131,6 +135,18 @@ printf("\r\n"); } +void cmd_ls(int argc, char **argv) +{ + vector<mDot::mdot_file> userFiles; + userFiles = GLOBAL_mdot->listUserFiles(); + vector<mDot::mdot_file>::iterator pos; + + for ( pos = userFiles.begin(); pos != userFiles.end(); ++pos ) { + printf("\r %-33s %d\n", pos->name, pos->size); + } + printf("\r\n"); +} + void cmd_ShowControls(int argc, char **argv) { @@ -143,10 +159,22 @@ { UNUSED(argc); UNUSED(argv); - //NVIC_SystemReset(); GLOBAL_mdot->resetCpu(); } +void cmd_rm(int argc, char **argv) +{ + UNUSED(argc); + UNUSED(argv); + + if ( argc != 2 ) { + printf("\rusage: rm <filename>\n"); + return; + } + // attempt to remove a user file + GLOBAL_mdot->deleteUserFile(argv[1]); +} + void cmd_create(int argc, char **argv) { if ( argc != 3 ) {