Lines Matching +full:input +full:- +full:gain +full:- +full:control
13 This module allows you to create and handle a shell with a user-defined command
15 interaction is required. This module is a Unix-like shell with these features:
22 * Built-in commands: :command:`clear`, :command:`shell`, :command:`colors`,
27 * Support for ANSI escape codes: ``VT100`` and ``ESC[n~`` for cursor control
30 * Built-in handler to display help for the commands.
48 The module can be connected to any transport for command input and output.
59 * DUMMY - not a physical transport layer.
68 .. code-block:: none
80 `tab completion <tab-feature_>`_, and `history <history-feature_>`_
86 To configure Shell USB CDC ACM backend, simply add the snippet ``cdc-acm-console``
89 .. code-block:: console
91 west build -S cdc-acm-console [...]
95 - :zephyr_file:`snippets/cdc-acm-console/cdc-acm-console.conf`.
96 - :zephyr_file:`snippets/cdc-acm-console/cdc-acm-console.overlay`.
101 To configure Bluetooth LE (NUS) backend, simply add the snippet ``nus-console``
104 .. code-block:: console
106 west build -S nus-console [...]
110 - :zephyr_file:`snippets/nus-console/nus-console.conf`.
111 - :zephyr_file:`snippets/nus-console/nus-console.overlay`.
118 - :kconfig:option:`CONFIG_USE_SEGGER_RTT`
119 - :kconfig:option:`CONFIG_SHELL_BACKEND_RTT`
120 - :kconfig:option:`CONFIG_SHELL_BACKEND_SERIAL`
128 -----------
134 .. code-block:: none
146 * Now you should have a network connection to RTT that will let you enter input
150 --------------------------------------------------------
152 On macOS JLinkRTTClient won't let you enter input. Instead, please use following
157 .. code-block:: none
159 JLinkRTTLogger -Device NRF52840_XXAA -RTTChannel 1 -if SWD -Speed 4000 ~/rtt.log
165 .. code-block:: none
169 * Now you should have a network connection to RTT that will let you enter input
188 Commonly-used command groups
194 ----
196 - :kconfig:option:`CONFIG_GPIO`
197 - :kconfig:option:`CONFIG_GPIO_SHELL`
200 ---
202 - :kconfig:option:`CONFIG_I2C`
203 - :kconfig:option:`CONFIG_I2C_SHELL`
206 ------
208 - :kconfig:option:`CONFIG_SENSOR`
209 - :kconfig:option:`CONFIG_SENSOR_SHELL`
212 -----
214 - :kconfig:option:`CONFIG_FLASH`
215 - :kconfig:option:`CONFIG_FLASH_SHELL`
217 File-System
218 -----------
220 - :kconfig:option:`CONFIG_FILE_SYSTEM`
221 - :kconfig:option:`CONFIG_FILE_SYSTEM_SHELL`
228 * :c:macro:`SHELL_CMD_REGISTER` - Create root command. All root commands must
230 * :c:macro:`SHELL_COND_CMD_REGISTER` - Conditionally (if compile time flag is
232 * :c:macro:`SHELL_CMD_ARG_REGISTER` - Create root command with arguments.
234 * :c:macro:`SHELL_COND_CMD_ARG_REGISTER` - Conditionally (if compile time flag
237 * :c:macro:`SHELL_CMD` - Initialize a command.
238 * :c:macro:`SHELL_COND_CMD` - Initialize a command if compile time flag is set.
239 * :c:macro:`SHELL_EXPR_CMD` - Initialize a command if compile time expression is
240 non-zero.
241 * :c:macro:`SHELL_CMD_ARG` - Initialize a command with arguments.
242 * :c:macro:`SHELL_COND_CMD_ARG` - Initialize a command with arguments if compile
244 * :c:macro:`SHELL_EXPR_CMD_ARG` - Initialize a command with arguments if compile
245 time expression is non-zero.
246 * :c:macro:`SHELL_STATIC_SUBCMD_SET_CREATE` - Create a static subcommands
248 * :c:macro:`SHELL_SUBCMD_DICT_SET_CREATE` - Create a dictionary subcommands
250 * :c:macro:`SHELL_DYNAMIC_CMD_CREATE` - Create a dynamic subcommands array.
257 ---------------
266 .. code-block:: c
284 every time you want to use a pair: (string <-> corresponding data) in
289 Let's use an example. Suppose you created a command to set an ADC gain.
296 .. code-block:: c
301 int gain;
304 gain = (int)data;
305 adc_set_gain(gain);
307 shell_print(sh, "ADC gain set to: %s\n"
310 gain);
316 (gain_1, 1, "gain 1"), (gain_2, 2, "gain 2"),
317 (gain_1_2, 3, "gain 1/2"), (gain_1_4, 4, "gain 1/4")
319 SHELL_CMD_REGISTER(gain, &sub_gain, "Set ADC gain", NULL);
329 ----------------
335 .. code-block:: none
345 .. code-block:: c
360 entry->syntax = dynamic_cmd_buffer[idx];
361 entry->handler = NULL;
362 entry->subcmd = NULL;
363 entry->help = "Show dynamic command name.";
368 entry->syntax = NULL;
404 .. code-block:: c
422 --------------------------
426 * :c:macro:`root_cmd` - root command without a handler
427 * :c:macro:`cmd_xxx_h` - command has a handler
428 * :c:macro:`cmd_xxx` - command does not have a handler
461 ----------------
465 .. code-block:: c
491 ------------
493 Every user-defined command or subcommand can have its own help description.
499 or subcommand with ``-h`` or ``--help`` parameter.
502 ---------------
512 .. code-block:: c
520 * can be found using argv[-1].
523 argv[-1]);
534 Built-in commands
539 * :command:`clear` - Clears the screen.
540 * :command:`history` - Shows the recently entered commands.
541 * :command:`resize` - Must be executed when terminal width is different than 80
544 handling. Currently this command works only with UART flow control switched
547 * :command:`default` - Shell will send terminal width = 80 to the
552 * :command:`select` - It can be used to set new root command. Exit to main
555 * :command:`shell` - Root command with useful shell-related subcommands like:
557 * :command:`echo` - Toggles shell echo.
558 * :command:`colors` - Toggles colored syntax. This might be helpful in
560 * :command:`stats` - Shows shell statistics.
562 .. _tab-feature:
569 It can also be used for partial or complete auto-completion of commands.
583 .. _history-feature:
603 .. code-block:: none
618 .. list-table:: Implemented meta keys
620 :header-rows: 1
622 * - Meta keys
623 - Action
624 * - :kbd:`Ctrl+a`
625 - Moves the cursor to the beginning of the line.
626 * - :kbd:`Ctrl+b`
627 - Moves the cursor backward one character.
628 * - :kbd:`Ctrl+c`
629 - Preserves the last command on the screen and starts a new command in
631 * - :kbd:`Ctrl+d`
632 - Deletes the character under the cursor.
633 * - :kbd:`Ctrl+e`
634 - Moves the cursor to the end of the line.
635 * - :kbd:`Ctrl+f`
636 - Moves the cursor forward one character.
637 * - :kbd:`Ctrl+k`
638 - Deletes from the cursor to the end of the line.
639 * - :kbd:`Ctrl+l`
640 - Clears the screen and leaves the currently typed command at the top of
642 * - :kbd:`Ctrl+n`
643 - Moves in history to next entry.
644 * - :kbd:`Ctrl+p`
645 - Moves in history to previous entry.
646 * - :kbd:`Ctrl+u`
647 - Clears the currently typed command.
648 * - :kbd:`Ctrl+w`
649 - Removes the word or part of the word to the left of the cursor. Words
651 * - :kbd:`Alt+b`
652 - Moves the cursor backward one word.
653 * - :kbd:`Alt+f`
654 - Moves the cursor forward one word.
674 An example non-thread safe usage:
676 .. code-block:: c
679 while ((char c = getopt(argc, argv, "abhc:")) != -1) {
691 .. code-block:: c
695 while ((char c = getopt(argc, argv, "abhc:")) != -1) {
699 cvalue = state->optarg;
709 Obscured Input Feature
712 With the obscured input feature, the shell can be used for implementing a login
716 Once the obscured input has been accepted, it is normally desired to return the
717 shell to normal operation. Such runtime control is possible with the
749 block, for example, by a UART with hardware flow control. If timeout is
774 <https://www.segger.com/products/debug-probes/j-link/technology/about-real-time-transfer/#j-link-rt…
789 .. code-block:: c
838 .. code-block:: none
851 are built-in commands which have been registered by
860 .. code-block:: none