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.
Dependents: kl25z-tinyshell-demo HelloWorld_IHM02A1
Homepage
This library is a port of tiny shell library to mbed enviroment.
Features
- Autocomplete
- Command history
- Linux like
Tiny Shell minimal example
#include "mbed.h"
#include "tinysh.h"
//serial port to use
Serial pc(USBTX, USBRX);
//custom function
void foo_fnt(int argc, char **argv)
{
printf("foo command called\r\n");
for(int i=0; i<argc; i++) {
printf("argv[%d]=\"%s\"\r\n",i,argv[i]);
}
}
//custom command
tinysh_cmd_t myfoocmd= {0,"foo","foo command","[args]",foo_fnt,0,0,0};
//mandatory tiny shell output function
void tinysh_char_out(unsigned char c)
{
pc.putc(c);
}
void main(void){
//configure serial baudrate
pc.baud(115200);
//print build date
pc.printf("tiny shell build %s %s\r\n",__DATE__,__TIME__);
//set prompt
tinysh_set_prompt("$ ");
//add custom commands here
tinysh_add_command(&myfoocmd);
//run command parser loop foverer
while(true) {
tinysh_char_in( pc.getc() );
}
}