Skip to content

Commit 57e6532

Browse files
ualbertagreenstephanosio
authored andcommitted
doc: update documentation for shell library change
The SHELL_SUBCMD_DICT_SET_CREATE macro was previous changed in PR #51231 to require a string comment as part of the macro but the documentation was not updated to reflect that. This patch updates the documentation to relect the change in the shell library. Signed-off-by: Jason Yuan <[email protected]>
1 parent 3e5ac7a commit 57e6532

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

doc/services/shell/index.rst

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -163,27 +163,28 @@ Abstract code for this task would look like this:
163163

164164
.. code-block:: c
165165
166-
static int gain_cmd_handler(const struct shell *shell,
167-
size_t argc, char **argv, void *data)
168-
{
169-
int gain;
166+
static int gain_cmd_handler(const struct shell *shell,
167+
size_t argc, char **argv, void *data)
168+
{
169+
int gain;
170170
171-
/* data is a value corresponding to called command syntax */
172-
gain = (int)data;
173-
adc_set_gain(gain);
171+
/* data is a value corresponding to called command syntax */
172+
gain = (int)data;
173+
adc_set_gain(gain);
174174
175-
shell_print(shell, "ADC gain set to: %s\n"
176-
"Value send to ADC driver: %d",
177-
argv[0],
178-
gain);
175+
shell_print(shell, "ADC gain set to: %s\n"
176+
"Value send to ADC driver: %d",
177+
argv[0],
178+
gain);
179179
180-
return 0;
181-
}
180+
return 0;
181+
}
182182
183-
SHELL_SUBCMD_DICT_SET_CREATE(sub_gain, gain_cmd_handler,
184-
(gain_1, 1), (gain_2, 2), (gain_1_2, 3), (gain_1_4, 4)
185-
);
186-
SHELL_CMD_REGISTER(gain, &sub_gain, "Set ADC gain", NULL);
183+
SHELL_SUBCMD_DICT_SET_CREATE(sub_gain, gain_cmd_handler,
184+
(gain_1, 1, "gain 1"), (gain_2, 2, "gain 2"),
185+
(gain_1_2, 3, "gain 1/2"), (gain_1_4, 4, "gain 1/4")
186+
);
187+
SHELL_CMD_REGISTER(gain, &sub_gain, "Set ADC gain", NULL);
187188
188189
189190
This is how it would look like in the shell:

0 commit comments

Comments
 (0)