Module riot_wrappers::shell

source ·
Available on riot_module_shell only.
Expand description

Tools for running RIOT’s built-in shell

This module can be used in two ways:

  • Declare static commands using static_command!; these only take a fn (not a closure) because shell commands don’t have an arg pointer.

    This works even in RIOT modules that are included in a C application that starts a shell, and show up in shells created through Rust without explicit inclusion.

  • Use new to start building a CommandList. This can have full closures as commands, but these are available only when the shell is then started throught the CommandList’s run methods.

§Note on complexity of this module

Quite a bit of complexity in this module is due to building the array of commands, and moreover, creating trampoline functions that go through a global mutex to get a hold of the command list – an exercise necessary due to the RIOT commands’ lack of a *void data argument. This does allow the Rust wrappers to “just so” use a closure as a command handler, but also needs a lot of code.

That complexity is not pulled in when only using static_command! and running on an otherwise empty command list.

Structs§

Traits§

  • A list of commands that can be presented as a shell prompt
  • Something that can build a suitable command array for itself and its next commands using shell_run_once etc.

Functions§

  • Start a blank list of commands