Oh great
I thought i did not have to mess with the schell_commands.c file.
Thanks for the quick answer
Hi Stephane,
in order to register your own commands (which is then accessible through the
shell after auto_init) you have to do three things:
1. Add a handler for your shell command into a file under the directory
sys/shell/commands. By convention you would call the file sc_<your module
name>.c
(e.g. the command handler file for ps is called sc_ps.c).
2. Add two ifdefs in the file sys/shell/commands/shell_commands.c .
One ifdef at the top of the file declaring your handler function from the
previous step
as extern. The ifdef would have the form:
#ifdef MODULE_<your module name>
extern int <your handler function>(int argc, char **argv);
#endif
At the bottom of the file you need to add a second ifdef in the form:
#ifdef MODULE_<your module name>
{"<command name in the shell>", "<command description>", <your handler
function>},
#endif
3. The last thing you need to do is to change the Makefile in
sys/shell/commands
Add a statement in the form:
ifneq (,$(filter <your module name>,$(USEMODULE)))
SRC += sc_<your module name>.c
endif
After this your commands will be available in the shell if you put both
USEMODULE += shell
and
USEMODULE += <your module name>
into your application Makefile.
Also: if you need some inspiration on how to write the shell handler take a
look at
the one for the mersenne module: sys/shell/commands/sc_mersenne.c
I hope this helps.
Best,
Philipp
2015-07-01 20:18 GMT+02:00 Stephane Kamga <[email protected]>:
>
> Hello everyone
>
> I’m a RIOT new user and i’m teaching myself into building a custom module.
> I was wondering if there was a way to include my custom shell commands
(module related commands)
> during auto-init with no involvment of the application using the module.
>
> thanks folks
> - -
>
> Stephane Kamga
>
>
>
>
>
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.riot-os.org/mailman/listinfo/users
>
_______________________________________________
users mailing list
[email protected]
http://lists.riot-os.org/mailman/listinfo/users
_______________________________________________
users mailing list
[email protected]
http://lists.riot-os.org/mailman/listinfo/users