diff --git a/doc/services/shell/index.rst b/doc/services/shell/index.rst index 209bdab320..6cdb0020bf 100644 --- a/doc/services/shell/index.rst +++ b/doc/services/shell/index.rst @@ -163,7 +163,7 @@ Abstract code for this task would look like this: .. code-block:: c - static int gain_cmd_handler(const struct shell *shell, + static int gain_cmd_handler(const struct shell *sh, size_t argc, char **argv, void *data) { int gain; @@ -172,7 +172,7 @@ Abstract code for this task would look like this: gain = (int)data; adc_set_gain(gain); - shell_print(shell, "ADC gain set to: %s\n" + shell_print(sh, "ADC gain set to: %s\n" "Value send to ADC driver: %d", argv[0], gain); @@ -332,7 +332,7 @@ Simple command handler implementation: .. code-block:: c - static int cmd_handler(const struct shell *shell, size_t argc, + static int cmd_handler(const struct shell *sh, size_t argc, char **argv) { ARG_UNUSED(argc); @@ -340,11 +340,11 @@ Simple command handler implementation: shell_fprintf(shell, SHELL_INFO, "Print info message\n"); - shell_print(shell, "Print simple text."); + shell_print(sh, "Print simple text."); - shell_warn(shell, "Print warning text."); + shell_warn(sh, "Print warning text."); - shell_error(shell, "Print error text."); + shell_error(sh, "Print error text."); return 0; } @@ -379,7 +379,7 @@ commands or the parent commands, depending on how you index ``argv``. .. code-block:: c - static int cmd_handler(const struct shell *shell, size_t argc, + static int cmd_handler(const struct shell *sh, size_t argc, char **argv) { ARG_UNUSED(argc); @@ -387,14 +387,14 @@ commands or the parent commands, depending on how you index ``argv``. /* If it is a subcommand handler parent command syntax * can be found using argv[-1]. */ - shell_print(shell, "This command has a parent command: %s", + shell_print(sh, "This command has a parent command: %s", argv[-1]); /* Print this command syntax */ - shell_print(shell, "This command syntax is: %s", argv[0]); + shell_print(sh, "This command syntax is: %s", argv[0]); /* Print first argument */ - shell_print(shell, "%s", argv[1]); + shell_print(sh, "%s", argv[1]); return 0; } @@ -665,24 +665,24 @@ The following code shows a simple use case of this library: } - static int cmd_demo_ping(const struct shell *shell, size_t argc, + static int cmd_demo_ping(const struct shell *sh, size_t argc, char **argv) { ARG_UNUSED(argc); ARG_UNUSED(argv); - shell_print(shell, "pong"); + shell_print(sh, "pong"); return 0; } - static int cmd_demo_params(const struct shell *shell, size_t argc, + static int cmd_demo_params(const struct shell *sh, size_t argc, char **argv) { int cnt; - shell_print(shell, "argc = %d", argc); + shell_print(sh, "argc = %d", argc); for (cnt = 0; cnt < argc; cnt++) { - shell_print(shell, " argv[%d] = %s", cnt, argv[cnt]); + shell_print(sh, " argv[%d] = %s", cnt, argv[cnt]); } return 0; } diff --git a/drivers/adc/adc_shell.c b/drivers/adc/adc_shell.c index 0aa07ce550..c86362327a 100644 --- a/drivers/adc/adc_shell.c +++ b/drivers/adc/adc_shell.c @@ -124,19 +124,19 @@ static struct adc_hdl *get_adc(const char *device_label) return NULL; } -static int cmd_adc_ch_id(const struct shell *shell, size_t argc, char **argv) +static int cmd_adc_ch_id(const struct shell *sh, size_t argc, char **argv) { /* -2: index of ADC label name */ struct adc_hdl *adc = get_adc(argv[-2]); int retval = 0; if (!device_is_ready(adc->dev)) { - shell_error(shell, "ADC device not ready"); + shell_error(sh, "ADC device not ready"); return -ENODEV; } if (isdigit((unsigned char)argv[1][0]) == 0) { - shell_error(shell, " must be digits"); + shell_error(sh, " must be digits"); return -EINVAL; } @@ -147,7 +147,7 @@ static int cmd_adc_ch_id(const struct shell *shell, size_t argc, char **argv) return retval; } -static int cmd_adc_ch_neg(const struct shell *shell, size_t argc, char **argv) +static int cmd_adc_ch_neg(const struct shell *sh, size_t argc, char **argv) { #if CONFIG_ADC_CONFIGURABLE_INPUTS /* -2: index of ADC label name */ @@ -155,12 +155,12 @@ static int cmd_adc_ch_neg(const struct shell *shell, size_t argc, char **argv) int retval = 0; if (!device_is_ready(adc->dev)) { - shell_error(shell, "ADC device not ready"); + shell_error(sh, "ADC device not ready"); return -ENODEV; } if (isdigit((unsigned char)argv[1][0]) == 0) { - shell_error(shell, " must be digits"); + shell_error(sh, " must be digits"); return -EINVAL; } @@ -174,7 +174,7 @@ static int cmd_adc_ch_neg(const struct shell *shell, size_t argc, char **argv) #endif } -static int cmd_adc_ch_pos(const struct shell *shell, size_t argc, char **argv) +static int cmd_adc_ch_pos(const struct shell *sh, size_t argc, char **argv) { #if CONFIG_ADC_CONFIGURABLE_INPUTS /* -2: index of ADC label name */ @@ -182,12 +182,12 @@ static int cmd_adc_ch_pos(const struct shell *shell, size_t argc, char **argv) int retval = 0; if (!device_is_ready(adc->dev)) { - shell_error(shell, "ADC device not ready"); + shell_error(sh, "ADC device not ready"); return -ENODEV; } if (isdigit((unsigned char)argv[1][0]) == 0) { - shell_error(shell, " must be digits"); + shell_error(sh, " must be digits"); return -EINVAL; } @@ -201,7 +201,7 @@ static int cmd_adc_ch_pos(const struct shell *shell, size_t argc, char **argv) #endif } -static int cmd_adc_gain(const struct shell *shell, size_t argc, char **argv, +static int cmd_adc_gain(const struct shell *sh, size_t argc, char **argv, void *data) { /* -2: index of ADC label name */ @@ -210,7 +210,7 @@ static int cmd_adc_gain(const struct shell *shell, size_t argc, char **argv, int retval = -EINVAL; if (!device_is_ready(adc->dev)) { - shell_error(shell, "ADC device not ready"); + shell_error(sh, "ADC device not ready"); return -ENODEV; } @@ -225,7 +225,7 @@ static int cmd_adc_gain(const struct shell *shell, size_t argc, char **argv, return retval; } -static int cmd_adc_acq(const struct shell *shell, size_t argc, char **argv) +static int cmd_adc_acq(const struct shell *sh, size_t argc, char **argv) { /* -1 index of ADC label name */ struct adc_hdl *adc = get_adc(argv[-1]); @@ -233,12 +233,12 @@ static int cmd_adc_acq(const struct shell *shell, size_t argc, char **argv) int retval; if (!device_is_ready(adc->dev)) { - shell_error(shell, "ADC device not ready"); + shell_error(sh, "ADC device not ready"); return -ENODEV; } if (isdigit((unsigned char)argv[1][0]) == 0) { - shell_error(shell, "