shell: add function checking shell readiness.

Tests with shell commands will fail if they are started
before the shell backend is initialized or started.
Adding API function: shell_ready indicating shell readiness.

Signed-off-by: Jakub Rzeszutko <jakub.rzeszutko@nordicsemi.no>
This commit is contained in:
Jakub Rzeszutko 2022-09-06 09:21:39 +02:00 committed by Carles Cufí
commit 66d4471d48
2 changed files with 16 additions and 0 deletions

View file

@ -1690,6 +1690,13 @@ void shell_set_bypass(const struct shell *sh, shell_bypass_cb_t bypass)
sh->ctx->bypass = bypass;
}
bool shell_ready(const struct shell *sh)
{
__ASSERT_NO_MSG(sh);
return state_get(sh) == SHELL_STATE_ACTIVE;
}
static int cmd_help(const struct shell *shell, size_t argc, char **argv)
{
ARG_UNUSED(argc);